public class ODistributedResponseManagerImpl extends Object implements ODistributedResponseManager
TODO: - set flags during collecting of response for fast computation on checking for the status
Modifier and Type | Field and Description |
---|---|
static int |
ADDITIONAL_TIMEOUT_CLUSTER_SHAPE |
Constructor and Description |
---|
ODistributedResponseManagerImpl(ODistributedServerManager iManager,
ODistributedRequest iRequest,
Collection<String> expectedResponses,
Set<String> iNodesConcurInQuorum,
int iTotalExpectedResponses,
int iQuorum,
boolean iWaitForLocalNode,
long iSynchTimeout,
long iTotalTimeout,
boolean iGroupResponsesByResult,
OCallable<Void,ODistributedResponseManager> endCallback) |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
protected boolean |
checkNoWinnerCase(List<ODistributedResponse> bestResponsesGroup) |
boolean |
collectResponse(ODistributedResponse response)
Not synchronized, it's called when a message arrives
|
protected int |
getBestResponsesGroup()
Returns the biggest response group.
|
protected List<ODistributedResponse> |
getConflictResponses()
Returns all the responses in conflict.
|
String |
getDatabaseName() |
Set<String> |
getExpectedNodes() |
protected int |
getExpectedResponses() |
ODistributedResponse |
getFinalResponse() |
ODistributedRequestId |
getMessageId() |
List<String> |
getMissingNodes()
Returns the list of node names that didn't provide a response.
|
int |
getQuorum() |
protected List<ODistributedResponse> |
getReceivedResponses()
Returns the received response objects.
|
protected int |
getReceivedResponsesCount() |
ODistributedRequest |
getRequest() |
List<String> |
getRespondingNodes()
Returns the list of node names that provided a response.
|
long |
getSentOn() |
Set<String> |
getServersWithoutFollowup() |
long |
getSynchTimeout() |
protected long |
getTotalTimeout() |
boolean |
isCanceled() |
boolean |
isFinished() |
protected boolean |
isMinimumQuorumReached(boolean reachedTimeout) |
boolean |
isReceivedCurrentNode() |
boolean |
isWaitForLocalNode() |
protected RuntimeException |
manageConflicts() |
void |
removeServerBecauseUnreachable(String node) |
boolean |
setLocalResult(String localNodeName,
Object localResult) |
void |
timeout() |
protected boolean |
undoRequest() |
boolean |
waitForSynchronousResponses()
Waits until the minimum responses are collected or timeout occurs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGenericFinalResponse
public static final int ADDITIONAL_TIMEOUT_CLUSTER_SHAPE
public ODistributedResponseManagerImpl(ODistributedServerManager iManager, ODistributedRequest iRequest, Collection<String> expectedResponses, Set<String> iNodesConcurInQuorum, int iTotalExpectedResponses, int iQuorum, boolean iWaitForLocalNode, long iSynchTimeout, long iTotalTimeout, boolean iGroupResponsesByResult, OCallable<Void,ODistributedResponseManager> endCallback)
public boolean collectResponse(ODistributedResponse response)
collectResponse
in interface ODistributedResponseManager
response
- Received response to collectpublic ODistributedRequestId getMessageId()
getMessageId
in interface ODistributedResponseManager
public long getSentOn()
getSentOn
in interface ODistributedResponseManager
public boolean setLocalResult(String localNodeName, Object localResult)
setLocalResult
in interface ODistributedResponseManager
localNodeName
- localResult
- public void removeServerBecauseUnreachable(String node)
removeServerBecauseUnreachable
in interface ODistributedResponseManager
public int getQuorum()
getQuorum
in interface ODistributedResponseManager
public boolean waitForSynchronousResponses() throws InterruptedException
waitForSynchronousResponses
in interface ODistributedResponseManager
InterruptedException
public boolean isWaitForLocalNode()
public boolean isReceivedCurrentNode()
public ODistributedResponse getFinalResponse()
getFinalResponse
in interface ODistributedResponseManager
public String getDatabaseName()
getDatabaseName
in interface ODistributedResponseManager
public long getSynchTimeout()
getSynchTimeout
in interface ODistributedResponseManager
public void timeout()
timeout
in interface ODistributedResponseManager
public boolean isCanceled()
public void cancel()
cancel
in interface ODistributedResponseManager
public List<String> getMissingNodes()
getMissingNodes
in interface ODistributedResponseManager
public Set<String> getExpectedNodes()
getExpectedNodes
in interface ODistributedResponseManager
public Set<String> getServersWithoutFollowup()
getServersWithoutFollowup
in interface ODistributedResponseManager
public List<String> getRespondingNodes()
getRespondingNodes
in interface ODistributedResponseManager
public ODistributedRequest getRequest()
getRequest
in interface ODistributedResponseManager
protected List<ODistributedResponse> getConflictResponses()
protected int getExpectedResponses()
public boolean isFinished()
isFinished
in interface ODistributedResponseManager
protected int getReceivedResponsesCount()
protected long getTotalTimeout()
protected int getBestResponsesGroup()
protected boolean isMinimumQuorumReached(boolean reachedTimeout)
protected List<ODistributedResponse> getReceivedResponses()
protected RuntimeException manageConflicts()
protected boolean undoRequest()
protected boolean checkNoWinnerCase(List<ODistributedResponse> bestResponsesGroup)
Copyright © 2009–2020 OrientDB. All rights reserved.