org.apache.felix.eventadmin.impl.dispatch
Class DefaultThreadPool

java.lang.Object
  extended by EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
      extended by EDU.oswego.cs.dl.util.concurrent.PooledExecutor
          extended by org.apache.felix.eventadmin.impl.dispatch.DefaultThreadPool
All Implemented Interfaces:
EDU.oswego.cs.dl.util.concurrent.Executor

public class DefaultThreadPool
extends EDU.oswego.cs.dl.util.concurrent.PooledExecutor

A thread pool that allows to execute tasks using pooled threads in order to ease the thread creation overhead.

Author:
Felix Project Team

Nested Class Summary
 
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
EDU.oswego.cs.dl.util.concurrent.PooledExecutor.AbortWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.BlockedExecutionHandler, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardOldestWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.RunWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.WaitWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.Worker
 
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory
 
Field Summary
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
blockedExecutionHandler_, DEFAULT_KEEPALIVETIME, DEFAULT_MAXIMUMPOOLSIZE, DEFAULT_MINIMUMPOOLSIZE, handOff_, keepAliveTime_, maximumPoolSize_, minimumPoolSize_, poolSize_, shutdown_, threads_
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
threadFactory_
 
Constructor Summary
DefaultThreadPool(int poolSize, boolean syncThreads)
          Create a new pool.
 
Method Summary
 void close()
          Close the pool i.e, stop pooling threads.
 void configure(int poolSize)
          Configure a new pool size.
 void executeTask(Runnable task)
          Execute the task in a free thread or create a new one.
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
abortWhenBlocked, addThread, awaitTerminationAfterShutdown, awaitTerminationAfterShutdown, createThreads, discardOldestWhenBlocked, discardWhenBlocked, drain, execute, getBlockedExecutionHandler, getKeepAliveTime, getMaximumPoolSize, getMinimumPoolSize, getPoolSize, getTask, interruptAll, isTerminatedAfterShutdown, runWhenBlocked, setBlockedExecutionHandler, setKeepAliveTime, setMaximumPoolSize, setMinimumPoolSize, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownNow, shutdownNow, waitWhenBlocked, workerDone
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
getThreadFactory, setThreadFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultThreadPool

public DefaultThreadPool(int poolSize,
                         boolean syncThreads)
Create a new pool.

Method Detail

configure

public void configure(int poolSize)
Configure a new pool size.


close

public void close()
Close the pool i.e, stop pooling threads. Note that subsequently, task will still be executed but no pooling is taking place anymore.


executeTask

public void executeTask(Runnable task)
Execute the task in a free thread or create a new one.

Parameters:
task - The task to execute


Copyright © 2011 Apache Software Foundation. All Rights Reserved.