Deadline deadline = timeout.$times(3).fromNow();
LOG.debug("{}: Issuing gracefulStop to shard {}", persistenceId(), info.getShardId()); FiniteDuration duration = info.getDatastoreContext().getShardRaftConfig().getElectionTimeOutInterval().$times(2); stopFutures.add(Patterns.gracefulStop(info.getActor(), duration, Shutdown.INSTANCE));
public void shutdown() { FiniteDuration duration = datastoreContext.getShardRaftConfig().getElectionTimeOutInterval().$times(3); try { Await.ready(Patterns.gracefulStop(shardManager, duration, Shutdown.INSTANCE), duration); } catch(Exception e) { LOG.warn("ShardManager for {} data store did not shutdown gracefully", getDataStoreName(), e); } }
changeServersVotingStatus, shardActorRef.path()); Timeout timeout = new Timeout(datastoreContext.getShardLeaderElectionTimeout().duration().$times(2)); Future<Object> futureObj = ask(shardActorRef, changeServersVotingStatus, timeout);
private void findLocalShard(final String shardName, final ActorRef sender, final Consumer<LocalShardFound> onLocalShardFound) { Timeout findLocalTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext(). getShardInitializationTimeout().duration().$times(2));
private void findPrimary(final String shardName, final FindPrimaryResponseHandler handler) { Timeout findPrimaryTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext(). getShardInitializationTimeout().duration().$times(2)); Future<Object> futureObj = ask(getSelf(), new FindPrimary(shardName, true), findPrimaryTimeout); futureObj.onComplete(new OnComplete<Object>() { @Override public void onComplete(Throwable failure, Object response) { if (failure != null) { handler.onFailure(failure); } else { if(response instanceof RemotePrimaryShardFound) { handler.onRemotePrimaryShardFound((RemotePrimaryShardFound) response); } else if(response instanceof LocalPrimaryShardFound) { handler.onLocalPrimaryFound((LocalPrimaryShardFound) response); } else { handler.onUnknownResponse(response); } } } }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client)); }
Cancellable newTimer(Object message) { return newTimer(raftContext.getConfigParams().getElectionTimeOutInterval().$times(2), message); }
@Override public FiniteDuration getElectionTimeOutInterval() { if(electionTimeOutInterval == null) { electionTimeOutInterval = getHeartBeatInterval().$times(electionTimeoutFactor); } return electionTimeOutInterval; }
private void setCachedProperties() { txRateLimiter = new TransactionRateLimiter(this); operationDuration = Duration.create(datastoreContext.getOperationTimeoutInMillis(), TimeUnit.MILLISECONDS); operationTimeout = new Timeout(operationDuration); transactionCommitOperationTimeout = new Timeout(Duration.create( datastoreContext.getShardTransactionCommitTimeoutInSeconds(), TimeUnit.SECONDS)); shardInitializationTimeout = new Timeout(datastoreContext.getShardInitializationTimeout().duration().$times(2)); }
public RpcRegistry(RemoteRpcProviderConfig config) { super(config); getLocalBucket().setData(new RoutingTable()); findRouterTimeout = getConfig().getGossipTickInterval().$times(10); }
void addMessageToRetry(Object message, ActorRef replyTo, String failureMessage) { LOG.debug("{}: Adding message {} to retry", shard.persistenceId(), message); MessageInfo messageInfo = new MessageInfo(message, replyTo, failureMessage); FiniteDuration period = shard.getDatastoreContext().getShardRaftConfig().getElectionTimeOutInterval().$times(2); messageInfo.timer = shard.getContext().system().scheduler().scheduleOnce(period, shard.getSelf(), messageInfo, shard.getContext().dispatcher(), ActorRef.noSender()); messagesToRetry.add(messageInfo); }