// Path: actors/src/main/java/com/droidkit/actors/dispatch/AbstractDispatcher.java
// public abstract class AbstractDispatcher<T, Q extends AbstractDispatchQueue<T>> {
//     final private Q queue;
//     final Dispatch<T> dispatch;
// 
//     protected AbstractDispatcher(Q queue, Dispatch<T> dispatch) {
//         this.queue = queue;
//         this.dispatch = dispatch;
//         this.queue.setListener(new QueueListener() {
//             @Override
//             public void onQueueChanged() {
//                 notifyDispatcher();
//             }
//         });
//     }
// 
//     /**
//      * Queue used for dispatching
//      *
//      * @return queue
//      */
//     public Q getQueue() {
//         return queue;
//     }
// 
//     /**
//      * Actual execution of action
//      *
//      * @param message action
//      */
//     protected void dispatchMessage(T message) {
//         if (dispatch != null) {
//             dispatch.dispatchMessage(message);
//         }
//     }
// 
//     /**
//      * Notification about queue change
//      */
//     protected void notifyDispatcher() {
// 
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/extensions/ActorExtension.java
// public interface ActorExtension {
//     public void preStart();
// 
//     public boolean onReceive(Object message);
// 
//     public void postStop();
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/DeadLetter.java
// public class DeadLetter {
//     private Object message;
// 
//     public DeadLetter(Object message) {
//         this.message = message;
//     }
// 
//     public Object getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return "DeadLetter(" + message + ")";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/Ping.java
// public class Ping {
//     public static final Ping INSTANCE = new Ping();
// 
//     private Ping() {
// 
//     }
// 
//     @Override
//     public String toString() {
//         return "Ping";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/PoisonPill.java
// public final class PoisonPill {
//     public static final PoisonPill INSTANCE = new PoisonPill();
// 
//     private PoisonPill() {
//     }
// 
//     @Override
//     public String toString() {
//         return "PoisonPill";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/StartActor.java
// public final class StartActor {
//     public static final StartActor INSTANCE = new StartActor();
// 
//     private StartActor() {
//     }
// 
//     @Override
//     public String toString() {
//         return "StartActor";
//     }
// }


import com.droidkit.actors.*;
import com.droidkit.actors.dispatch.AbstractDispatcher;
import com.droidkit.actors.extensions.ActorExtension;
import com.droidkit.actors.messages.DeadLetter;
import com.droidkit.actors.messages.Ping;
import com.droidkit.actors.messages.PoisonPill;
import com.droidkit.actors.messages.StartActor;
import java.util.HashMap;
import java.util.UUID;
        if (scope.getActor() == null) {
            if (envelope.getMessage() == PoisonPill.INSTANCE) {
                // Not creating actor for PoisonPill
                return;
            }
            try {
                Actor actor = scope.getProps().create();
                CurrentActor.setCurrentActor(actor);
                actor.initActor(scope.getUuid(), scope.getPath(), new ActorContext(scope), scope.getMailbox());
                for (ActorExtension e : actor.getExtensions()) {
                    e.preStart();
                }
                actor.preStart();
                scope.onActorCreated(actor);
            } catch (Exception e) {
                e.printStackTrace();
                if (envelope.getSender() != null) {
                    envelope.getSender().send(new DeadLetter("Unable to create actor"));
                }
                return;
            }
        }

        try {
            if (envelope.getMessage() == StartActor.INSTANCE) {
                // Already created actor
                return;
            } else if (envelope.getMessage() == Ping.INSTANCE) {
                // No op
                return;
// Path: actors/src/main/java/com/droidkit/actors/dispatch/AbstractDispatcher.java
// public abstract class AbstractDispatcher<T, Q extends AbstractDispatchQueue<T>> {
//     final private Q queue;
//     final Dispatch<T> dispatch;
// 
//     protected AbstractDispatcher(Q queue, Dispatch<T> dispatch) {
//         this.queue = queue;
//         this.dispatch = dispatch;
//         this.queue.setListener(new QueueListener() {
//             @Override
//             public void onQueueChanged() {
//                 notifyDispatcher();
//             }
//         });
//     }
// 
//     /**
//      * Queue used for dispatching
//      *
//      * @return queue
//      */
//     public Q getQueue() {
//         return queue;
//     }
// 
//     /**
//      * Actual execution of action
//      *
//      * @param message action
//      */
//     protected void dispatchMessage(T message) {
//         if (dispatch != null) {
//             dispatch.dispatchMessage(message);
//         }
//     }
// 
//     /**
//      * Notification about queue change
//      */
//     protected void notifyDispatcher() {
// 
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/extensions/ActorExtension.java
// public interface ActorExtension {
//     public void preStart();
// 
//     public boolean onReceive(Object message);
// 
//     public void postStop();
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/DeadLetter.java
// public class DeadLetter {
//     private Object message;
// 
//     public DeadLetter(Object message) {
//         this.message = message;
//     }
// 
//     public Object getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return "DeadLetter(" + message + ")";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/Ping.java
// public class Ping {
//     public static final Ping INSTANCE = new Ping();
// 
//     private Ping() {
// 
//     }
// 
//     @Override
//     public String toString() {
//         return "Ping";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/PoisonPill.java
// public final class PoisonPill {
//     public static final PoisonPill INSTANCE = new PoisonPill();
// 
//     private PoisonPill() {
//     }
// 
//     @Override
//     public String toString() {
//         return "PoisonPill";
//     }
// }
// 
// Path: actors/src/main/java/com/droidkit/actors/messages/StartActor.java
// public final class StartActor {
//     public static final StartActor INSTANCE = new StartActor();
// 
//     private StartActor() {
//     }
// 
//     @Override
//     public String toString() {
//         return "StartActor";
//     }
// }


// Path: actors/src/main/java/com/droidkit/actors/mailbox/AbsActorDispatcher.java
import com.droidkit.actors.*;
import com.droidkit.actors.dispatch.AbstractDispatcher;
import com.droidkit.actors.extensions.ActorExtension;
import com.droidkit.actors.messages.DeadLetter;
import com.droidkit.actors.messages.Ping;
import com.droidkit.actors.messages.PoisonPill;
import com.droidkit.actors.messages.StartActor;
import java.util.HashMap;
import java.util.UUID;

        if (scope.getActor() == null) {
            if (envelope.getMessage() == PoisonPill.INSTANCE) {
                // Not creating actor for PoisonPill
                return;
            }
            try {
                Actor actor = scope.getProps().create();
                CurrentActor.setCurrentActor(actor);
                actor.initActor(scope.getUuid(), scope.getPath(), new ActorContext(scope), scope.getMailbox());
                for (ActorExtension e : actor.getExtensions()) {
                    e.preStart();
                }
                actor.preStart();
                scope.onActorCreated(actor);
            } catch (Exception e) {
                e.printStackTrace();
                if (envelope.getSender() != null) {
                    envelope.getSender().send(new DeadLetter("Unable to create actor"));
                }
                return;
            }
        }

        try {
            if (envelope.getMessage() == StartActor.INSTANCE) {
                // Already created actor
                return;
            } else if (envelope.getMessage() == Ping.INSTANCE) {
                // No op
                return;
            } else if (envelope.getMessage() == PoisonPill.INSTANCE) {