Search in sources :

Example 6 with Actor

use of co.paralleluniverse.actors.Actor in project quasar by puniverse.

the class GlxMigrator method hire.

@Override
public Actor hire(ActorRef actorRef, ActorImpl impl, ByteArraySerializer ser) throws SuspendExecution {
    final GlxGlobalChannelId gcid = ((GlxRemoteActor) impl).getId();
    if (!gcid.isGlobal())
        throw new IllegalArgumentException("Actor " + actorRef + " is not a migrating actor");
    final long id = gcid.getAddress();
    try {
        store.setListener(id, null);
        final byte[] buf = store.getx(id, null);
        assert buf != null : actorRef + " " + impl;
        final Object obj = ser.read(buf);
        final Actor actor;
        if (obj instanceof Actor)
            actor = (Actor) obj;
        else
            throw new IllegalArgumentException("Serialized object " + obj + " is not an actor.");
        GlobalRemoteChannelReceiver.getReceiver(actor.getMailbox(), id);
        return actor;
    } catch (co.paralleluniverse.galaxy.TimeoutException e) {
        throw new RuntimeException(e);
    }
}
Also used : Actor(co.paralleluniverse.actors.Actor)

Aggregations

Actor (co.paralleluniverse.actors.Actor)6 LocalActor (co.paralleluniverse.actors.LocalActor)5 ActorRef (co.paralleluniverse.actors.ActorRef)3 BasicActor (co.paralleluniverse.actors.BasicActor)1 ExitMessage (co.paralleluniverse.actors.ExitMessage)1 LifecycleMessage (co.paralleluniverse.actors.LifecycleMessage)1 MailboxConfig (co.paralleluniverse.actors.MailboxConfig)1 MessageProcessor (co.paralleluniverse.actors.MessageProcessor)1 SelectiveReceiveHelper (co.paralleluniverse.actors.SelectiveReceiveHelper)1 AbstractServerHandler (co.paralleluniverse.actors.behaviors.AbstractServerHandler)1 EventHandler (co.paralleluniverse.actors.behaviors.EventHandler)1 EventSource (co.paralleluniverse.actors.behaviors.EventSource)1 EventSourceActor (co.paralleluniverse.actors.behaviors.EventSourceActor)1 Initializer (co.paralleluniverse.actors.behaviors.Initializer)1 Server (co.paralleluniverse.actors.behaviors.Server)1 ServerActor (co.paralleluniverse.actors.behaviors.ServerActor)1 SuspendExecution (co.paralleluniverse.fibers.SuspendExecution)1 Store (co.paralleluniverse.galaxy.Store)1 StoreTransaction (co.paralleluniverse.galaxy.StoreTransaction)1 TimeoutException (co.paralleluniverse.galaxy.TimeoutException)1