| 
org.codehaus.gpars | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgroovyx.gpars.scheduler.Scheduler
public final class Scheduler extends java.lang.Object
Prototype of self-regulated thread pooled scheduler
Self regulation happened according to following rules - worker thread, which had nothing to do 10 seconds dies - if no tasks were taken for processing during last 0.5sec new worker starts| 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()
            Retrieves the current thread pool size  | 
        
            java.lang.Runnable
         | 
        
            loop(java.lang.Runnable operation)
             | 
        
            void
         | 
        
            resetDefaultSize()
             | 
        
            void
         | 
        
            resize(int poolSize)
             | 
        
            void
         | 
        
            shutdown()
             | 
        
            private void
         | 
        
            startNewThread()
             | 
        
| Methods inherited from class java.lang.Object | |
|---|---|
| java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), 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 | 
|---|
@Override public void execute(java.lang.Runnable task)
@Override public int getPoolSize()
public java.lang.Runnable loop(java.lang.Runnable operation)
@Override public void resetDefaultSize()
@Override public void resize(int poolSize)
@Override
@SuppressWarnings({"ObjectAllocationInLoop"})
public void shutdown()
        
private void startNewThread()
Copyright © 2008–2010 Václav Pech. All Rights Reserved.