Class DispatcherThread

java.lang.Object
java.lang.Thread
org.nustaq.kontraktor.impl.DispatcherThread
All Implemented Interfaces:
java.lang.Runnable, Monitorable

public class DispatcherThread
extends java.lang.Thread
implements Monitorable
Implements the default dispatcher/scheduling of actors. For each actor created from "outside" (not from within another actor). A new DispatcherThread is created automatically. An actor created from within another actor inherits the dispatcher of the enclosing actor by default. Calls from actors sharing the same dispatcher are done directly (no queueing). Calls across actors in different dispatchers are put to the Channel of the receiving dispatcher. Note that cross-dispatcher calls are like 1000 times slower than inbound calls. Each dispatcher owns exactly one single thread. Note that dispatchers must be terminated if not needed any longer, as a thread is associated with them. For more sophisticated applications it might be appropriate to manually set up dispatchers (Actors.assignDispatcher()). The Actors.Channel method allows to specifiy a dedicated dispatcher on which to run the actor. This way it is possible to exactly balance and control the number of threads created and which thread operates a set of actors.