com.hazelcast.spi

## Interface NodeEngine

-     public interface NodeEngine

  The NodeEngine is the 'umbrella' of services/service-method that gets injected into a `ManagedService`.

  So if you are writing a custom SPI service, such as a stack-service, this service should probably implement the `ManagedService` so you can get access to the services within the system.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.hazelcast.internal.cluster.ClusterService` | `getClusterService()` Gets the ClusterService.
    `Config` | `getConfig()` Returns the Config that was used to create the HazelcastInstance.
    `ClassLoader` | `getConfigClassLoader()` Returns the Config ClassLoader.
    `EventService` | `getEventService()` Gets the EventService.
    `ExecutionService` | `getExecutionService()` Gets the ExecutionService.
    `HazelcastInstance` | `getHazelcastInstance()` Returns the HazelcastInstance that this `NodeEngine` belongs to.
    `Member` | `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.
    `Address` | `getMasterAddress()` Gets the address of the master member.
    `OperationService` | `getOperationService()` Gets the OperationService.
    `IPartitionService` | `getPartitionService()` Gets the IPartitionService.
    `HazelcastProperties` | `getProperties()` Returns the HazelcastProperties.
    `ProxyService` | `getProxyService()` Gets the ProxyService.
    `QuorumService` | `getQuorumService()` Gets the QuorumService.
    `SerializationService` | `getSerializationService()` Gets the SerializationService.
    `<T> T` | `getService(String serviceName)` Gets the service with the given name.
    `<S> Collection<S>` | `getServices(Class<S> serviceClass)` Returns a list of services matching provides service class/interface.
    `<T extends SharedService> T` | `getSharedService(String serviceName)` Deprecated. since 3.7, please use `getService(String)` instead
    `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()` Deprecated.
    `boolean` | `isRunning()` Indicates that node is not shutting down or it has not already shut down
    `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.

- - ### Method Detail

    - #### getOperationService

          OperationService getOperationService()

      Gets the OperationService.
      Returns:
        the OperationService

    - #### getExecutionService

          ExecutionService getExecutionService()

      Gets the ExecutionService.
      Returns:
        the ExecutionService

    - #### getClusterService

          com.hazelcast.internal.cluster.ClusterService getClusterService()

      Gets the ClusterService.
      Returns:
        the ClusterService

    - #### getPartitionService

          IPartitionService getPartitionService()

      Gets the IPartitionService.
      Returns:
        the IPartitionService

    - #### getEventService

          EventService getEventService()

      Gets the EventService.
      Returns:
        the EventService

    - #### getSerializationService

          SerializationService getSerializationService()

      Gets the SerializationService.
      Returns:
        the SerializationService

    - #### getProxyService

          ProxyService getProxyService()

      Gets the ProxyService.
      Returns:
        the ProxyService

    - #### getWanReplicationService

          WanReplicationService getWanReplicationService()

      Gets the WanReplicationService.
      Returns:
        the WanReplicationService

    - #### getQuorumService

          QuorumService getQuorumService()

      Gets the QuorumService.
      Returns:
        the QuorumService

    - #### getTransactionManagerService

          TransactionManagerService getTransactionManagerService()

      Gets the TransactionManagerService.
      Returns:
        the TransactionManagerService

    - #### getMasterAddress

          Address getMasterAddress()

      Gets the address of the master member.

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

      The value can change over time.

      Returns:
        the address of the master member

    - #### getThisAddress

          Address getThisAddress()

      Get the address of this member.

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

      Returns:
        the address of this member

    - #### getLocalMember

          Member getLocalMember()

      Returns the local member.

      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.

      Returns:
        the local member

    - #### getConfig

          Config getConfig()

      Returns the Config that was used to create the HazelcastInstance.

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

      Returns:
        the config

    - #### getConfigClassLoader

          ClassLoader getConfigClassLoader()

      Returns the Config ClassLoader. This class loader will be used for instantiation of all classes defined by the configuration (e.g. listeners, policies, stores, partitioning strategies, quorum functions, ...).

      TODO: add more documentation what the purpose is of the config classloader

      Returns:
        the config ClassLoader.

    - #### getProperties

          HazelcastProperties getProperties()

      Returns the HazelcastProperties.

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

      Returns:
        the HazelcastProperties

    - #### getLogger

          ILogger getLogger(String name)

      Gets the logger for a given name.

      It is best to get an ILogger through this method instead of calling `Logger.getLogger(String)`.

      Parameters:
        `name` - the name of the logger
      Returns:
        the ILogger
      Throws:
        `NullPointerException` - if name is `null`
      See Also:
        `getLogger(String)`

    - #### getLogger

          ILogger getLogger(Class clazz)

      Gets the logger for a given class.

      It is best to get an ILogger through this method instead of calling `Logger.getLogger(Class)`.

      Parameters:
        `clazz` - the class of the logger
      Returns:
        the ILogger
      Throws:
        `NullPointerException` - if clazz is `null`
      See Also:
        `getLogger(Class)`

    - #### toData

          Data toData(Object object)

      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.

      Parameters:
        `object` - the object to serialize
      Returns:
        the serialized object
      Throws:
        `HazelcastSerializationException` - when serialization fails

    - #### toObject

          <T> T toObject(Object object)

      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.

      Parameters:
        `object` - the object to deserialize
      Returns:
        the deserialized object
      Throws:
        `HazelcastSerializationException` - when deserialization fails

    - #### toObject

          <T> T toObject(Object object,
                         Class klazz)

      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.

      Parameters:
        `object` - the object to deserialize
        `klazz` - The class to instantiate when deserializing the object
      Returns:
        the deserialized object
      Throws:
        `HazelcastSerializationException` - when deserialization fails

    - #### isActive

          @Deprecated
          boolean isActive()

      Deprecated.
      Checks if the HazelcastInstance that this `NodeEngine` belongs to is still active.

      A HazelcastInstance is not active when it is shutting down or already shut down. Also see `isRunning()`.

      Returns:
        `true` if active, `false` otherwise

    - #### isRunning

          boolean isRunning()

      Indicates that node is not shutting down or it has not already shut down
      Returns:
        `true` if node is not shutting down or it has not already shut down, `false` otherwise

    - #### getHazelcastInstance

          HazelcastInstance getHazelcastInstance()

      Returns the HazelcastInstance that this `NodeEngine` belongs to.
      Returns:
        the HazelcastInstance

    - #### getService

          <T> T getService(String serviceName)

      Gets the service with the given name.
      Type Parameters:
        `T` - the type of the service
      Parameters:
        `serviceName` - the name of the service
      Returns:
        the found service, or HazelcastException in case of failure (`null` will never be returned)

    - #### getSharedService

          <T extends SharedService> T getSharedService(String serviceName)

      Deprecated. since 3.7, please use `getService(String)` instead
      Gets the `SharedService` for the given serviceName.
      Type Parameters:
        `T` - the type of the service
      Parameters:
        `serviceName` - the name of the shared service to get
      Returns:
        the found service, or null if the service was not found
      Throws:
        `NullPointerException` - if the serviceName is `null`

    - #### getVersion

          MemberVersion getVersion()

      Returns the codebase version of the node. For example, when running on hazelcast-3.8.jar, this would resolve to `Version.of(3,8,0)`. A node's codebase version may be different than cluster version.
      Returns:
        codebase version of the node
      Since:
        3.8
      See Also:
        `Cluster.getClusterVersion()`

    - #### getSplitBrainMergePolicyProvider

          SplitBrainMergePolicyProvider getSplitBrainMergePolicyProvider()

      Returns the `SplitBrainMergePolicyProvider` for this instance.
      Returns:
        the `SplitBrainMergePolicyProvider`
      Since:
        3.10

    - #### getServices

          <S> Collection<S> getServices(Class<S> serviceClass)

      Returns a list of services matching provides service class/interface.

      Note: CoreServices will be placed at the beginning of the list.

Copyright © 2019. All rights reserved.