io.vlingo.actors.ActorProxyBase Java Examples

The following examples show how to use io.vlingo.actors.ActorProxyBase. 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: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> get(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Period arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.get(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), getRepresentation1); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), getRepresentation1)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, getRepresentation1));
  }
  return null;
}
 
Example #2
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<io.vlingo.lattice.grid.spaces.KeyItem<T>> put(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Item<T> arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.put(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<io.vlingo.lattice.grid.spaces.KeyItem<T>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), putRepresentation2); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), putRepresentation2)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, putRepresentation2));
  }
  return null;
}
 
Example #3
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> take(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Period arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.take(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), takeRepresentation3); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), takeRepresentation3)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, takeRepresentation3));
  }
  return null;
}
 
Example #4
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<T> itemFor(java.lang.Class<T> arg0, java.lang.Class<? extends io.vlingo.actors.Actor> arg1, java.lang.Object... arg2) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.itemFor(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1), ActorProxyBase.thunk(self, (Actor)actor, arg2));
    final io.vlingo.common.Completes<T> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), itemForRepresentation4); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), itemForRepresentation4)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, itemForRepresentation4));
  }
  return null;
}
 
Example #5
Source File: ProjectionControl__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void confirmProjected(java.lang.String arg0) {
  if (!actor.isStopped()) {
    ActorProxyBase<ProjectionControl> self = this;
    final SerializableConsumer<ProjectionControl> consumer = (actor) -> actor.confirmProjected(ActorProxyBase.thunk(self, (Actor)actor, arg0));
    if (mailbox.isPreallocated()) { mailbox.send(actor, ProjectionControl.class, consumer, null, confirmProjectedRepresentation1); }
    else { mailbox.send(new LocalMessage<ProjectionControl>(actor, ProjectionControl.class, consumer, confirmProjectedRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, confirmProjectedRepresentation1));
  }
}
 
Example #6
Source File: FeedProducer__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void produceFeedFor(io.vlingo.http.resource.feed.FeedProductRequest arg0) {
  if (!actor.isStopped()) {
    ActorProxyBase<FeedProducer> self = this;
    final SerializableConsumer<FeedProducer> consumer = (actor) -> actor.produceFeedFor(ActorProxyBase.thunk(self, (Actor)actor, arg0));
    if (mailbox.isPreallocated()) { mailbox.send(actor, FeedProducer.class, consumer, null, produceFeedForRepresentation1); }
    else { mailbox.send(new LocalMessage<FeedProducer>(actor, FeedProducer.class, consumer, produceFeedForRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, produceFeedForRepresentation1));
  }
}