/** * Gets a reference to a remote observer. * * @param node the node address * @param actorObserverInterface the interface * @param id the observer id * @param <T> the interface type * @return an actor reference */ static <T extends ActorObserver> T getObserverReference(NodeAddress node, Class<T> actorObserverInterface, String id) { return DefaultDescriptorFactory.observerRef(node, actorObserverInterface, id); } }
/** * Requests the global actor count across the cluster. * * @return A task indicating containing the total actor count across the cluster. */ static Task<Long> getClusterActorCount() { final List<Task<Long>> countList = ActorRuntime.getRuntime().getAllNodes().stream() .map(address -> { final RuntimeActions runtimeActions = DefaultDescriptorFactory.observerRef(address, RuntimeActions.class, ""); return runtimeActions.getActorCount(); }) .collect(Collectors.toList()); await(Task.allOf(countList)); final Long actorCount = countList.stream() .mapToLong(Task<Long>::join) .sum(); return Task.fromValue(actorCount); }
public static Task<Void> flushAll(Actor actor) { final List<NodeAddress> nodes = ActorRuntime.getRuntime().getAllNodes(); return Task.allOf(nodes.stream() .map(nodeAddress -> DefaultDescriptorFactory.observerRef(nodeAddress, ExecutionCacheFlushObserver.class, "").flush(actor))); } }
/** * Requests the deactivation of an actor * * @param actor the actor which you want to deactivate. * @return A task indicating the state of the request. Immediately resolved if actor is not activated. */ static Task deactivate(final Actor actor) { final NodeAddress address = await(ActorRuntime.getRuntime().locateActor(RemoteReference.from(actor), false)); if(address != null) { final RuntimeActions runtimeActions = DefaultDescriptorFactory.observerRef(address, RuntimeActions.class, ""); return runtimeActions.deactivateActor(actor); } return Task.done(); }
/** * Gets a reference to a remote observer. * * @param node the node address * @param actorObserverInterface the interface * @param id the observer id * @param <T> the interface type * @return an actor reference */ static <T extends ActorObserver> T getObserverReference(NodeAddress node, Class<T> actorObserverInterface, String id) { return DefaultDescriptorFactory.observerRef(node, actorObserverInterface, id); } }
/** * Requests the global actor count across the cluster. * * @return A task indicating containing the total actor count across the cluster. */ static Task<Long> getClusterActorCount() { final List<Task<Long>> countList = ActorRuntime.getRuntime().getAllNodes().stream() .map(address -> { final RuntimeActions runtimeActions = DefaultDescriptorFactory.observerRef(address, RuntimeActions.class, ""); return runtimeActions.getActorCount(); }) .collect(Collectors.toList()); await(Task.allOf(countList)); final Long actorCount = countList.stream() .mapToLong(Task<Long>::join) .sum(); return Task.fromValue(actorCount); }
public static Task<Void> flushAll(Actor actor) { final List<NodeAddress> nodes = ActorRuntime.getRuntime().getAllNodes(); return Task.allOf(nodes.stream() .map(nodeAddress -> DefaultDescriptorFactory.observerRef(nodeAddress, ExecutionCacheFlushObserver.class, "").flush(actor))); } }
/** * Requests the deactivation of an actor * * @param actor the actor which you want to deactivate. * @return A task indicating the state of the request. Immediately resolved if actor is not activated. */ static Task deactivate(final Actor actor) { final NodeAddress address = await(ActorRuntime.getRuntime().locateActor(RemoteReference.from(actor), false)); if(address != null) { final RuntimeActions runtimeActions = DefaultDescriptorFactory.observerRef(address, RuntimeActions.class, ""); return runtimeActions.deactivateActor(actor); } return Task.done(); }