/** * Process termination. * * @param message the message */ private void processTermination(Terminated message) { ActorRef terminated = message.actor(); if (terminated instanceof LocalActorRef) { LocalActorRef localActor = (LocalActorRef) terminated; String name = localActor.path().name(); if (applications.remove(name) != null) { LOG.debug("[{}] removed application: {}", tenantId, localActor); } else if (localUsers.remove(name) != null) { LOG.debug("[{}] removed local user: {}", tenantId, localActor); } else if (globalUsers.remove(name) != null) { LOG.debug("[{}] removed global user: {}", tenantId, localActor); } } else { LOG.warn("remove commands for remote actors are not supported yet!"); } }
private void actorTerminated(final Terminated message) { LOG.info("Actor termination {} received", message); for (Address addr : watchedActors.removeAll(message.getActor())) { versions.remove(addr); final Bucket<T> bucket = remoteBuckets.remove(addr); if (bucket != null) { LOG.debug("Source actor dead, removing bucket {} from {}", bucket, addr); onBucketRemoved(addr, bucket); } } }
@Override public void doApply(final Terminated message) { log.warning("Persistence actor for Thing with ID <{}> terminated abnormally.", thingId); if (message.getAddressTerminated()) { log.error("Persistence actor for Thing with ID <{}> terminated abnormally " + "because it crashed or because of network failure!", thingId); } child = null; final Duration restartDelay = calculateRestartDelay(); getContext().system() .scheduler() .scheduleOnce(new FiniteDuration(restartDelay.toNanos(), TimeUnit.NANOSECONDS), getSelf(), StartChild.INSTANCE, getContext().dispatcher(), null); restartCount += 1; }
/** * Handles connections errors that occur when the need consumer actors are terminated. * * @param t messages that holds a reference to consumer actor that was terminated */ private void handleConnectionErrors(Terminated t) { for (String uri : crawlWonNodes.keySet()) { WonNodeConnection con = crawlWonNodes.get(uri); if (con != null) { if (con.getNeedCreatedConsumer().equals(t.getActor())) { log.error("NeedCreatedConsumer '{}' of won '{}' has been shut down", t.getActor(), uri); addFailedWonNode(con.getWonNodeInfo().getWonNodeURI(), con); } else if (con.getNeedActivatedConsumer().equals(t.getActor())) { log.error("NeedActivatedConsumer '{}' of won '{}' has been shut down", t.getActor(), uri); addFailedWonNode(con.getWonNodeInfo().getWonNodeURI(), con); } else if (con.getNeedDeactivatedConsumer().equals(t.getActor())) { log.error("NeedDeactivatedConsumer '{}' of won '{}' has been shut down", t.getActor(), uri); addFailedWonNode(con.getWonNodeInfo().getWonNodeURI(), con); } else if (con.getHintProducer().equals(t.getActor())) { log.error("HintProducer '{}' of won '{}' has been shut down", t.getActor(), uri); addFailedWonNode(con.getWonNodeInfo().getWonNodeURI(), con); } } } }
/** * Process termination. * * @param message the message */ private void processTermination(Terminated message) { ActorRef terminated = message.actor(); if (terminated instanceof LocalActorRef) { LocalActorRef localActor = (LocalActorRef) terminated; String name = localActor.path().name(); if (endpointSessions.remove(name) != null) { LOG.debug("removed: {}", localActor); } } else { LOG.warn("remove commands for remote actors are not supported yet!"); } }
private void terminated(final Terminated terminated) { streamForwarderStartedOrStopped(); final ActorRef terminatedActor = terminated.getActor(); log.debug("Received Terminated-Message: {}", terminated); if (!Objects.equals(terminatedActor, forwarder)) { log.warning("Received Terminated-Message from actor <{}> which does not match current forwarder <{}>", terminatedActor, forwarder); return; } getContext().unwatch(terminatedActor); forwarder = null; scheduleNextStream(); }
void processTerminationMessage(ActorContext context, Terminated message) { ActorRef terminated = message.actor(); if (terminated instanceof LocalActorRef) { LocalActorRef localActor = (LocalActorRef) terminated; String name = getActorPathName(localActor); EndpointObjectHash endpoint = endpoints.remove(name); if (endpoint != null) { boolean stilPresent = false; for (EndpointObjectHash existingEndpoint : endpoints.values()) { if (existingEndpoint.equals(endpoint)) { stilPresent = true; break; } } if (stilPresent) { LOG.debug("[{}] received termination message for endpoint actor [{}], " + "but other actor is still registered for this endpoint.", userId, localActor); } else { removeEndpoint(context, endpoint); LOG.debug("[{}] removed endpoint [{}]", userId, localActor); } } } else { LOG.warn("remove commands for remote actors are not supported yet!"); } }
private void terminated(final Terminated terminated) { streamForwarderStartedOrStopped(); final ActorRef terminatedActor = terminated.getActor(); log.debug("Received Terminated-Message: {}", terminated); if (!Objects.equals(terminatedActor, forwarder)) { log.warning("Received Terminated-Message from actor <{}> which does not match current forwarder <{}>", terminatedActor, forwarder); return; } getContext().unwatch(terminatedActor); forwarder = null; scheduleNextStream(); }
ActorRef terminated = message.actor(); if (terminated instanceof LocalActorRef) { LocalActorRef localActor = (LocalActorRef) terminated;
@Override public void unhandled(Object message) { if (message instanceof Terminated && ((Terminated) message).getActor().equals(workExecutor)) { getContext().stop(getSelf()); } else if (message instanceof WorkIsReady) { // do nothing } else { super.unhandled(message); } }
@Override public void onReceive(Object message) throws Exception { if(message instanceof Terminated){ Terminated terminated = (Terminated) message; if(LOG.isDebugEnabled()) { LOG.debug("Actor terminated : {}", terminated.actor()); } }else if(message instanceof Monitor){ Monitor monitor = (Monitor) message; getContext().watch(monitor.getActorRef()); } } }
/** * Enqueues {@code envelope} at the first position in the mailbox. If the message contained in * the envelope is a {@link Terminated} message, it will be ensured that it can be re-received * by the actor. * * @param envelope the envelope to enqueue. */ private void enqueueFirst(final Envelope envelope) { mailbox.enqueueFirst(getSelf(), envelope); if (envelope.message() instanceof Terminated) { actorCell.terminatedQueuedFor(((Terminated) envelope.message()).getActor()); } }
@Override public void onReceive(Object message) { if (message instanceof Terminated) { try { Terminated term = (Terminated) message; String name = term.actor().path().toSerializationFormat(); if (log != null) { log.error("Actor " + name + " terminated, stopping process..."); // give the log some time to reach disk try { Thread.sleep(100); } catch (InterruptedException e) { // not really a problem if we don't sleep... } } } finally { System.exit(exitCode); } } } }
/** * Enqueues {@code envelope} at the first position in the mailbox. If the message contained in * the envelope is a {@link Terminated} message, it will be ensured that it can be re-received * by the actor. * * @param envelope the envelope to enqueue. */ private void enqueueFirst(final Envelope envelope) { mailbox.enqueueFirst(getSelf(), envelope); if (envelope.message() instanceof Terminated) { actorCell.terminatedQueuedFor(((Terminated) envelope.message()).getActor()); } }
@Override public void onReceive(Object message) { if (message instanceof Terminated) { try { Terminated term = (Terminated) message; String name = term.actor().path().toSerializationFormat(); if (log != null) { log.error("Actor " + name + " terminated, stopping process..."); // give the log some time to reach disk try { Thread.sleep(100); } catch (InterruptedException e) { // not really a problem if we don't sleep... } } } finally { System.exit(exitCode); } } } }
@Override public Receive createReceive() { return receiveBuilder() .match(TransformationJob.class, job -> backends.isEmpty(), job -> { sender().tell(new JobFailed("Service unavailable, try again later", job), sender()); }) .match(TransformationJob.class, job -> { jobCounter++; backends.get(jobCounter % backends.size()) .forward(job, getContext()); }) .matchEquals(BACKEND_REGISTRATION, message -> { getContext().watch(sender()); backends.add(sender()); }) .match(Terminated.class, terminated -> { backends.remove(terminated.getActor()); }) .build(); } }
@Override public void onReceive(Object message) { if (message instanceof Terminated) { Terminated terminated = (Terminated) message; LOG.debug("Actor terminated : {}", terminated.actor()); } else if (message instanceof Monitor) { Monitor monitor = (Monitor) message; getContext().watch(monitor.getActorRef()); } } }
ActorRef target = ((Terminated) message).getActor(); if (jobManager.equals(target)) { LOG.info("Lost connection to JobManager {}. Triggering connection timeout.",
@Override public void onReceive(Object message) { if (message instanceof Terminated) { try { Terminated term = (Terminated) message; String name = term.actor().path().toSerializationFormat(); if (log != null) { log.error("Actor " + name + " terminated, stopping process..."); // give the log some time to reach disk try { Thread.sleep(100); } catch (InterruptedException e) { // not really a problem if we don't sleep... } } } finally { System.exit(exitCode); } } } }
ActorRef target = ((Terminated) message).getActor(); if (jobManager.equals(target)) { LOG.info("Lost connection to JobManager {}. Triggering connection timeout.",