public class Actors extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Timer |
delayedCalls |
protected ExecutorService |
exec |
protected ActorProxyFactory |
factory |
| Modifier | Constructor and Description |
|---|---|
protected |
Actors() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Actor> |
$$(Class<T> clz) |
static <T extends Actor> |
AsActor(Class<? extends Actor> actorClazz)
create an new actor.
|
static <T extends Actor> |
AsActor(Class<? extends Actor> actorClazz,
DispatcherThread disp)
create an new actor dispatched in the given DispatcherThread
|
static <T extends Actor> |
AsActor(Class<? extends Actor> actorClazz,
int qSize)
create an new actor.
|
static <T> Future<T> |
Async(Callable<T> toCall)
execute a callable asynchronously (in a different thread) and return a future
of the result (delivered in caller thread)
|
static <T> void |
Delayed(int millis,
Runnable toRun)
schedule an action or call delayed.
|
protected <T> void |
delayedCall(int millis,
Runnable toRun) |
protected ActorProxyFactory |
getFactory() |
static <T> T |
InThread(T callback)
Creates a wrapper on the given object enqueuing all calls to INTERFACE methods of the given object to the calling actors's queue.
|
protected DispatcherThread |
newDispatcher(int qSize)
return a new dispatcher backed by a new thread.
|
protected Actor |
newProxy(Class<? extends Actor> clz,
DispatcherThread disp) |
protected Actor |
newProxy(Class<? extends Actor> clz,
int qsize) |
protected <T> void |
runBlockingCall(Callable<T> toCall,
Callback<T> resultHandler) |
static void |
SetDefaultQueueSize(int siz) |
static <T extends Actor> |
SpawnActor(Class<? extends Actor> actorClazz)
create a new actor with a newly created DispatcherThread
|
static <T extends Actor> |
SpawnActor(Class<? extends Actor> actorClazz,
int qSiz)
create a new actor with a newly created DispatcherThread
|
static Future<Future[]> |
Yield(Future... futures)
wait for all futures to complete and return an array of fulfilled futures
e.g.
|
protected ExecutorService exec
protected Timer delayedCalls
protected ActorProxyFactory factory
public static void SetDefaultQueueSize(int siz)
public static <T extends Actor> T AsActor(Class<? extends Actor> actorClazz)
T - actorClazz - public static <T extends Actor> T AsActor(Class<? extends Actor> actorClazz, int qSize)
T - actorClazz - public static <T> T InThread(T callback)
T - callback - public static <T extends Actor> T AsActor(Class<? extends Actor> actorClazz, DispatcherThread disp)
T - actorClazz - public static <T extends Actor> T SpawnActor(Class<? extends Actor> actorClazz)
T - actorClazz - public static <T extends Actor> T SpawnActor(Class<? extends Actor> actorClazz, int qSiz)
T - actorClazz - qSiz - - size of mailbox queuepublic static <T> Future<T> Async(Callable<T> toCall)
T - toCall - public static <T> void Delayed(int millis,
Runnable toRun)
T - public static Future<Future[]> Yield(Future... futures)
futures - protected ActorProxyFactory getFactory()
protected <T> void delayedCall(int millis,
Runnable toRun)
protected Actor newProxy(Class<? extends Actor> clz, DispatcherThread disp)
protected DispatcherThread newDispatcher(int qSize)
Copyright © 2014. All rights reserved.