ReplicaSnapshot snapshot() { ReplicaSnapshot s = new ReplicaSnapshot(this); s.accepted = txnAccepted; s.committed = txnCommitted; s.state = state; s.error = error; s.retryAtMillis = waitingForRetry() ? retryAtMillis : 0; return s; }
private boolean defer(ReplicaPushRequest req) { if (waitingForRetry()) { // Prior communication failure; everything is deferred. return true; } for (ReceiveCommand nextCmd : req.getCommands()) { ReceiveCommand priorCmd = waiting.get(nextCmd.getRefName()); if (priorCmd == null) { priorCmd = running.get(nextCmd.getRefName()); } if (priorCmd != null) { // Another request pending on same ref; that must go first. // Verify priorCmd.newId == nextCmd.oldId? return true; } } return false; }
private void retryLater(ReplicaPushRequest req) { Collection<ReceiveCommand> cmds = req.getCommands(); for (ReceiveCommand cmd : cmds) { cmd.setResult(NOT_ATTEMPTED, null); if (!waiting.containsKey(cmd.getRefName())) { waiting.put(cmd.getRefName(), cmd); } } queued.add(0, new ReplicaPushRequest(this, cmds)); if (!waitingForRetry()) { long delay = KetchSystem.delay( lastRetryMillis, minRetryMillis, maxRetryMillis); if (log.isDebugEnabled()) { log.debug("Retrying {} after {} ms", //$NON-NLS-1$ describeForLog(), Long.valueOf(delay)); } lastRetryMillis = delay; retryAtMillis = SystemReader.getInstance().getCurrentTime() + delay; retryFuture = getSystem().getExecutor() .schedule(new WeakRetryPush(this), delay, MILLISECONDS); } }
if (queued.isEmpty() || !running.isEmpty() || waitingForRetry()) { return;
ReplicaSnapshot snapshot() { ReplicaSnapshot s = new ReplicaSnapshot(this); s.accepted = txnAccepted; s.committed = txnCommitted; s.state = state; s.error = error; s.retryAtMillis = waitingForRetry() ? retryAtMillis : 0; return s; }
ReplicaSnapshot snapshot() { ReplicaSnapshot s = new ReplicaSnapshot(this); s.accepted = txnAccepted; s.committed = txnCommitted; s.state = state; s.error = error; s.retryAtMillis = waitingForRetry() ? retryAtMillis : 0; return s; }
private boolean defer(ReplicaPushRequest req) { if (waitingForRetry()) { // Prior communication failure; everything is deferred. return true; } for (ReceiveCommand nextCmd : req.getCommands()) { ReceiveCommand priorCmd = waiting.get(nextCmd.getRefName()); if (priorCmd == null) { priorCmd = running.get(nextCmd.getRefName()); } if (priorCmd != null) { // Another request pending on same ref; that must go first. // Verify priorCmd.newId == nextCmd.oldId? return true; } } return false; }
private boolean defer(ReplicaPushRequest req) { if (waitingForRetry()) { // Prior communication failure; everything is deferred. return true; } for (ReceiveCommand nextCmd : req.getCommands()) { ReceiveCommand priorCmd = waiting.get(nextCmd.getRefName()); if (priorCmd == null) { priorCmd = running.get(nextCmd.getRefName()); } if (priorCmd != null) { // Another request pending on same ref; that must go first. // Verify priorCmd.newId == nextCmd.oldId? return true; } } return false; }
private void retryLater(ReplicaPushRequest req) { Collection<ReceiveCommand> cmds = req.getCommands(); for (ReceiveCommand cmd : cmds) { cmd.setResult(NOT_ATTEMPTED, null); if (!waiting.containsKey(cmd.getRefName())) { waiting.put(cmd.getRefName(), cmd); } } queued.add(0, new ReplicaPushRequest(this, cmds)); if (!waitingForRetry()) { long delay = KetchSystem.delay( lastRetryMillis, minRetryMillis, maxRetryMillis); if (log.isDebugEnabled()) { log.debug("Retrying {} after {} ms", //$NON-NLS-1$ describeForLog(), Long.valueOf(delay)); } lastRetryMillis = delay; retryAtMillis = SystemReader.getInstance().getCurrentTime() + delay; retryFuture = getSystem().getExecutor() .schedule(new WeakRetryPush(this), delay, MILLISECONDS); } }
private void retryLater(ReplicaPushRequest req) { Collection<ReceiveCommand> cmds = req.getCommands(); for (ReceiveCommand cmd : cmds) { cmd.setResult(NOT_ATTEMPTED, null); if (!waiting.containsKey(cmd.getRefName())) { waiting.put(cmd.getRefName(), cmd); } } queued.add(0, new ReplicaPushRequest(this, cmds)); if (!waitingForRetry()) { long delay = KetchSystem.delay( lastRetryMillis, minRetryMillis, maxRetryMillis); if (log.isDebugEnabled()) { log.debug("Retrying {} after {} ms", //$NON-NLS-1$ describeForLog(), Long.valueOf(delay)); } lastRetryMillis = delay; retryAtMillis = SystemReader.getInstance().getCurrentTime() + delay; retryFuture = getSystem().getExecutor() .schedule(new WeakRetryPush(this), delay, MILLISECONDS); } }
if (queued.isEmpty() || !running.isEmpty() || waitingForRetry()) { return;
if (queued.isEmpty() || !running.isEmpty() || waitingForRetry()) { return;