org.codehaus.gpars

groovyx.gpars.scheduler
[Java] Class Scheduler

java.lang.Object
  groovyx.gpars.scheduler.Scheduler
All Implemented Interfaces:
Pool

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

POKE_INTERVAL

private static final long POKE_INTERVAL


TERMINATE

static final java.lang.RuntimeException TERMINATE


lastTaskPoke

private long lastTaskPoke


queue

private final java.util.concurrent.BlockingQueue queue


schedulerTime

private long schedulerTime


terminating

private boolean terminating


threadCount

private final java.util.concurrent.atomic.AtomicInteger threadCount


 
Constructor Detail

Scheduler

public Scheduler()


Scheduler

public Scheduler(int coreSize)


 
Method Detail

execute

@java.lang.Override
public void execute(java.lang.Runnable task)


getPoolSize

@java.lang.Overridethrow Scheduler.TERMINATE;
public int getPoolSize()


loop

public java.lang.Runnable loop(java.lang.Runnable operation)


resetDefaultSize

@java.lang.Override
public void resetDefaultSize()


resize

@java.lang.Override
public void resize(int poolSize)
Retrieves the current thread pool size
Returns:
The pool size


shutdown

@java.lang.Override}
@java.lang.SuppressWarnings}
public void shutdown()


startNewThread

private void startNewThread()


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.