public class DefaultNodeExtension extends Object implements NodeExtension
Modifier and Type | Field and Description |
---|---|
protected ILogger |
logger |
protected Node |
node |
protected ILogger |
systemLogger |
Constructor and Description |
---|
DefaultNodeExtension(Node node) |
Modifier and Type | Method and Description |
---|---|
void |
afterStart()
Called after node is started
|
void |
beforeJoin()
Called before node attempts to join to the cluster
|
void |
beforeShutdown()
Called before Node.shutdown()
|
void |
beforeStart()
Called before node is started
|
Map<String,Object> |
createExtensionServices()
Creates additional extension services, which will be registered by
service manager during start-up.
|
MessageTaskFactory |
createMessageTaskFactory()
Creates factory method that creates server side client message handlers
|
ReadHandler |
createReadHandler(TcpIpConnection connection,
IOService ioService)
Creates a ReadHandler for given Connection instance.
|
SerializationService |
createSerializationService()
Creates a SerializationService instance to be used by this Node.
|
<T> T |
createService(Class<T> clazz)
Creates a service which is an implementation of given type parameter.
|
WriteHandler |
createWriteHandler(TcpIpConnection connection,
IOService ioService)
Creates a WriteHandler for given Connection instance.
|
MemberSocketInterceptor |
getMemberSocketInterceptor()
Returns MemberSocketInterceptor for this Node if available,
otherwise returns null.
|
MemoryStats |
getMemoryStats()
Returns MemoryStats of for the JVM and current HazelcastInstance.
|
protected PartitioningStrategy |
getPartitioningStrategy(ClassLoader configClassLoader) |
SecurityContext |
getSecurityContext()
Returns SecurityContext for this Node if available, otherwise returns null.
|
SocketChannelWrapperFactory |
getSocketChannelWrapperFactory()
Returns SocketChannelWrapperFactory instance to be used by this Node.
|
boolean |
isStartCompleted()
Returns true if the instance has started
|
void |
onClusterStateChange(ClusterState newState,
boolean persistentChange)
Called when cluster state is changed
|
void |
onThreadStart(Thread thread)
Called on thread start to inject/intercept extension specific logic,
like; registering thread in some service,
executing a special method before thread starts to do its own task.
|
void |
onThreadStop(Thread thread)
Called before a thread stops to clean/release injected by
NodeExtension.onThreadStart(Thread) . |
void |
printNodeInfo()
Called to print node information during startup
|
boolean |
registerListener(Object listener)
Registers given register if it's a known type.
|
void |
shutdown()
Shutdowns NodeExtension.
|
boolean |
triggerForceStart()
Forces node to start by skipping hot-restart completely and removing all hot-restart data
even if node is still on validation phase or loading hot-restart data.
|
void |
validateJoinRequest()
Called before a new node is joining to cluster,
executed if node is the master node before join event.
|
protected final Node node
protected final ILogger logger
protected final ILogger systemLogger
public DefaultNodeExtension(Node node)
public void beforeStart()
NodeExtension
beforeStart
in interface NodeExtension
public void printNodeInfo()
NodeExtension
printNodeInfo
in interface NodeExtension
public void beforeJoin()
NodeExtension
beforeJoin
in interface NodeExtension
public void afterStart()
NodeExtension
afterStart
in interface NodeExtension
public boolean isStartCompleted()
NodeExtension
isStartCompleted
in interface NodeExtension
public SecurityContext getSecurityContext()
NodeExtension
getSecurityContext
in interface NodeExtension
public SerializationService createSerializationService()
NodeExtension
createSerializationService
in interface NodeExtension
protected PartitioningStrategy getPartitioningStrategy(ClassLoader configClassLoader) throws Exception
Exception
public <T> T createService(Class<T> clazz)
NodeExtension
createService
in interface NodeExtension
clazz
- type of servicepublic Map<String,Object> createExtensionServices()
NodeExtension
createExtensionServices
in interface NodeExtension
public MemberSocketInterceptor getMemberSocketInterceptor()
NodeExtension
getMemberSocketInterceptor
in interface NodeExtension
public SocketChannelWrapperFactory getSocketChannelWrapperFactory()
NodeExtension
getSocketChannelWrapperFactory
in interface NodeExtension
public ReadHandler createReadHandler(TcpIpConnection connection, IOService ioService)
NodeExtension
createReadHandler
in interface NodeExtension
connection
- tcp-ip connectionioService
- IOServicepublic WriteHandler createWriteHandler(TcpIpConnection connection, IOService ioService)
NodeExtension
createWriteHandler
in interface NodeExtension
connection
- tcp-ip connectionioService
- IOServicepublic MessageTaskFactory createMessageTaskFactory()
NodeExtension
createMessageTaskFactory
in interface NodeExtension
public void onThreadStart(Thread thread)
NodeExtension
onThreadStart
in interface NodeExtension
thread
- thread startingpublic void onThreadStop(Thread thread)
NodeExtension
NodeExtension.onThreadStart(Thread)
.onThreadStop
in interface NodeExtension
thread
- thread stoppingpublic MemoryStats getMemoryStats()
NodeExtension
getMemoryStats
in interface NodeExtension
public void beforeShutdown()
NodeExtension
beforeShutdown
in interface NodeExtension
public void shutdown()
NodeExtension
shutdown
in interface NodeExtension
public void validateJoinRequest()
NodeExtension
ClusterJoinManager
calls this method,
when handleJoinRequest method is called. By this way, we can check the logic we want
by implementing this method. Implementation should throw required exception, with a valid
message which explains rejection reason.validateJoinRequest
in interface NodeExtension
public void onClusterStateChange(ClusterState newState, boolean persistentChange)
NodeExtension
onClusterStateChange
in interface NodeExtension
newState
- new statepersistentChange
- status of the change. A cluster state change may be non-persistent if it has been done temporarily
during system operations such cluster start etc.public boolean registerListener(Object listener)
NodeExtension
registerListener
in interface NodeExtension
listener
- listener instancepublic boolean triggerForceStart()
NodeExtension
triggerForceStart
in interface NodeExtension
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.