io.vlingo.common.Cancellable Java Examples

The following examples show how to use io.vlingo.common.Cancellable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientConsumer.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
State(
        final Configuration configuration,
        final ClientRequestResponseChannel channel,
        final ResponseParser parser,
        final Cancellable probe,
        final ByteBuffer buffer) {
  this.configuration = configuration;
  this.channel = channel;
  this.parser = parser;
  this.probe = probe;
  this.buffer = buffer;
}
 
Example #2
Source File: Cancellable__Proxy.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public boolean cancel() {
  if (!actor.isStopped()) {
    final SerializableConsumer<Cancellable> consumer = (actor) -> actor.cancel();
    if (mailbox.isPreallocated()) { mailbox.send(actor, Cancellable.class, consumer, null, "cancel()"); }
    else { mailbox.send(new LocalMessage<Cancellable>(actor, Cancellable.class, consumer, "cancel()")); }
    return true;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, "cancel()"));
    return false;
  }
}