com.hazelcast.instance

## Interface NodeExtension

- All Known Implementing Classes:
    DefaultNodeExtension

      @PrivateApi
      public interface NodeExtension

  NodeExtension is a `Node` extension mechanism to be able to plug different implementations of some modules, like; `SerializationService`, `ChannelFactory` etc.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterClusterStateChange(ClusterState oldState, ClusterState newState, boolean isTransient)` Called after the cluster state change transaction has completed (successfully or otherwise).
    `void` | `afterStart()` Called after node is started
    `void` | `beforeClusterStateChange(ClusterState currState, ClusterState requestedState, boolean isTransient)` Called before starting a cluster state change transaction.
    `void` | `beforeJoin()` Called before node attempts to join to the cluster
    `void` | `beforeShutdown()` Called before `Node.shutdown()`
    `void` | `beforeStart()` Called before node is started
    `com.hazelcast.internal.networking.ChannelInitializerProvider` | `createChannelInitializerProvider(IOService ioService)` Creates the ChannelInitializerProvider.
    `com.hazelcast.internal.dynamicconfig.DynamicConfigListener` | `createDynamicConfigListener()` Creates a listener for changes in dynamic data structure configurations
    `Map<String,Object>` | `createExtensionServices()` Creates additional extension services, which will be registered by service manager during start-up.
    `com.hazelcast.internal.networking.InboundHandler[]` | `createInboundHandlers(EndpointQualifier qualifier, TcpIpConnection connection, IOService ioService)` Creates a `InboundHandler` for given `Connection` instance.
    `com.hazelcast.internal.jmx.ManagementService` | `createJMXManagementService(HazelcastInstanceImpl instance)`
    `String` | `createMemberUuid(Address address)` Creates a UUID for local member
    `ByteArrayProcessor` | `createMulticastInputProcessor(IOService ioService)` Returns a byte array processor for incoming data on the Multicast joiner
    `ByteArrayProcessor` | `createMulticastOutputProcessor(IOService ioService)` Returns a byte array processor for outgoing data on the Multicast joiner
    `com.hazelcast.internal.networking.OutboundHandler[]` | `createOutboundHandlers(EndpointQualifier qualifier, TcpIpConnection connection, IOService ioService)` Creates a `OutboundHandler` for given `Connection` instance.
    `com.hazelcast.internal.serialization.InternalSerializationService` | `createSerializationService()` Creates a `SerializationService` instance to be used by this `Node`.
    `<T> T` | `createService(Class<T> type)` Creates a service which is an implementation of given type parameter.
    `com.hazelcast.internal.ascii.TextCommandService` | `createTextCommandService()`
    `com.hazelcast.internal.management.TimedMemberStateFactory` | `createTimedMemberStateFactory(HazelcastInstanceImpl instance)` Creates a TimedMemberStateFactory for a given Hazelcast instance
    `HotRestartService` | `getHotRestartService()` Returns the public hot restart service
    `InternalHotRestartService` | `getInternalHotRestartService()` Returns the internal hot restart service
    `com.hazelcast.internal.management.ManagementCenterConnectionFactory` | `getManagementCenterConnectionFactory()`
    `MemoryStats` | `getMemoryStats()` Returns MemoryStats of for the JVM and current HazelcastInstance.
    `SecurityContext` | `getSecurityContext()` Returns `SecurityContext` for this `Node` if available, otherwise returns null.
    `SecurityService` | `getSecurityService()`
    `MemberSocketInterceptor` | `getSocketInterceptor(EndpointQualifier endpointQualifier)` Returns `MemberSocketInterceptor` for this `Node` if available, otherwise returns null.
    `boolean` | `isClientFailoverSupported()`
    `boolean` | `isNodeVersionCompatibleWith(Version clusterVersion)` Check if this node's codebase version is compatible with given cluster version.
    `boolean` | `isStartCompleted()` Returns true if the instance has started
    `void` | `onClusterStateChange(ClusterState newState, boolean isTransient)` Called during the commit phase of the cluster state change transaction, just after updating the value of the cluster state on the local member, while still holding the cluster lock.
    `void` | `onClusterVersionChange(Version newVersion)` Called after cluster version is changed.
    `void` | `onInitialClusterState(ClusterState initialState)` Called when initial cluster state is received while joining the cluster.
    `void` | `onMemberListChange()` Called synchronously when member list changes
    `void` | `onPartitionStateChange()` Called synchronously when partition state (partition assignments, version etc) changes
    `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 `onThreadStart(Thread)`.
    `void` | `printNodeInfo()` Called to print node information during startup
    `boolean` | `registerListener(Object listener)` Registers given listener if it's a known type.
    `void` | `registerPlugins(com.hazelcast.internal.diagnostics.Diagnostics diagnostics)` Register the node extension specific diagnostics plugins on the provided `diagnostics`.
    `void` | `scheduleClusterVersionAutoUpgrade()` Cluster version auto upgrade is done asynchronously.
    `void` | `sendPhoneHome()` Send PhoneHome ping from OS or EE instance to PhoneHome application
    `void` | `shutdown()` Shutdowns `NodeExtension`.
    `void` | `validateJoinRequest(com.hazelcast.internal.cluster.impl.JoinMessage joinMessage)` Executed on the master node before allowing a new member to join from `ClusterJoinManager.handleJoinRequest(JoinRequest, Connection)`.

- - ### Method Detail

    - #### beforeStart

          void beforeStart()

      Called before node is started

    - #### printNodeInfo

          void printNodeInfo()

      Called to print node information during startup

    - #### beforeJoin

          void beforeJoin()

      Called before node attempts to join to the cluster

    - #### afterStart

          void afterStart()

      Called after node is started

    - #### isStartCompleted

          boolean isStartCompleted()

      Returns true if the instance has started

    - #### beforeShutdown

          void beforeShutdown()

      Called before `Node.shutdown()`

    - #### shutdown

          void shutdown()

      Shutdowns `NodeExtension`. Called on `Node.shutdown()`

    - #### createSerializationService

          com.hazelcast.internal.serialization.InternalSerializationService createSerializationService()

      Creates a `SerializationService` instance to be used by this `Node`.
      Returns:
        a `SerializationService` instance

    - #### getSecurityService

          SecurityService getSecurityService()

    - #### getSecurityContext

          SecurityContext getSecurityContext()

      Returns `SecurityContext` for this `Node` if available, otherwise returns null.
      Returns:
        security context

    - #### createService

          <T> T createService(Class<T> type)

      Creates a service which is an implementation of given type parameter.
      Parameters:
        `type` - type of service
      Returns:
        service implementation
      Throws:
        `IllegalArgumentException` - if type is not known

    - #### createExtensionServices

          Map<String,Object> createExtensionServices()

      Creates additional extension services, which will be registered by service manager during start-up. By default returned map will be empty.
      Returns:
        extension services

    - #### getSocketInterceptor

          MemberSocketInterceptor getSocketInterceptor(EndpointQualifier endpointQualifier)

      Returns `MemberSocketInterceptor` for this `Node` if available, otherwise returns null.
      Parameters:
        `endpointQualifier` -
      Returns:
        MemberSocketInterceptor

    - #### createInboundHandlers

          com.hazelcast.internal.networking.InboundHandler[] createInboundHandlers(EndpointQualifier qualifier,
                                                                                   TcpIpConnection connection,
                                                                                   IOService ioService)

      Creates a `InboundHandler` for given `Connection` instance. For TLS and other enterprise features, instead of returning the regular protocol decoder, a TLS decoder can be returned. This is the first item in the chain.
      Parameters:
        `connection` - tcp-ip connection
        `ioService` - IOService
      Returns:
        the created InboundHandler.

    - #### createOutboundHandlers

          com.hazelcast.internal.networking.OutboundHandler[] createOutboundHandlers(EndpointQualifier qualifier,
                                                                                     TcpIpConnection connection,
                                                                                     IOService ioService)

      Creates a `OutboundHandler` for given `Connection` instance.
      Parameters:
        `connection` - tcp-ip connection
        `ioService` - IOService
      Returns:
        the created OutboundHandler

    - #### createChannelInitializerProvider

          com.hazelcast.internal.networking.ChannelInitializerProvider createChannelInitializerProvider(IOService ioService)

      Creates the ChannelInitializerProvider.
      Parameters:
        `ioService` -
      Returns:

    - #### onThreadStart

          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.
      Parameters:
        `thread` - thread starting

    - #### onThreadStop

          void onThreadStop(Thread thread)

      Called before a thread stops to clean/release injected by `onThreadStart(Thread)`.
      Parameters:
        `thread` - thread stopping

    - #### getMemoryStats

          MemoryStats getMemoryStats()

      Returns MemoryStats of for the JVM and current HazelcastInstance.
      Returns:
        memory statistics

    - #### validateJoinRequest

          void validateJoinRequest(com.hazelcast.internal.cluster.impl.JoinMessage joinMessage)

      Executed on the master node before allowing a new member to join from `ClusterJoinManager.handleJoinRequest(JoinRequest, Connection)`. Implementation should check if the `JoinMessage` should be allowed to proceed, otherwise throw an exception with a message explaining rejection reason.

    - #### onInitialClusterState

          void onInitialClusterState(ClusterState initialState)

      Called when initial cluster state is received while joining the cluster.
      Parameters:
        `initialState` - initial cluster state

    - #### beforeClusterStateChange

          void beforeClusterStateChange(ClusterState currState,
                                        ClusterState requestedState,
                                        boolean isTransient)

      Called before starting a cluster state change transaction. Called only on the member that initiated the state change.
      Parameters:
        `currState` - the state before the change
        `requestedState` - the requested cluster state
        `isTransient` - whether the change will be recorded in persistent storage, affecting the initial state after cluster restart. Transient changes happen during system operations such as an orderly all-cluster shutdown.

    - #### onClusterStateChange

          void onClusterStateChange(ClusterState newState,
                                    boolean isTransient)

      Called during the commit phase of the cluster state change transaction, just after updating the value of the cluster state on the local member, while still holding the cluster lock. Called on all cluster members.
      Parameters:
        `newState` - the new cluster state
        `isTransient` - whether the change will be recorded in persistent storage, affecting the initial state after cluster restart. Transient changes happen during system operations such as an orderly all-cluster shutdown.

    - #### afterClusterStateChange

          void afterClusterStateChange(ClusterState oldState,
                                       ClusterState newState,
                                       boolean isTransient)

      Called after the cluster state change transaction has completed (successfully or otherwise). Called only on the member that initiated the state change.
      Parameters:
        `oldState` - the state before the change
        `newState` - the new cluster state, can be equal to `oldState` if the state change transaction failed
        `isTransient` - whether the change will be recorded in persistent storage, affecting the initial state after cluster restart. Transient changes happen during system operations such as an orderly all-cluster shutdown.

    - #### onPartitionStateChange

          void onPartitionStateChange()

      Called synchronously when partition state (partition assignments, version etc) changes

    - #### onMemberListChange

          void onMemberListChange()

      Called synchronously when member list changes

    - #### onClusterVersionChange

          void onClusterVersionChange(Version newVersion)

      Called after cluster version is changed.
      Parameters:
        `newVersion` - the new version at which the cluster operates.

    - #### isNodeVersionCompatibleWith

          boolean isNodeVersionCompatibleWith(Version clusterVersion)

      Check if this node's codebase version is compatible with given cluster version.
      Parameters:
        `clusterVersion` - the cluster version to check against
      Returns:
        `true` if compatible, otherwise false.

    - #### registerListener

          boolean registerListener(Object listener)

      Registers given listener if it's a known type.
      Parameters:
        `listener` - listener instance
      Returns:
        true if listener is registered, false otherwise

    - #### getHotRestartService

          HotRestartService getHotRestartService()

      Returns the public hot restart service

    - #### getInternalHotRestartService

          InternalHotRestartService getInternalHotRestartService()

      Returns the internal hot restart service

    - #### createMemberUuid

          String createMemberUuid(Address address)

      Creates a UUID for local member
      Parameters:
        `address` - address of local member
      Returns:
        new UUID

    - #### createTimedMemberStateFactory

          com.hazelcast.internal.management.TimedMemberStateFactory createTimedMemberStateFactory(HazelcastInstanceImpl instance)

      Creates a TimedMemberStateFactory for a given Hazelcast instance
      Parameters:
        `instance` - The instance to associate with the timed member state factory
      Returns:
        `TimedMemberStateFactory`

    - #### getManagementCenterConnectionFactory

          com.hazelcast.internal.management.ManagementCenterConnectionFactory getManagementCenterConnectionFactory()

    - #### createJMXManagementService

          com.hazelcast.internal.jmx.ManagementService createJMXManagementService(HazelcastInstanceImpl instance)

    - #### createTextCommandService

          com.hazelcast.internal.ascii.TextCommandService createTextCommandService()

    - #### createMulticastInputProcessor

          ByteArrayProcessor createMulticastInputProcessor(IOService ioService)

      Returns a byte array processor for incoming data on the Multicast joiner

    - #### createMulticastOutputProcessor

          ByteArrayProcessor createMulticastOutputProcessor(IOService ioService)

      Returns a byte array processor for outgoing data on the Multicast joiner

    - #### createDynamicConfigListener

          com.hazelcast.internal.dynamicconfig.DynamicConfigListener createDynamicConfigListener()

      Creates a listener for changes in dynamic data structure configurations
      Returns:
        Listener to be notfied about changes in data structure configurations

    - #### registerPlugins

          void registerPlugins(com.hazelcast.internal.diagnostics.Diagnostics diagnostics)

      Register the node extension specific diagnostics plugins on the provided `diagnostics`.
      Parameters:
        `diagnostics` - the diagnostics on which plugins should be registered

    - #### sendPhoneHome

          void sendPhoneHome()

      Send PhoneHome ping from OS or EE instance to PhoneHome application

    - #### scheduleClusterVersionAutoUpgrade

          void scheduleClusterVersionAutoUpgrade()

      Cluster version auto upgrade is done asynchronously. Every call of this method creates and schedules a new auto upgrade task.

    - #### isClientFailoverSupported

          boolean isClientFailoverSupported()

      Returns:
        true if client failover feature is supported

Copyright © 2019. All rights reserved.