public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract implements ODistributedServerManager, ODatabaseLifecycleListener, OCommandOutputListener
ODistributedServerManager.DB_STATUS, ODistributedServerManager.NODE_STATUS
ODatabaseLifecycleListener.PRIORITY
enabled
FILE_DISTRIBUTED_DB_CONFIG
Modifier | Constructor and Description |
---|---|
protected |
ODistributedAbstractPlugin() |
getContent, onAfterClientRequest, onBeforeClientRequest, onClientConnection, onClientDisconnection, onClientError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
convertException, getActiveServers, getClusterTime, getConfigurationMap, getDatabaseStatus, getLockManagerExecutor, getLockManagerRequester, getLockManagerServer, getNodeConfigurationByUuid, getRemoteServer, isWriteQuorumPresent, messageAfterOp, messageBeforeOp, messageCurrentPayload, messagePartitionCalculate, messageProcessEnd, messageProcessStart, messageReceived, removeServer, setDatabaseStatus, updateCachedDatabaseConfiguration
onCreate, onDropView
onSocketAccepted, onSocketDestroyed
public static final String REPLICATOR_USER
protected static final String PAR_DEF_DISTRIB_DB_CONFIG
protected static final String NODE_NAME_ENV
protected OServer serverInstance
protected String nodeUuid
protected String nodeName
protected int nodeId
protected File defaultDatabaseConfigFile
protected final ConcurrentMap<String,ODistributedStorage> storages
protected volatile ODistributedServerManager.NODE_STATUS status
protected long lastClusterChangeOn
protected List<ODistributedLifecycleListener> listeners
protected ORemoteServerManager remoteServerManager
protected TimerTask publishLocalNodeConfigurationTask
protected TimerTask haStatsTask
protected TimerTask healthCheckerTask
protected AtomicLong localMessageIdCounter
protected OClusterOwnershipAssignmentStrategy clusterAssignmentStrategy
protected static final int DEPLOY_DB_MAX_RETRIES
protected ConcurrentMap<String,com.hazelcast.core.Member> activeNodes
protected ConcurrentMap<String,String> activeNodesNamesByUuid
protected ConcurrentMap<String,String> activeNodesUuidByName
protected final ConcurrentMap<String,Integer> registeredNodeByName
protected ConcurrentMap<String,Long> autoRemovalOfServers
protected volatile ODistributedMessageServiceImpl messageService
protected Date startedOn
protected ODistributedStrategy responseManagerFactory
protected ORemoteTaskFactoryManager taskFactoryManager
protected CountDownLatch serverStarted
public void waitUntilNodeOnline() throws InterruptedException
waitUntilNodeOnline
in interface ODistributedServerManager
InterruptedException
public void waitUntilNodeOnline(String nodeName, String databaseName) throws InterruptedException
waitUntilNodeOnline
in interface ODistributedServerManager
InterruptedException
public ODatabaseLifecycleListener.PRIORITY getPriority()
getPriority
in interface ODatabaseLifecycleListener
public void config(OServer oServer, OServerParameterConfiguration[] iParams)
OServerPlugin
config
in interface OServerPlugin
config
in class OServerPluginAbstract
@Deprecated public String getCoordinatorServer()
getCoordinatorServer
in interface ODistributedServerManager
public File getDefaultDatabaseConfigFile()
getDefaultDatabaseConfigFile
in interface ODistributedServerManager
public void setDefaultDatabaseConfigFile(String iFile)
public void startup()
startup
in interface OService
startup
in class OServerPluginAbstract
public ODistributedAbstractPlugin registerLifecycleListener(ODistributedLifecycleListener iListener)
registerLifecycleListener
in interface ODistributedServerManager
public ODistributedAbstractPlugin unregisterLifecycleListener(ODistributedLifecycleListener iListener)
unregisterLifecycleListener
in interface ODistributedServerManager
public void shutdown()
shutdown
in interface OService
shutdown
in class OServerPluginAbstract
public void onOpen(ODatabaseInternal iDatabase)
onOpen
in interface ODatabaseLifecycleListener
public void registerNewDatabaseIfNeeded(String dbName, ODistributedConfiguration cfg)
public void onClose(ODatabaseInternal iDatabase)
onClose
in interface ODatabaseLifecycleListener
public void onDrop(ODatabaseInternal iDatabase)
onDrop
in interface ODatabaseLifecycleListener
public void removeStorage(String name)
public void onDropClass(ODatabaseInternal iDatabase, OClass iClass)
onDropClass
in interface ODatabaseLifecycleListener
public void sendShutdown()
sendShutdown
in interface OServerPlugin
sendShutdown
in class OServerPluginAbstract
public String getNodeName(com.hazelcast.core.Member iMember)
public String getNodeName(com.hazelcast.core.Member iMember, boolean useCache)
public boolean updateCachedDatabaseConfiguration(String iDatabaseName, OModifiableDistributedConfiguration cfg)
public ODistributedConfiguration getDatabaseConfiguration(String iDatabaseName)
getDatabaseConfiguration
in interface ODistributedServerManager
public ODistributedConfiguration getDatabaseConfiguration(String iDatabaseName, boolean createIfNotPresent)
getDatabaseConfiguration
in interface ODistributedServerManager
public OServer getServerInstance()
getServerInstance
in interface ODistributedServerManager
public ODocument getClusterConfiguration()
getClusterConfiguration
in interface ODistributedServerManager
public abstract String getPublicAddress()
public ODocument getLocalNodeConfiguration()
getLocalNodeConfiguration
in interface ODistributedServerManager
public boolean isEnabled()
isEnabled
in interface ODistributedServerManager
public ODistributedServerManager.NODE_STATUS getNodeStatus()
getNodeStatus
in interface ODistributedServerManager
public void setNodeStatus(ODistributedServerManager.NODE_STATUS iStatus)
setNodeStatus
in interface ODistributedServerManager
public boolean checkNodeStatus(ODistributedServerManager.NODE_STATUS iStatus2Check)
checkNodeStatus
in interface ODistributedServerManager
public ODistributedResponse sendRequest(String iDatabaseName, Collection<String> iClusterNames, Collection<String> iTargetNodes, ORemoteTask iTask, long reqId, ODistributedRequest.EXECUTION_MODE iExecutionMode, Object localResult, OCallable<Void,ODistributedRequestId> iAfterSentCallback, OCallable<Void,ODistributedResponseManager> endCallback)
ODistributedServerManager
sendRequest
in interface ODistributedServerManager
reqId
- Message Id as longlocalResult
- It's the result of the request executed locallypublic ODistributedResponse sendRequest(String iDatabaseName, Collection<String> iClusterNames, Collection<String> iTargetNodes, ORemoteTask iTask, long reqId, ODistributedRequest.EXECUTION_MODE iExecutionMode, Object localResult, OCallable<Void,ODistributedRequestId> iAfterSentCallback, OCallable<Void,ODistributedResponseManager> endCallback, ODistributedResponseManagerFactory responseManagerFactory)
public void executeOnLocalNodeFromRemote(ODistributedRequest request)
executeOnLocalNodeFromRemote
in interface ODistributedServerManager
public Object executeOnLocalNode(ODistributedRequestId reqId, ORemoteTask task, ODatabaseDocumentInternal database)
executeOnLocalNode
in interface ODistributedServerManager
public String getLocalNodeName()
getLocalNodeName
in interface ODistributedServerManager
public int getLocalNodeId()
getLocalNodeId
in interface ODistributedServerManager
public void onLocalNodeConfigurationRequest(ODocument iConfiguration)
ODatabaseLifecycleListener
onLocalNodeConfigurationRequest
in interface ODatabaseLifecycleListener
public void onCreateClass(ODatabaseInternal iDatabase, OClass iClass)
onCreateClass
in interface ODatabaseLifecycleListener
public void onCreateView(ODatabaseInternal iDatabase, OView view)
onCreateView
in interface ODatabaseLifecycleListener
public ODocument getStats()
getStats
in interface ODistributedServerManager
public String getNodeNameById(int id)
getNodeNameById
in interface ODistributedServerManager
public int getNodeIdByName(String name)
getNodeIdByName
in interface ODistributedServerManager
public String getNodeUuidByName(String name)
getNodeUuidByName
in interface ODistributedServerManager
public void updateLastClusterChange()
updateLastClusterChange
in interface ODistributedServerManager
public void reassignClustersOwnership(String iNode, String databaseName, OModifiableDistributedConfiguration cfg, boolean canCreateNewClusters)
reassignClustersOwnership
in interface ODistributedServerManager
public boolean isNodeAvailable(String iNodeName, String iDatabaseName)
ODistributedServerManager
isNodeAvailable
in interface ODistributedServerManager
public boolean isNodeStatusEqualsTo(String iNodeName, String iDatabaseName, ODistributedServerManager.DB_STATUS... statuses)
ODistributedServerManager
isNodeStatusEqualsTo
in interface ODistributedServerManager
iNodeName
- Node nameiDatabaseName
- Database namestatuses
- vararg of statusespublic boolean isNodeAvailable(String iNodeName)
isNodeAvailable
in interface ODistributedServerManager
public boolean isNodeOnline(String iNodeName, String iDatabaseName)
ODistributedServerManager
isNodeOnline
in interface ODistributedServerManager
public boolean isOffline()
isOffline
in interface ODistributedServerManager
public int getAvailableNodes(Collection<String> iNodes, String databaseName)
getAvailableNodes
in interface ODistributedServerManager
public int getNodesWithStatus(Collection<String> iNodes, String databaseName, ODistributedServerManager.DB_STATUS... statuses)
getNodesWithStatus
in interface ODistributedServerManager
public ODistributedMessageServiceImpl getMessageService()
getMessageService
in interface ODistributedServerManager
public long getLastClusterChangeOn()
getLastClusterChangeOn
in interface ODistributedServerManager
public int getTotalNodes(String iDatabaseName)
getTotalNodes
in interface ODistributedServerManager
public int getAvailableNodes(String iDatabaseName)
getAvailableNodes
in interface ODistributedServerManager
public List<String> getOnlineNodes(String iDatabaseName)
getOnlineNodes
in interface ODistributedServerManager
public boolean installDatabase(boolean iStartup, String databaseName, boolean forceDeployment, boolean tryWithDeltaFirst)
installDatabase
in interface ODistributedServerManager
protected boolean requestFullDatabase(ODistributedDatabaseImpl distrDatabase, String databaseName, boolean backupDatabase, OModifiableDistributedConfiguration cfg)
protected boolean requestDatabaseFullSync(ODistributedDatabaseImpl distrDatabase, boolean backupDatabase, String databaseName, boolean iAskToAllNodes, OModifiableDistributedConfiguration cfg)
protected File getClusterOwnedExclusivelyByCurrentNode(String dbPath, String iDatabaseName)
protected void backupCurrentDatabase(String iDatabaseName)
protected void installDatabaseFromNetwork(String dbPath, String databaseName, ODistributedDatabaseImpl distrDatabase, String iNode, ODistributedDatabaseChunk firstChunk, boolean delta, File uniqueClustersBackupDirectory, OModifiableDistributedConfiguration cfg)
public ORemoteTaskFactoryManager getTaskFactoryManager()
ODistributedServerManager
getTaskFactoryManager
in interface ODistributedServerManager
public boolean installClustersOfClass(ODatabaseInternal iDatabase, OClass iClass, OModifiableDistributedConfiguration cfg)
public ODistributedStrategy getDistributedStrategy()
getDistributedStrategy
in interface ODistributedServerManager
public void setDistributedStrategy(ODistributedStrategy streatgy)
setDistributedStrategy
in interface ODistributedServerManager
public <T> T executeInDistributedDatabaseLock(String databaseName, long timeoutLocking, OModifiableDistributedConfiguration lastCfg, OCallable<T,OModifiableDistributedConfiguration> iCallback)
executeInDistributedDatabaseLock
in interface ODistributedServerManager
T
- Return typedatabaseName
- Database nameiCallback
- Operation @return The operation's result of type Tpublic abstract void notifyClients(String databaseName)
notifyClients
in interface ODistributedServerManager
protected void onDatabaseEvent(String nodeName, String databaseName, ODistributedServerManager.DB_STATUS status)
protected void rebalanceClusterOwnership(String iNode, String databaseName, OModifiableDistributedConfiguration cfg, boolean canCreateNewClusters)
protected void assignNodeName()
protected void installDatabaseOnLocalNode(String databaseName, String dbPath, String iNode, boolean delta, File uniqueClustersBackupDirectory, OModifiableDistributedConfiguration cfg, boolean incremental, OSyncReceiver receiver)
public void onMessage(String iText)
onMessage
in interface OCommandOutputListener
public void stopNode(String iNode) throws IOException
IOException
public void restartNode(String iNode) throws IOException
IOException
public Set<String> getAvailableNodeNames(String iDatabaseName)
getAvailableNodeNames
in interface ODistributedServerManager
public long getNextMessageIdCounter()
getNextMessageIdCounter
in interface ODistributedServerManager
public void closeRemoteServer(String node)
protected boolean isRelatedToLocalServer(ODatabaseInternal iDatabase)
protected void dumpServersStatus()
public ODistributedStorage getStorageIfExists(String dbName)
public ODistributedStorage getStorage(String dbName)
getStorage
in interface ODistributedServerManager
public ODistributedStorage getStorage(String dbName, OAbstractPaginatedStorage wrapped)
public ODistributedConflictResolverFactory getConflictResolverFactory()
getConflictResolverFactory
in interface ODistributedServerManager
Copyright © 2009–2020 OrientDB. All rights reserved.