public class ElasticScheduler extends Object implements Scheduler
| Modifier and Type | Field and Description |
|---|---|
protected BackOffStrategy |
backOffStrategy |
static int |
BLOCK_COUNT_WARNING_THRESHOLD |
static boolean |
DEBUG_SCHEDULING |
static int |
DEFQSIZE |
protected static Timer |
delayedCalls |
protected ExecutorService |
exec |
static int |
RECURSE_ON_BLOCK_THRESHOLD |
| Constructor and Description |
|---|
ElasticScheduler(int maxThreads) |
ElasticScheduler(int maxThreads,
int defQSize) |
| Modifier and Type | Method and Description |
|---|---|
DispatcherThread |
assignDispatcher() |
protected DispatcherThread |
createDispatcherThread() |
void |
delayedCall(long millis,
Runnable toRun) |
Object |
enqueueCall(Actor sendingActor,
Actor receiver,
String methodName,
Object[] args) |
int |
getActiveThreads() |
BackOffStrategy |
getBackoffStrategy() |
int |
getDefaultQSize() |
InvocationHandler |
getInvoker(Actor dispatcher,
Object toWrap) |
int |
getMaxThreads() |
<T> T |
inThread(Actor actor,
T callback)
Creates a wrapper on the given object enqueuing all calls to INTERFACE methods of the given object to the given actors's queue.
|
Future |
put2QueuePolling(CallEntry e) |
void |
put2QueuePolling(Queue q,
Object o,
Object receiver) |
void |
rebalance(DispatcherThread dispatcherThread)
called from inside overloaded thread.
|
<T> void |
runBlockingCall(Actor emitter,
Callable<T> toCall,
Callback<T> resultHandler) |
void |
threadStopped(DispatcherThread th) |
void |
tryStopThread(DispatcherThread dispatcherThread) |
Future<Future[]> |
yield(Future... futures)
wait for all futures to complete and return an array of fulfilled futures
e.g.
|
void |
yield(int count) |
<T> Future<List<Future<T>>> |
yield(List<Future<T>> futures) |
public static int DEFQSIZE
public static boolean DEBUG_SCHEDULING
public static int BLOCK_COUNT_WARNING_THRESHOLD
public static int RECURSE_ON_BLOCK_THRESHOLD
protected BackOffStrategy backOffStrategy
protected ExecutorService exec
protected static Timer delayedCalls
public ElasticScheduler(int maxThreads)
public ElasticScheduler(int maxThreads,
int defQSize)
public int getActiveThreads()
public int getMaxThreads()
getMaxThreads in interface Schedulerpublic int getDefaultQSize()
getDefaultQSize in interface Schedulerpublic void put2QueuePolling(Queue q, Object o, Object receiver)
put2QueuePolling in interface Schedulerpublic Object enqueueCall(Actor sendingActor, Actor receiver, String methodName, Object[] args)
enqueueCall in interface Schedulerpublic void threadStopped(DispatcherThread th)
threadStopped in interface Schedulerpublic InvocationHandler getInvoker(Actor dispatcher, Object toWrap)
getInvoker in interface Schedulerpublic <T> T inThread(Actor actor, T callback)
public void delayedCall(long millis,
Runnable toRun)
delayedCall in interface Schedulerpublic <T> void runBlockingCall(Actor emitter, Callable<T> toCall, Callback<T> resultHandler)
runBlockingCall in interface Schedulerpublic Future<Future[]> yield(Future... futures)
public DispatcherThread assignDispatcher()
assignDispatcher in interface Schedulerprotected DispatcherThread createDispatcherThread()
public void rebalance(DispatcherThread dispatcherThread)
public void tryStopThread(DispatcherThread dispatcherThread)
tryStopThread in interface Schedulerpublic BackOffStrategy getBackoffStrategy()
getBackoffStrategy in interface SchedulerCopyright © 2014. All rights reserved.