|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.scheduler.Scheduler
public final class Scheduler
Prototype of self-regulated thread pooled scheduler
Self regulation happened according to following rules:
Nested Class Summary | |
---|---|
private class |
Scheduler.WatchdogThread
|
private class |
Scheduler.WorkerThread
|
Field Summary | |
---|---|
private static long |
POKE_INTERVAL
|
static java.lang.RuntimeException |
TERMINATE
|
private long |
lastTaskPoke
|
private java.util.concurrent.BlockingQueue |
queue
|
private long |
schedulerTime
|
private boolean |
terminating
|
private java.util.concurrent.atomic.AtomicInteger |
threadCount
|
Constructor Summary | |
Scheduler()
|
|
Scheduler(int coreSize)
|
Method Summary | |
---|---|
void
|
execute(java.lang.Runnable task)
|
int
|
getPoolSize()
|
java.lang.Runnable
|
loop(java.lang.Runnable operation)
|
void
|
resetDefaultSize()
|
void
|
resize(int poolSize)
Retrieves the current thread pool size |
void
|
shutdown()
|
private void
|
startNewThread()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
private static final long POKE_INTERVAL
static final java.lang.RuntimeException TERMINATE
private long lastTaskPoke
private final java.util.concurrent.BlockingQueue queue
private long schedulerTime
private boolean terminating
private final java.util.concurrent.atomic.AtomicInteger threadCount
Constructor Detail |
---|
public Scheduler()
public Scheduler(int coreSize)
Method Detail |
---|
@java.lang.Override public void execute(java.lang.Runnable task)
@java.lang.Overridethrow Scheduler.TERMINATE; public int getPoolSize()
public java.lang.Runnable loop(java.lang.Runnable operation)
@java.lang.Override public void resetDefaultSize()
@java.lang.Override public void resize(int poolSize)
@java.lang.Override} @java.lang.SuppressWarnings} public void shutdown()
private void startNewThread()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.