Class ODistributedResponseManagerImpl
java.lang.Object
com.orientechnologies.orient.server.distributed.ODistributedResponseManagerImpl
- All Implemented Interfaces:
ODistributedResponseManager
Asynchronous response manager. All the public methods have to pay attention on synchronizing
access by using synchronousResponsesLock lock.
TODO: - set flags during collecting of response for fast computation on checking for the status
- Author:
- Luca Garulli (l.garulli--at--orientdb.com)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionODistributedResponseManagerImpl(ODistributedServerManager iManager, ODistributedRequest iRequest, Collection<String> expectedResponses, Set<String> iNodesConcurInQuorum, int iQuorum, boolean iWaitForLocalNode, long iSynchTimeout, boolean iGroupResponsesByResult) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()protected booleancheckNoWinnerCase(List<ODistributedResponse> bestResponsesGroup) booleancollectResponse(ODistributedResponse response) Not synchronized, it's called when a message arrivesprotected intReturns the biggest response group.protected List<ODistributedResponse>Returns all the responses in conflict.protected intReturns the list of node names that didn't provide a response.intprotected List<ODistributedResponse>Returns the received response objects.Returns the list of node names that provided a response.longlongbooleanprotected booleanisMinimumQuorumReached(boolean reachedTimeout) booleanbooleanprotected RuntimeExceptionvoidbooleansetLocalResult(String localNodeName, Object localResult) voidtimeout()booleanWaits until the minimum responses are collected or timeout occurs.
-
Field Details
-
ADDITIONAL_TIMEOUT_CLUSTER_SHAPE
public static final int ADDITIONAL_TIMEOUT_CLUSTER_SHAPE- See Also:
-
-
Constructor Details
-
ODistributedResponseManagerImpl
public ODistributedResponseManagerImpl(ODistributedServerManager iManager, ODistributedRequest iRequest, Collection<String> expectedResponses, Set<String> iNodesConcurInQuorum, int iQuorum, boolean iWaitForLocalNode, long iSynchTimeout, boolean iGroupResponsesByResult)
-
-
Method Details
-
collectResponse
Not synchronized, it's called when a message arrives- Specified by:
collectResponsein interfaceODistributedResponseManager- Parameters:
response- Received response to collect- Returns:
- True if all the nodes responded, otherwise false
-
getMessageId
- Specified by:
getMessageIdin interfaceODistributedResponseManager
-
getSentOn
public long getSentOn()- Specified by:
getSentOnin interfaceODistributedResponseManager
-
setLocalResult
- Specified by:
setLocalResultin interfaceODistributedResponseManager- Parameters:
localNodeName-localResult-- Returns:
-
removeServerBecauseUnreachable
- Specified by:
removeServerBecauseUnreachablein interfaceODistributedResponseManager
-
getQuorum
public int getQuorum()- Specified by:
getQuorumin interfaceODistributedResponseManager
-
waitForSynchronousResponses
Waits until the minimum responses are collected or timeout occurs. If "waitForLocalNode" wait also for local node.- Specified by:
waitForSynchronousResponsesin interfaceODistributedResponseManager- Returns:
- True if the received responses are major or equals then the expected synchronous responses, otherwise false
- Throws:
InterruptedException
-
isWaitForLocalNode
public boolean isWaitForLocalNode() -
isReceivedCurrentNode
public boolean isReceivedCurrentNode() -
getFinalResponse
- Specified by:
getFinalResponsein interfaceODistributedResponseManager
-
getDatabaseName
- Specified by:
getDatabaseNamein interfaceODistributedResponseManager
-
getSynchTimeout
public long getSynchTimeout()- Specified by:
getSynchTimeoutin interfaceODistributedResponseManager
-
timeout
public void timeout()- Specified by:
timeoutin interfaceODistributedResponseManager
-
cancel
public void cancel()- Specified by:
cancelin interfaceODistributedResponseManager
-
getMissingNodes
Returns the list of node names that didn't provide a response.- Specified by:
getMissingNodesin interfaceODistributedResponseManager
-
getExpectedNodes
- Specified by:
getExpectedNodesin interfaceODistributedResponseManager
-
getRespondingNodes
Returns the list of node names that provided a response.- Specified by:
getRespondingNodesin interfaceODistributedResponseManager
-
getConflictResponses
Returns all the responses in conflict. -
getExpectedResponses
protected int getExpectedResponses() -
isFinished
public boolean isFinished()- Specified by:
isFinishedin interfaceODistributedResponseManager
-
getBestResponsesGroup
protected int getBestResponsesGroup()Returns the biggest response group.- Returns:
-
isMinimumQuorumReached
protected boolean isMinimumQuorumReached(boolean reachedTimeout) -
getReceivedResponses
Returns the received response objects. -
manageConflicts
-
checkNoWinnerCase
-