public class NodeEngineImpl extends Object implements NodeEngine
But the crucial thing is that we don't want to leak concrete dependencies to the outside. For example
we don't leak OperationServiceImpl
to the outside.
Constructor and Description |
---|
NodeEngineImpl(Node node) |
Modifier and Type | Method and Description |
---|---|
ClusterService |
getClusterService()
Gets the ClusterService.
|
Config |
getConfig()
Returns the Config that was used to create the HazelcastInstance.
|
ClassLoader |
getConfigClassLoader()
Returns the Config ClassLoader.
|
ClusterWideConfigurationService |
getConfigurationService() |
Diagnostics |
getDiagnostics() |
InternalEventService |
getEventService()
Gets the EventService.
|
InternalExecutionService |
getExecutionService()
Gets the ExecutionService.
|
HazelcastInstance |
getHazelcastInstance()
Returns the HazelcastInstance that this
NodeEngine belongs to. |
MemberImpl |
getLocalMember()
Returns the local member.
|
ILogger |
getLogger(Class clazz)
Gets the logger for a given class.
|
ILogger |
getLogger(String name)
Gets the logger for a given name.
|
LoggingService |
getLoggingService() |
ManagementCenterService |
getManagementCenterService() |
Address |
getMasterAddress()
Gets the address of the master member.
|
MetricsRegistry |
getMetricsRegistry() |
Node |
getNode() |
OperationParker |
getOperationParker() |
InternalOperationService |
getOperationService()
Gets the OperationService.
|
PacketHandler |
getPacketDispatcher() |
InternalPartitionService |
getPartitionService()
Gets the IPartitionService.
|
Operation[] |
getPostJoinOperations()
Collects all post-join operations from
PostJoinAwareService s. |
Operation[] |
getPreJoinOperations() |
HazelcastProperties |
getProperties()
Returns the HazelcastProperties.
|
InternalProxyService |
getProxyService()
Gets the ProxyService.
|
QuorumServiceImpl |
getQuorumService()
Gets the QuorumService.
|
SerializationService |
getSerializationService()
Gets the SerializationService.
|
<T> T |
getService(String serviceName)
Gets the service with the given name.
|
Collection<ServiceInfo> |
getServiceInfos(Class serviceClass) |
ServiceManager |
getServiceManager() |
<S> Collection<S> |
getServices(Class<S> serviceClass)
Returns a list of services matching provides service class/interface.
|
<T extends SharedService> |
getSharedService(String serviceName)
Gets the
SharedService for the given serviceName. |
SplitBrainMergePolicyProvider |
getSplitBrainMergePolicyProvider()
Returns the
SplitBrainMergePolicyProvider for this instance. |
Address |
getThisAddress()
Get the address of this member.
|
TransactionManagerService |
getTransactionManagerService()
Gets the TransactionManagerService.
|
MemberVersion |
getVersion()
Returns the codebase version of the node.
|
WanReplicationService |
getWanReplicationService()
Gets the WanReplicationService.
|
boolean |
isActive()
Checks if the HazelcastInstance that this
NodeEngine belongs to is still active. |
boolean |
isRunning()
Indicates that node is not shutting down or it has not already shut down
|
void |
onClientDisconnected(String clientUuid) |
void |
onMemberLeft(MemberImpl member) |
void |
onPartitionMigrate(MigrationInfo migrationInfo) |
void |
reset() |
void |
shutdown(boolean terminate) |
void |
start() |
Data |
toData(Object object)
Serializes an object to a
Data . |
<T> T |
toObject(Object object)
Deserializes an object.
|
<T> T |
toObject(Object object,
Class klazz)
Deserializes an object.
|
public NodeEngineImpl(Node node)
public LoggingService getLoggingService()
public MetricsRegistry getMetricsRegistry()
public void start()
public PacketHandler getPacketDispatcher()
public Diagnostics getDiagnostics()
public ClusterWideConfigurationService getConfigurationService()
public ServiceManager getServiceManager()
public Address getThisAddress()
NodeEngine
The returned value will never change and will never be null
.
getThisAddress
in interface NodeEngine
public Address getMasterAddress()
NodeEngine
This value can be null if no master is elected yet.
The value can change over time.
getMasterAddress
in interface NodeEngine
public MemberImpl getLocalMember()
NodeEngine
The returned value will never be null but it may change when local lite member is promoted to a data member or when this member merges to a new cluster after split-brain detected. Returned value should not be cached but instead this method should be called each time when local member is needed.
getLocalMember
in interface NodeEngine
public Config getConfig()
NodeEngine
The returned value will never change and will never be null
.
getConfig
in interface NodeEngine
public ClassLoader getConfigClassLoader()
NodeEngine
TODO: add more documentation what the purpose is of the config classloader
getConfigClassLoader
in interface NodeEngine
public InternalEventService getEventService()
NodeEngine
getEventService
in interface NodeEngine
public SerializationService getSerializationService()
NodeEngine
getSerializationService
in interface NodeEngine
public InternalOperationService getOperationService()
NodeEngine
getOperationService
in interface NodeEngine
public InternalExecutionService getExecutionService()
NodeEngine
getExecutionService
in interface NodeEngine
public InternalPartitionService getPartitionService()
NodeEngine
getPartitionService
in interface NodeEngine
public ClusterService getClusterService()
NodeEngine
getClusterService
in interface NodeEngine
public ManagementCenterService getManagementCenterService()
public InternalProxyService getProxyService()
NodeEngine
getProxyService
in interface NodeEngine
public OperationParker getOperationParker()
public WanReplicationService getWanReplicationService()
NodeEngine
getWanReplicationService
in interface NodeEngine
public QuorumServiceImpl getQuorumService()
NodeEngine
getQuorumService
in interface NodeEngine
public TransactionManagerService getTransactionManagerService()
NodeEngine
getTransactionManagerService
in interface NodeEngine
public Data toData(Object object)
NodeEngine
Data
.
This method can safely be called with a Data
instance. In that case, that instance is returned.
If this method is called with null
, null
is returned.
toData
in interface NodeEngine
object
- the object to serializepublic <T> T toObject(Object object)
NodeEngine
This method can safely be called on an object that is already deserialized. In that case, that instance is returned.
If this method is called with null
, null
is returned.
toObject
in interface NodeEngine
object
- the object to deserializepublic <T> T toObject(Object object, Class klazz)
NodeEngine
This method can safely be called on an object that is already deserialized. In that case, that instance is returned.
If this method is called with null
, null
is returned.
toObject
in interface NodeEngine
object
- the object to deserializeklazz
- The class to instantiate when deserializing the objectpublic boolean isActive()
NodeEngine
NodeEngine
belongs to is still active.
A HazelcastInstance is not active when it is shutting down or already shut down.
Also see NodeEngine.isRunning()
.
isActive
in interface NodeEngine
true
if active, false
otherwisepublic boolean isRunning()
NodeEngine
isRunning
in interface NodeEngine
true
if node is not shutting down or it has not already shut down, false
otherwisepublic HazelcastInstance getHazelcastInstance()
NodeEngine
NodeEngine
belongs to.getHazelcastInstance
in interface NodeEngine
public ILogger getLogger(String name)
NodeEngine
It is best to get an ILogger through this method instead of calling Logger.getLogger(String)
.
getLogger
in interface NodeEngine
name
- the name of the loggerNodeEngine.getLogger(String)
public ILogger getLogger(Class clazz)
NodeEngine
It is best to get an ILogger through this method instead of calling Logger.getLogger(Class)
.
getLogger
in interface NodeEngine
clazz
- the class of the loggerNodeEngine.getLogger(Class)
public HazelcastProperties getProperties()
NodeEngine
The returned value will never change and will never be null
.
getProperties
in interface NodeEngine
public <T> T getService(String serviceName)
NodeEngine
getService
in interface NodeEngine
T
- the type of the serviceserviceName
- the name of the servicenull
will never be returned)public <T extends SharedService> T getSharedService(String serviceName)
NodeEngine
SharedService
for the given serviceName.getSharedService
in interface NodeEngine
T
- the type of the serviceserviceName
- the name of the shared service to getpublic MemberVersion getVersion()
NodeEngine
Version.of(3,8,0)
. A node's codebase version may be different than cluster version.getVersion
in interface NodeEngine
Cluster.getClusterVersion()
public SplitBrainMergePolicyProvider getSplitBrainMergePolicyProvider()
NodeEngine
SplitBrainMergePolicyProvider
for this instance.getSplitBrainMergePolicyProvider
in interface NodeEngine
SplitBrainMergePolicyProvider
public <S> Collection<S> getServices(Class<S> serviceClass)
NodeEngine
Note: CoreServices will be placed at the beginning of the list.
getServices
in interface NodeEngine
public Collection<ServiceInfo> getServiceInfos(Class serviceClass)
public Node getNode()
public void onMemberLeft(MemberImpl member)
public void onClientDisconnected(String clientUuid)
public void onPartitionMigrate(MigrationInfo migrationInfo)
public Operation[] getPostJoinOperations()
PostJoinAwareService
s.
Post join operations should return response, at least a null
response.
Note: Post join operations must be lock free, meaning no locks at all:
no partition locks, no key-based locks, no service level locks, no database interaction!
The Operation.getPartitionId()
method should return a negative value.
This means that the operations should not implement PartitionAwareOperation
.
public Operation[] getPreJoinOperations()
public void reset()
public void shutdown(boolean terminate)
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.