public class ElasticScheduler extends Object implements Scheduler, Monitorable
| Modifier and Type | Class and Description |
|---|---|
static class |
ElasticScheduler.SchedulingReport |
| Modifier and Type | Field and Description |
|---|---|
protected BackOffStrategy |
backOffStrategy |
static boolean |
DEBUG_SCHEDULING |
static int |
DEFQSIZE |
static Timer |
delayedCalls |
protected ExecutorService |
exec |
static int |
MAX_STACK_ON_SYNC_CBDISPATCH |
static boolean |
REALLY_DEBUG_SCHEDULING |
static int |
RECURSE_ON_BLOCK_THRESHOLD |
| Constructor and Description |
|---|
ElasticScheduler(int maxThreads) |
ElasticScheduler(int maxThreads,
int defQSize) |
| Modifier and Type | Method and Description |
|---|---|
Future |
$getReport() |
Future<Monitorable[]> |
$getSubMonitorables() |
DispatcherThread |
assignDispatcher(int minLoadPerc)
if a low load thread is avaiable, return it. else try creation of new thread.
|
protected DispatcherThread |
createDispatcherThread() |
void |
delayedCall(long millis,
Runnable toRun) |
Object |
enqueueCall(Actor sendingActor,
Actor receiver,
String methodName,
Object[] args,
boolean isCB) |
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,
boolean isCBQ,
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 |
runOutside(Actor actor,
Runnable toRun) |
void |
threadStopped(DispatcherThread th) |
void |
tryIsolate(DispatcherThread dispatcherThread,
Actor refToExclude) |
void |
tryStopThread(DispatcherThread dispatcherThread)
stepwise move actors onto other dispatchers.
|
Future<Future[]> |
yield(Future... futures)
wait for all futures to complete and return an array of fulfilled futures
e.g. yield( f1, f2 ).then( (f,e) -> System.out.println( f[0].getResult() + f[1].getResult() ) );
|
void |
yield(int count) |
Future<List<Future>> |
yield(List<Future> futures) |
public static final int MAX_STACK_ON_SYNC_CBDISPATCH
public static int DEFQSIZE
public static boolean DEBUG_SCHEDULING
public static boolean REALLY_DEBUG_SCHEDULING
public static int RECURSE_ON_BLOCK_THRESHOLD
protected BackOffStrategy backOffStrategy
protected ExecutorService exec
public 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, boolean isCBQ, Object o, Object receiver)
put2QueuePolling in interface Schedulerpublic Object enqueueCall(Actor sendingActor, Actor receiver, String methodName, Object[] args, boolean isCB)
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 void runOutside(Actor actor, Runnable toRun)
runOutside in interface Schedulerpublic Future<Future[]> yield(Future... futures)
public DispatcherThread assignDispatcher(int minLoadPerc)
assignDispatcher in interface Schedulerprotected DispatcherThread createDispatcherThread()
public void rebalance(DispatcherThread dispatcherThread)
public void tryIsolate(DispatcherThread dispatcherThread, Actor refToExclude)
tryIsolate in interface Schedulerpublic void tryStopThread(DispatcherThread dispatcherThread)
tryStopThread in interface SchedulerdispatcherThread - public BackOffStrategy getBackoffStrategy()
getBackoffStrategy in interface Schedulerpublic Future $getReport()
$getReport in interface Monitorablepublic Future<Monitorable[]> $getSubMonitorables()
$getSubMonitorables in interface MonitorableCopyright © 2015. All rights reserved.