Class OHazelcastClusterMetadataManager

java.lang.Object
com.orientechnologies.orient.server.hazelcast.OHazelcastClusterMetadataManager
All Implemented Interfaces:
com.hazelcast.core.EntryListener<String,Object>, com.hazelcast.core.LifecycleListener, com.hazelcast.core.MembershipListener, com.hazelcast.map.listener.EntryAddedListener<String,Object>, com.hazelcast.map.listener.EntryEvictedListener<String,Object>, com.hazelcast.map.listener.EntryRemovedListener<String,Object>, com.hazelcast.map.listener.EntryUpdatedListener<String,Object>, com.hazelcast.map.listener.MapClearedListener, com.hazelcast.map.listener.MapEvictedListener, com.hazelcast.map.listener.MapListener, EventListener

public class OHazelcastClusterMetadataManager extends Object implements com.hazelcast.core.MembershipListener, com.hazelcast.core.EntryListener<String,Object>, com.hazelcast.core.LifecycleListener
  • Field Details

    • CONFIG_DATABASE_PREFIX

      public static final String CONFIG_DATABASE_PREFIX
      See Also:
    • CONFIG_NODE_PREFIX

      public static final String CONFIG_NODE_PREFIX
      See Also:
    • CONFIG_DBSTATUS_PREFIX

      public static final String CONFIG_DBSTATUS_PREFIX
      See Also:
    • CONFIG_REGISTEREDNODES

      public static final String CONFIG_REGISTEREDNODES
      See Also:
    • hazelcastConfigFile

      protected String hazelcastConfigFile
    • hazelcastConfig

      protected com.hazelcast.config.Config hazelcastConfig
    • membershipListenerRegistration

      protected String membershipListenerRegistration
    • membershipListenerMapRegistration

      protected String membershipListenerMapRegistration
    • hazelcastInstance

      protected volatile com.hazelcast.core.HazelcastInstance hazelcastInstance
    • configurationMap

      protected OHazelcastDistributedMap configurationMap
    • activeNodes

      protected ConcurrentMap<String,com.hazelcast.core.Member> activeNodes
    • activeNodesNamesByUuid

      protected ConcurrentMap<String,String> activeNodesNamesByUuid
    • activeNodesUuidByName

      protected ConcurrentMap<String,String> activeNodesUuidByName
    • registeredNodeById

      protected final List<String> registeredNodeById
    • registeredNodeByName

      protected final ConcurrentMap<String,Integer> registeredNodeByName
    • autoRemovalOfServers

      protected ConcurrentMap<String,Long> autoRemovalOfServers
    • publishLocalNodeConfigurationTask

      protected TimerTask publishLocalNodeConfigurationTask
    • status

      protected volatile NODE_STATUS status
    • lastClusterChangeOn

      protected long lastClusterChangeOn
  • Constructor Details

    • OHazelcastClusterMetadataManager

      public OHazelcastClusterMetadataManager(ODistributedPlugin distributedPlugin)
  • Method Details

    • configHazelcastPlugin

      public void configHazelcastPlugin(OServer server, OServerParameterConfiguration[] params, String nodeName)
    • startupHazelcastPlugin

      public void startupHazelcastPlugin() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • isWriteQuorumPresent

      public boolean isWriteQuorumPresent(String databaseName)
    • getNodeIdByName

      public int getNodeIdByName(String name)
    • getNodeNameById

      public String getNodeNameById(int id)
    • isNodeAvailable

      public boolean isNodeAvailable(String iNodeName)
    • isNodeAvailable

      public boolean isNodeAvailable(String iNodeName, String iDatabaseName)
    • publishLocalNodeConfiguration

      protected void publishLocalNodeConfiguration()
    • getLockManagerRequester

      public ODistributedLockManager getLockManagerRequester()
    • prepareHazelcastPluginShutdown

      public void prepareHazelcastPluginShutdown()
    • hazelcastPluginShutdown

      public void hazelcastPluginShutdown()
    • getClusterMemberByName

      public com.hazelcast.core.Member getClusterMemberByName(String rNodeName)
    • getHazelcastInstance

      public com.hazelcast.core.HazelcastInstance getHazelcastInstance()
    • configureHazelcast

      protected com.hazelcast.core.HazelcastInstance configureHazelcast() throws FileNotFoundException
      Throws:
      FileNotFoundException
    • getPublicAddress

      public String getPublicAddress()
    • getConfigurationMap

      public OHazelcastDistributedMap getConfigurationMap()
    • memberAttributeChanged

      public void memberAttributeChanged(com.hazelcast.core.MemberAttributeEvent memberAttributeEvent)
      Specified by:
      memberAttributeChanged in interface com.hazelcast.core.MembershipListener
    • updateCachedDatabaseConfiguration

      public boolean updateCachedDatabaseConfiguration(String databaseName, OModifiableDistributedConfiguration cfg)
    • publishDistributedConfiguration

      public void publishDistributedConfiguration(String databaseName, ODistributedConfiguration cfg)
    • entryAdded

      public void entryAdded(com.hazelcast.core.EntryEvent<String,Object> iEvent)
      Specified by:
      entryAdded in interface com.hazelcast.map.listener.EntryAddedListener<String,Object>
    • entryUpdated

      public void entryUpdated(com.hazelcast.core.EntryEvent<String,Object> iEvent)
      Specified by:
      entryUpdated in interface com.hazelcast.map.listener.EntryUpdatedListener<String,Object>
    • entryRemoved

      public void entryRemoved(com.hazelcast.core.EntryEvent<String,Object> iEvent)
      Specified by:
      entryRemoved in interface com.hazelcast.map.listener.EntryRemovedListener<String,Object>
    • entryEvicted

      public void entryEvicted(com.hazelcast.core.EntryEvent<String,Object> iEvent)
      Specified by:
      entryEvicted in interface com.hazelcast.map.listener.EntryEvictedListener<String,Object>
    • mapEvicted

      public void mapEvicted(com.hazelcast.core.MapEvent iEvent)
      Specified by:
      mapEvicted in interface com.hazelcast.map.listener.MapEvictedListener
    • mapCleared

      public void mapCleared(com.hazelcast.core.MapEvent event)
      Specified by:
      mapCleared in interface com.hazelcast.map.listener.MapClearedListener
    • memberRemoved

      public void memberRemoved(com.hazelcast.core.MembershipEvent iEvent)
      Removes the node map entry.
      Specified by:
      memberRemoved in interface com.hazelcast.core.MembershipListener
    • memberAdded

      public void memberAdded(com.hazelcast.core.MembershipEvent iEvent)
      Specified by:
      memberAdded in interface com.hazelcast.core.MembershipListener
    • stateChanged

      public void stateChanged(com.hazelcast.core.LifecycleEvent event)
      Specified by:
      stateChanged in interface com.hazelcast.core.LifecycleListener
    • removeDbFromClusterMetadata

      public void removeDbFromClusterMetadata(String dbName)
    • dropDatabaseConfiguration

      public void dropDatabaseConfiguration(String dbName)
    • dropDbFromConfiguration

      public Set<String> dropDbFromConfiguration(String dbName)
    • getNodeConfigurationByUuid

      public ONodeConfig getNodeConfigurationByUuid(String iNodeId, boolean useCache)
    • getNodeConfigurationByName

      public ONodeConfig getNodeConfigurationByName(String nodeName, boolean useCache)
    • getDatabaseStatus

      public ODistributedServerManager.DB_STATUS getDatabaseStatus(String iNode, String iDatabaseName)
    • setDatabaseStatus

      public void setDatabaseStatus(String iNode, String iDatabaseName, ODistributedServerManager.DB_STATUS iStatus)
    • getDatabases

      public Set<String> getDatabases()
    • reloadRegisteredNodes

      public void reloadRegisteredNodes()
    • removeNodeFromConfiguration

      public void removeNodeFromConfiguration(String nodeLeftName, boolean removeOnlyDynamicServers)
    • removeNodeFromConfiguration

      public boolean removeNodeFromConfiguration(String nodeLeftName, String databaseName, boolean removeOnlyDynamicServers, boolean statusOffline)
    • removeFromLocalActiveServerList

      public com.hazelcast.core.Member removeFromLocalActiveServerList(String nodeLeftName)
    • removeServerFromCluster

      public void removeServerFromCluster(com.hazelcast.core.Member member, String nodeLeftName, boolean removeOnlyDynamicServers)
    • getActiveServers

      public Set<String> getActiveServers()
    • registerNode

      protected void registerNode(com.hazelcast.core.Member member, String joinedNodeName)
    • getNodeName

      public String getNodeName(com.hazelcast.core.Member iMember, boolean useCache)
    • getClusterConfiguration

      public OClusterConfiguration getClusterConfiguration()
    • tryGetNodeNameById

      public String tryGetNodeNameById(int id)
    • tryGetNodeIdByName

      public int tryGetNodeIdByName(String name)
    • getNodeUuidByName

      public String getNodeUuidByName(String name)
    • getAvailableNodes

      public int getAvailableNodes(String iDatabaseName)
    • getOnlineNodes

      public List<String> getOnlineNodes(String iDatabaseName)
    • getAvailableNodeNames

      public Set<String> getAvailableNodeNames(String iDatabaseName)
    • executeInDistributedDatabaseLock

      public <T> T executeInDistributedDatabaseLock(String databaseName, long timeoutLocking, OModifiableDistributedConfiguration lastCfg, OCallable<T,OModifiableDistributedConfiguration> iCallback)
      Executes an operation protected by a distributed lock (one per database).
      Type Parameters:
      T - Return type
      Parameters:
      databaseName - Database name
      iCallback - Operation @return The operation's result of type T
    • executeInDistributedDatabaseLock

      public <T> T executeInDistributedDatabaseLock(String databaseName, long timeoutLocking, Callable<T> iCallback)
      Executes an operation protected by a distributed lock (one per database).
      Type Parameters:
      T - Return type
      Parameters:
      databaseName - Database name
      iCallback - Operation @return The operation's result of type T
    • getOnlineDatabaseConfiguration

      public ODocument getOnlineDatabaseConfiguration(String iDatabaseName)
    • getDatabaseConfiguration

      public ODistributedConfiguration getDatabaseConfiguration(String iDatabaseName)
    • getDatabaseConfiguration

      public ODistributedConfiguration getDatabaseConfiguration(String iDatabaseName, boolean createIfNotPresent)
    • setNodeStatus

      public void setNodeStatus(NODE_STATUS iStatus)
    • getNodeStatus

      public NODE_STATUS getNodeStatus()
    • isNodeOnline

      public boolean isNodeOnline(String iNodeName, String iDatabaseName)
    • updateLastClusterChange

      public void updateLastClusterChange()
    • getLastClusterChangeOn

      public long getLastClusterChangeOn()
    • getLocalNodeId

      public int getLocalNodeId()
    • getLocalNodeUuid

      public String getLocalNodeUuid()
    • getLocalNodeName

      public String getLocalNodeName()