@Override public void enqueue(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof ThingModifyCommand) { queueSizeBasedAction(handle.sender(), (ThingModifyCommand) message, () -> queue().add(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().add(handle); } }
@Override public void enqueueFirst(ActorRef actor, Envelope envelope) { final Object message = envelope.message(); LOG.trace("enqueueFirst: actor {}, message type: {}", actor, message.getClass()); if (message instanceof ControlMessage) { LOG.trace("Adding {} to the ControlMessage queue", message.getClass()); controlQueue.addFirst(envelope); } else { LOG.trace("Adding {} to the normal queue", message.getClass()); queue.addFirst(envelope); } } }
/** * Adds the current message (the message that the actor received last) to the actor's stash. * * @throws IllegalStateException if the same message is stashed more than once. */ protected void stash() { final Envelope message = actorCell.currentMessage(); if (!theStash.isEmpty() && (Objects.equals(message, theStash.lastElement()))) { throw new IllegalStateException("Can't stash the same message more than once: " + message.message()); } if (capacity <= 0) { theStash.add(message); } else { while (theStash.size() > (capacity - 1)) { theStash.removeElementAt(0); } theStash.add(message); } }
@Override public void enqueueFirst(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof PolicyModifyCommand) { queueSizeBasedAction(handle.sender(), (PolicyModifyCommand) message, () -> queue().addFirst(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().addFirst(handle); } }
/** * Adds the current message (the message that the actor received last) to the actor's stash. * * @throws IllegalStateException if the same message is stashed more than once. */ protected void stash() { final Envelope message = actorCell.currentMessage(); if (!theStash.isEmpty() && (Objects.equals(message, theStash.lastElement()))) { throw new IllegalStateException("Can't stash the same message more than once: " + message.message()); } if (capacity <= 0) { theStash.add(message); } else { while (theStash.size() > (capacity - 1)) { theStash.removeElementAt(0); } theStash.add(message); } }
@Override public void enqueueFirst(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof ThingModifyCommand) { queueSizeBasedAction(handle.sender(), (ThingModifyCommand) message, () -> queue().addFirst(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().addFirst(handle); } }
/** * 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 enqueueFirst(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof PolicyModifyCommand) { queueSizeBasedAction(handle.sender(), (PolicyModifyCommand) message, () -> queue().addFirst(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().addFirst(handle); } }
/** * 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 enqueue(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof PolicyModifyCommand) { queueSizeBasedAction(handle.sender(), (PolicyModifyCommand) message, () -> queue().add(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().add(handle); } }
@Override public void enqueueFirst(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof ThingModifyCommand) { queueSizeBasedAction(handle.sender(), (ThingModifyCommand) message, () -> queue().addFirst(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().addFirst(handle); } }
@Override public void enqueue(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof PolicyModifyCommand) { queueSizeBasedAction(handle.sender(), (PolicyModifyCommand) message, () -> queue().add(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().add(handle); } }
@Override public void enqueue(final ActorRef receiver, final Envelope handle) { final Object message = handle.message(); if (message instanceof ThingModifyCommand) { queueSizeBasedAction(handle.sender(), (ThingModifyCommand) message, () -> queue().add(handle)); } else { // all other messages are enqueued right away and with no "limit": queue().add(handle); } }