@Override public void close() throws Exception { if (isLoaded()) { actorSystem.terminate(); Await.ready(actorSystem.whenTerminated(), Duration.Inf()); actorSystem = null; } }
public static FiniteDuration duration(String s) { final Duration ret = Duration.apply(s); if (ret instanceof FiniteDuration) return (FiniteDuration) ret; else throw new IllegalArgumentException( "duration() is only for finite durations, use Duration.Inf() and friends"); }
/** * Same as <code>expectTerminated(remainingOrDefault(), target)</code>, but correctly treating the * timeFactor. Don't forget to 'watch' it first! */ public Terminated expectTerminated(ActorRef target) { return expectTerminated(Duration.Undefined(), target); }
LOG.debug("keytabPath: {}", keytabPath); config.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, keytabPath); config.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL, remoteKeytabPrincipal); final String amPortRange = config.getString( YarnConfigOptions.APPLICATION_MASTER_PORT); LOG); ActorRef resourceMaster = actorSystem.actorOf(resourceMasterProps); actorSystem.actorOf( Props.create(ProcessReaper.class, resourceMaster, LOG, ACTOR_DIED_EXIT_CODE), "YARN_Resource_Master_Process_Reaper"); actorSystem.actorOf( Props.create(ProcessReaper.class, jobManager, LOG, ACTOR_DIED_EXIT_CODE), "JobManager_Process_Reaper"); Await.ready(actorSystem.whenTerminated(), Duration.Inf()); } catch (InterruptedException | TimeoutException e) { LOG.error("Error shutting down actor system", e); AkkaUtils.getTimeout(config).toMillis(), TimeUnit.MILLISECONDS, futureExecutor,
Configuration config = new Configuration(); config.setInteger(CheckpointingOptions.MAX_RETAINED_CHECKPOINTS, retainedCheckpoints); config.setInteger(ConfigConstants.LOCAL_NUMBER_JOB_MANAGER, numJMs); config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, numTMs); config.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, numSlots); system.terminate(); Await.ready(system.whenTerminated(), Duration.Inf());
/** * Wait and retry. */ public void waitAndRetry() { ContinueToSendToBatchSenderAsstManager continueToSendToBatchSenderAsstManager = new ContinueToSendToBatchSenderAsstManager( processedWorkerCount); logger.debug("NOW WAIT Another " + asstManagerRetryIntervalMillis + " MS. at " + PcDateUtils.getNowDateTimeStrStandard()); getContext() .system() .scheduler() .scheduleOnce( Duration.create(asstManagerRetryIntervalMillis, TimeUnit.MILLISECONDS), getSelf(), continueToSendToBatchSenderAsstManager, getContext().system().dispatcher(), getSelf()); return; }
public static FailureRateRestartStrategyFactory createFactory(Configuration configuration) throws Exception { int maxFailuresPerInterval = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FAILURE_RATE_MAX_FAILURES_PER_INTERVAL, 1); String failuresIntervalString = configuration.getString( ConfigConstants.RESTART_STRATEGY_FAILURE_RATE_FAILURE_RATE_INTERVAL, Duration.apply(1, TimeUnit.MINUTES).toString() ); String timeoutString = configuration.getString(ConfigConstants.AKKA_WATCH_HEARTBEAT_INTERVAL, ConfigConstants.DEFAULT_AKKA_ASK_TIMEOUT); String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FAILURE_RATE_DELAY, timeoutString); Duration failuresInterval = Duration.apply(failuresIntervalString); Duration delay = Duration.apply(delayString); return new FailureRateRestartStrategyFactory(maxFailuresPerInterval, Time.milliseconds(failuresInterval.toMillis()), Time.milliseconds(delay.toMillis())); }
+ " at " + prepareRequestTimeStr); ActorRef worker = getContext().system().actorOf( Props.create(OperationWorker.class, new TaskRequest(task.getConfig() maxConcurrency); batchSenderAsstManager = getContext().system().actorOf( Props.create(AssistantExecutionManager.class), "RequestToBatchSenderAsstManager-" .create(task.getConfig().getTimeoutInManagerSec(), TimeUnit.SECONDS); timeoutMessageCancellable = getContext() .system() .scheduler() .scheduleOnce(timeOutDuration, getSelf(), ExecutionManagerMsgType.OPERATION_TIMEOUT,
public static ResourceManagerConfiguration fromConfiguration(Configuration configuration) throws ConfigurationException { final String strTimeout = configuration.getString(AkkaOptions.AKKA_ASK_TIMEOUT); final Time timeout; try { timeout = Time.milliseconds(Duration.apply(strTimeout).toMillis()); } catch (NumberFormatException e) { throw new ConfigurationException("Could not parse the resource manager's timeout " + "value " + AkkaOptions.AKKA_ASK_TIMEOUT + '.', e); } final String strHeartbeatInterval = configuration.getString(AkkaOptions.AKKA_WATCH_HEARTBEAT_INTERVAL); final Time heartbeatInterval; try { heartbeatInterval = Time.milliseconds(Duration.apply(strHeartbeatInterval).toMillis()); } catch (NumberFormatException e) { throw new ConfigurationException("Could not parse the resource manager's heartbeat interval " + "value " + AkkaOptions.AKKA_WATCH_HEARTBEAT_INTERVAL + '.', e); } return new ResourceManagerConfiguration(timeout, heartbeatInterval); } }
public static SlotManagerConfiguration fromConfiguration(Configuration configuration) throws ConfigurationException { final String strTimeout = configuration.getString(AkkaOptions.ASK_TIMEOUT); final Time rpcTimeout; try { rpcTimeout = Time.milliseconds(Duration.apply(strTimeout).toMillis()); } catch (NumberFormatException e) { throw new ConfigurationException("Could not parse the resource manager's timeout " + "value " + AkkaOptions.ASK_TIMEOUT + '.', e); } final Time slotRequestTimeout = getSlotRequestTimeout(configuration); final Time taskManagerTimeout = Time.milliseconds( configuration.getLong(ResourceManagerOptions.TASK_MANAGER_TIMEOUT)); return new SlotManagerConfiguration(rpcTimeout, slotRequestTimeout, taskManagerTimeout); }
/** * Shut down an actor system and wait for termination. * On failure debug output will be logged about the remaining actors in the system. * <p> * * If verifySystemShutdown is true, then an exception will be thrown on failure. */ public void shutdown(ActorSystem actorSystem, Duration duration, Boolean verifySystemShutdown) { boolean vss = verifySystemShutdown != null ? verifySystemShutdown : false; Duration dur = duration != null ? duration : dilated(FiniteDuration.create(5, TimeUnit.SECONDS)).min(FiniteDuration.create(10, TimeUnit.SECONDS)); JavaTestKit.shutdownActorSystem(actorSystem, dur, vss); }
+ PcDateUtils.getNowDateTimeStr()); executionManager = ActorConfig.createAndGetActorSystem().actorOf( Props.create(ExecutionManager.class, task), "ExecutionManager-" + task.getTaskId()); final FiniteDuration duration = Duration.create(task.getConfig() .getTimeoutAskManagerSec(), TimeUnit.SECONDS); ActorConfig.createAndGetActorSystem().stop(executionManager);
public ReceiveWhile(Class<T> clazz, Duration max, int messages) { this(clazz, max, Duration.Inf(), messages); }
public AwaitAssert() { this(Duration.Undefined(), p.awaitAssert$default$3()); }
public AwaitCond() { this(Duration.Undefined(), p.awaitCond$default$3()); }