com.hazelcast.spi.impl
Class NodeEngineImpl

java.lang.Object
  extended by com.hazelcast.spi.impl.NodeEngineImpl
All Implemented Interfaces:
NodeEngine

public class NodeEngineImpl
extends Object
implements NodeEngine

The NodeEngineImpl is the where the construction of the Hazelcast dependencies take place. It can be compared to a Spring ApplicationContext. It is fine that we refer to concrete types, and it is fine that we cast to a concrete type within this class (e.g. to call shutdown). In an application context you get exactly the same behavior.

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 Summary
NodeEngineImpl(Node node)
           
 
Method Summary
 ClusterService getClusterService()
          Gets the ClusterService.
 Config getConfig()
          Returns the Config that was used to create the HazelcastInstance.
 ClassLoader getConfigClassLoader()
          Returns the Config ClassLoader.
 InternalEventService getEventService()
          Gets the EventService.
 InternalExecutionService getExecutionService()
          Gets the ExecutionService.
 GroupProperties getGroupProperties()
          Returns the GroupProperties.
 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.
 ManagementCenterService getManagementCenterService()
           
 Address getMasterAddress()
          Gets the address of the master member.
 Node getNode()
           
 Storage<DataRef> getOffHeapStorage()
          Returns the offheap Storage.
 InternalOperationService getOperationService()
          Gets the OperationService.
 PacketTransceiver getPacketTransceiver()
           
 InternalPartitionService getPartitionService()
          Gets the InternalPartitionService.
 Operation[] getPostJoinOperations()
          Post join operations must be lock free; means no locks at all; no partition locks, no key-based locks, no service level locks!

Post join operations should return response, at least a null response.

 InternalProxyService getProxyService()
          Gets the ProxyService.
 QuorumServiceImpl getQuorumService()
           
 SerializationService getSerializationService()
          Gets the SerializationService.
<T> T
getService(String serviceName)
           
 Collection<ServiceInfo> getServiceInfos(Class serviceClass)
           
<S> Collection<S>
getServices(Class<S> serviceClass)
          Returns a list of services matching provides service class/interface.
<T extends SharedService>
T
getSharedService(String serviceName)
          Gets the SharedService for the given serviceName.
 Address getThisAddress()
          Get the address of this member.
 TransactionManagerService getTransactionManagerService()
          Gets the TransactionManagerService.
 InternalWaitNotifyService getWaitNotifyService()
          Gets the WaitNotifyService.
 WanReplicationService getWanReplicationService()
          Gets the WanReplicationService.
 boolean isActive()
          Checks if the HazelcastInstance that this NodeEngine belongs to is still active.
 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.
 Object toObject(Object object)
          Deserializes an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeEngineImpl

public NodeEngineImpl(Node node)
Method Detail

getPacketTransceiver

public PacketTransceiver getPacketTransceiver()

start

public void start()

getThisAddress

public Address getThisAddress()
Description copied from interface: NodeEngine
Get the address of this member.

The returned value will never change and will never be null.

Specified by:
getThisAddress in interface NodeEngine
Returns:
the address of this member.

getMasterAddress

public Address getMasterAddress()
Description copied from interface: NodeEngine
Gets the address of the master member.

This value can be null if no master is elected yet.

The value can change over time.

Specified by:
getMasterAddress in interface NodeEngine
Returns:
the address of the master member.

getLocalMember

public MemberImpl getLocalMember()
Description copied from interface: NodeEngine
Returns the local member.

The returned value will never change and will never be null.

Specified by:
getLocalMember in interface NodeEngine
Returns:
the local member.

getConfig

public Config getConfig()
Description copied from interface: NodeEngine
Returns the Config that was used to create the HazelcastInstance.

The returned value will never change and will never be null.

Specified by:
getConfig in interface NodeEngine
Returns:
the config.

getConfigClassLoader

public ClassLoader getConfigClassLoader()
Description copied from interface: NodeEngine
Returns the Config ClassLoader.

todo: add more documentation what the purpose is of the config classloader.

Specified by:
getConfigClassLoader in interface NodeEngine
Returns:
the config ClassLoader.

getEventService

public InternalEventService getEventService()
Description copied from interface: NodeEngine
Gets the EventService.

Specified by:
getEventService in interface NodeEngine
Returns:
the EventService.

getSerializationService

public SerializationService getSerializationService()
Description copied from interface: NodeEngine
Gets the SerializationService.

Specified by:
getSerializationService in interface NodeEngine
Returns:
the SerializationService.

getOperationService

public InternalOperationService getOperationService()
Description copied from interface: NodeEngine
Gets the OperationService.

Specified by:
getOperationService in interface NodeEngine
Returns:
the OperationService.

getExecutionService

public InternalExecutionService getExecutionService()
Description copied from interface: NodeEngine
Gets the ExecutionService.

Specified by:
getExecutionService in interface NodeEngine
Returns:
the ExecutionService.

getPartitionService

public InternalPartitionService getPartitionService()
Description copied from interface: NodeEngine
Gets the InternalPartitionService.

Specified by:
getPartitionService in interface NodeEngine
Returns:
the InternalPartitionService.

getClusterService

public ClusterService getClusterService()
Description copied from interface: NodeEngine
Gets the ClusterService.

Specified by:
getClusterService in interface NodeEngine
Returns:
the ClusterService.

getManagementCenterService

public ManagementCenterService getManagementCenterService()

getProxyService

public InternalProxyService getProxyService()
Description copied from interface: NodeEngine
Gets the ProxyService.

Specified by:
getProxyService in interface NodeEngine
Returns:
the ProxyService.

getWaitNotifyService

public InternalWaitNotifyService getWaitNotifyService()
Description copied from interface: NodeEngine
Gets the WaitNotifyService.

Specified by:
getWaitNotifyService in interface NodeEngine
Returns:
the WaitNotifyService.

getWanReplicationService

public WanReplicationService getWanReplicationService()
Description copied from interface: NodeEngine
Gets the WanReplicationService.

Specified by:
getWanReplicationService in interface NodeEngine
Returns:
the WanReplicationService.

getQuorumService

public QuorumServiceImpl getQuorumService()
Specified by:
getQuorumService in interface NodeEngine

getTransactionManagerService

public TransactionManagerService getTransactionManagerService()
Description copied from interface: NodeEngine
Gets the TransactionManagerService.

Specified by:
getTransactionManagerService in interface NodeEngine
Returns:
the TransactionManagerService.

toData

public Data toData(Object object)
Description copied from interface: NodeEngine
Serializes an object to a 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.

Specified by:
toData in interface NodeEngine
Parameters:
object - the object to serialize.
Returns:
the serialized object.

toObject

public Object toObject(Object object)
Description copied from interface: NodeEngine
Deserializes an object.

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.

Specified by:
toObject in interface NodeEngine
Parameters:
object - the object to deserialize.
Returns:
the deserialized object.

isActive

public boolean isActive()
Description copied from interface: NodeEngine
Checks if the HazelcastInstance that this NodeEngine belongs to is still active.

A HazelcastInstance is not active when it is shut down.

Specified by:
isActive in interface NodeEngine
Returns:
true if active, false otherwise.

getHazelcastInstance

public HazelcastInstance getHazelcastInstance()
Description copied from interface: NodeEngine
Returns the HazelcastInstance that this NodeEngine belongs to.

Specified by:
getHazelcastInstance in interface NodeEngine
Returns:
the HazelcastInstance

getLogger

public ILogger getLogger(String name)
Description copied from interface: NodeEngine
Gets the logger for a given name.

It is best to get an ILogger through this method instead of doing

Specified by:
getLogger in interface NodeEngine
Parameters:
name - the name of the logger.
Returns:
the ILogger.
See Also:
NodeEngine.getLogger(Class)

getLogger

public ILogger getLogger(Class clazz)
Description copied from interface: NodeEngine
Gets the logger for a given class.

Specified by:
getLogger in interface NodeEngine
Parameters:
clazz - the class of the logger.
Returns:
the ILogger.
See Also:
NodeEngine.getLogger(String)

getGroupProperties

public GroupProperties getGroupProperties()
Description copied from interface: NodeEngine
Returns the GroupProperties.

The returned value will never change and will never be null.

Specified by:
getGroupProperties in interface NodeEngine
Returns:
the GroupProperties

getService

public <T> T getService(String serviceName)

getSharedService

public <T extends SharedService> T getSharedService(String serviceName)
Description copied from interface: NodeEngine
Gets the SharedService for the given serviceName.

Specified by:
getSharedService in interface NodeEngine
Parameters:
serviceName - the name of the shared service to get.
Returns:
the found service, or null if the service was not found.

getServices

public <S> Collection<S> getServices(Class<S> serviceClass)
Returns a list of services matching provides service class/interface.

CoreServices will be placed at the beginning of the list.


getServiceInfos

public Collection<ServiceInfo> getServiceInfos(Class serviceClass)

getNode

public Node getNode()

onMemberLeft

public void onMemberLeft(MemberImpl member)

onClientDisconnected

public void onClientDisconnected(String clientUuid)

onPartitionMigrate

public void onPartitionMigrate(MigrationInfo migrationInfo)

getPostJoinOperations

public Operation[] getPostJoinOperations()
Post join operations must be lock free; means no locks at all; no partition locks, no key-based locks, no service level locks!

Post join operations should return response, at least a null response.


getOffHeapStorage

public Storage<DataRef> getOffHeapStorage()
Description copied from interface: NodeEngine
Returns the offheap Storage.

Specified by:
getOffHeapStorage in interface NodeEngine
Returns:
the offheap storage.

reset

public void reset()

shutdown

public void shutdown(boolean terminate)


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.