
public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract implements ODistributedServerManager, ODatabaseLifecycleListener, OCommandOutputListener
ODistributedServerManager.DB_STATUS, ODistributedServerManager.NODE_STATUSODatabaseLifecycleListener.PRIORITYFILE_DISTRIBUTED_DB_CONFIG| Constructor and Description |
|---|
ODistributedAbstractPlugin() |
getContent, onAfterClientRequest, onBeforeClientRequest, onClientConnection, onClientDisconnection, onClientErrorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitconvertException, getConfigurationMap, getDatabaseStatus, getLock, getNodeConfigurationByUuid, setDatabaseStatus, updateCachedDatabaseConfigurationonCreatepublic 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 boolean enabled
protected String nodeName
protected int nodeId
protected File defaultDatabaseConfigFile
protected ConcurrentHashMap<String,ODistributedStorage> storages
protected volatile ODistributedServerManager.NODE_STATUS status
protected long lastClusterChangeOn
protected List<ODistributedLifecycleListener> listeners
protected final ConcurrentMap<String,ORemoteServerController> remoteServers
protected TimerTask publishLocalNodeConfigurationTask
protected AtomicLong localMessageIdCounter
protected OClusterOwnershipAssignmentStrategy clusterAssignmentStrategy
protected static final int DEPLOY_DB_MAX_RETRIES
protected ODistributedMessageServiceImpl messageService
protected Date startedOn
protected ORemoteTaskFactory taskFactory
protected String nodeUuid
protected abstract ODistributedConfiguration getLastDatabaseConfiguration(String databaseName)
public void waitUntilNodeOnline()
throws InterruptedException
waitUntilNodeOnline in interface ODistributedServerManagerInterruptedExceptionpublic void waitUntilNodeOnline(String nodeName, String databaseName) throws InterruptedException
waitUntilNodeOnline in interface ODistributedServerManagerInterruptedExceptionpublic ODatabaseLifecycleListener.PRIORITY getPriority()
getPriority in interface ODatabaseLifecycleListenerpublic void config(OServer oServer, OServerParameterConfiguration[] iParams)
OServerPluginconfig in interface OServerPluginconfig in class OServerPluginAbstractpublic void setDefaultDatabaseConfigFile(String iFile)
public void startup()
startup in interface OServicestartup in class OServerPluginAbstractpublic ODistributedAbstractPlugin registerLifecycleListener(ODistributedLifecycleListener iListener)
registerLifecycleListener in interface ODistributedServerManagerpublic ODistributedAbstractPlugin unregisterLifecycleListener(ODistributedLifecycleListener iListener)
unregisterLifecycleListener in interface ODistributedServerManagerpublic void shutdown()
shutdown in interface OServiceshutdown in class OServerPluginAbstractpublic void onOpen(ODatabaseInternal iDatabase)
onOpen in interface ODatabaseLifecycleListenerpublic void onClose(ODatabaseInternal iDatabase)
onClose in interface ODatabaseLifecycleListenerpublic void onDrop(ODatabaseInternal iDatabase)
onDrop in interface ODatabaseLifecycleListenerpublic void onDropClass(ODatabaseInternal iDatabase, OClass iClass)
onDropClass in interface ODatabaseLifecycleListenerpublic void sendShutdown()
sendShutdown in interface OServerPluginsendShutdown in class OServerPluginAbstractpublic String getNodeName(com.hazelcast.core.Member iMember)
public boolean updateCachedDatabaseConfiguration(String iDatabaseName, ODocument cfg, boolean iSaveToDisk)
public ODistributedConfiguration getDatabaseConfiguration(String iDatabaseName)
getDatabaseConfiguration in interface ODistributedServerManagerpublic OServer getServerInstance()
getServerInstance in interface ODistributedServerManagerprotected ODocument loadDatabaseConfiguration(String iDatabaseName, File file, boolean writeCfgToDisk)
public ODocument getClusterConfiguration()
getClusterConfiguration in interface ODistributedServerManagerpublic ODocument getLocalNodeConfiguration()
getLocalNodeConfiguration in interface ODistributedServerManagerpublic boolean isEnabled()
isEnabled in interface ODistributedServerManagerpublic ODistributedServerManager.NODE_STATUS getNodeStatus()
getNodeStatus in interface ODistributedServerManagerpublic void setNodeStatus(ODistributedServerManager.NODE_STATUS iStatus)
setNodeStatus in interface ODistributedServerManagerpublic boolean checkNodeStatus(ODistributedServerManager.NODE_STATUS iStatus2Check)
checkNodeStatus in interface ODistributedServerManagerpublic ODistributedResponse sendRequest(String iDatabaseName, Collection<String> iClusterNames, Collection<String> iTargetNodes, ORemoteTask iTask, long reqId, ODistributedRequest.EXECUTION_MODE iExecutionMode, Object localResult, OCallable<Void,ODistributedRequestId> iAfterSentCallback)
ODistributedServerManagersendRequest in interface ODistributedServerManagerreqId - Message Id as longlocalResult - It's the result of the request executed locallypublic Serializable executeOnLocalNode(ODistributedRequestId reqId, ORemoteTask task, ODatabaseDocumentTx database)
executeOnLocalNode in interface ODistributedServerManagerpublic ORemoteServerController getRemoteServer(String rNodeName) throws IOException
getRemoteServer in interface ODistributedServerManagerIOExceptionpublic String getLocalNodeName()
getLocalNodeName in interface ODistributedServerManagerpublic int getLocalNodeId()
getLocalNodeId in interface ODistributedServerManagerpublic void onLocalNodeConfigurationRequest(ODocument iConfiguration)
ODatabaseLifecycleListeneronLocalNodeConfigurationRequest in interface ODatabaseLifecycleListenerpublic void onCreateClass(ODatabaseInternal iDatabase, OClass iClass)
onCreateClass in interface ODatabaseLifecycleListenerpublic ODocument getStats()
getStats in interface ODistributedServerManagerpublic String getNodeNameById(int id)
getNodeNameById in interface ODistributedServerManagerpublic int getNodeIdByName(String name)
getNodeIdByName in interface ODistributedServerManagerpublic void updateLastClusterChange()
updateLastClusterChange in interface ODistributedServerManagerprotected boolean electCurrentNodeAsNewCoordinator(ODistributedConfiguration cfg, String nodeLeftName, String databaseName)
cfg - nodeLeftName - protected boolean electCurrentNodeAsNewCoordinator(String nodeLeftName, String nodeToElect, String databaseName, ODistributedConfiguration cfg)
protected boolean reassignClustersOwnership(String iNode, ODistributedConfiguration cfg, String databaseName, Set<String> clustersWithNotAvailableOwner, boolean rebalance)
protected String getCoordinatorServer(ODistributedConfiguration cfg)
public boolean isNodeAvailable(String iNodeName, String iDatabaseName)
ODistributedServerManagerisNodeAvailable in interface ODistributedServerManagerpublic boolean isNodeAvailable(String iNodeName)
isNodeAvailable in interface ODistributedServerManagerpublic boolean isNodeOnline(String iNodeName, String iDatabaseName)
ODistributedServerManagerisNodeOnline in interface ODistributedServerManagerpublic boolean isOffline()
isOffline in interface ODistributedServerManagerpublic int getAvailableNodes(Collection<String> iNodes, String databaseName)
getAvailableNodes in interface ODistributedServerManagerpublic ODistributedMessageServiceImpl getMessageService()
getMessageService in interface ODistributedServerManagerpublic long getLastClusterChangeOn()
getLastClusterChangeOn in interface ODistributedServerManagerpublic int getAvailableNodes(String iDatabaseName)
getAvailableNodes in interface ODistributedServerManagerpublic boolean installDatabase(boolean iStartup,
String databaseName,
ODocument config)
protected boolean requestFullDatabase(ODistributedDatabaseImpl distrDatabase, String databaseName, boolean backupDatabase)
public boolean requestDatabaseDelta(ODistributedDatabaseImpl distrDatabase, String databaseName)
protected boolean requestDatabaseFullSync(ODistributedDatabaseImpl distrDatabase, boolean backupDatabase, String databaseName, boolean iAskToAllNodes)
protected void backupCurrentDatabase(String iDatabaseName)
protected Set<String> installDatabaseFromNetwork(String dbPath, String databaseName, ODistributedDatabaseImpl distrDatabase, String iNode, ODistributedDatabaseChunk firstChunk, boolean delta)
public ORemoteTaskFactory getTaskFactory()
getTaskFactory in interface ODistributedServerManagerpublic void propagateSchemaChanges(ODatabaseInternal iDatabase)
propagateSchemaChanges in interface ODistributedServerManagerpublic boolean installClustersOfClass(ODatabaseInternal iDatabase, OClass iClass)
public <T> T executeInDistributedDatabaseLock(String databaseName, OCallable<T,ODistributedConfiguration> iCallback)
T - Return typedatabaseName - Database nameiCallback - Operationprotected void onDatabaseEvent(String nodeName, String databaseName, ODistributedServerManager.DB_STATUS status)
protected boolean rebalanceClusterOwnership(String iNode, ODatabaseInternal iDatabase, ODistributedConfiguration cfg, Set<String> clustersWithNotAvailableOwner, boolean rebalance)
protected void installDbClustersLocalStrategy(ODatabaseInternal iDatabase)
protected void assignNodeName()
protected long writeDatabaseChunk(int iChunkId,
ODistributedDatabaseChunk chunk,
OutputStream out)
throws IOException
IOExceptionprotected ODatabaseDocumentTx installDatabaseOnLocalNode(String databaseName, String dbPath, String iNode, String iDatabaseCompressedFile, boolean delta)
public void onMessage(String iText)
onMessage in interface OCommandOutputListenerpublic void stopNode(String iNode) throws IOException
IOExceptionpublic void restartNode(String iNode) throws IOException
IOExceptionpublic Set<String> getAvailableNodeNames(String iDatabaseName)
getAvailableNodeNames in interface ODistributedServerManagerpublic long getNextMessageIdCounter()
getNextMessageIdCounter in interface ODistributedServerManagerprotected void closeRemoteServer(String node)
protected boolean isRelatedToLocalServer(ODatabaseInternal iDatabase)
protected void dumpServersStatus()
protected ODistributedStorage getStorage(String dbName)
Copyright © 2009–2016 Orient Technologies. All rights reserved.