@author Ilkka Priha @version $Id: BoundedBuffer.java 264148 2005-08-29 14:21:04Z henning $
@author Doug Lea @author Last changed by: $Author: gommma $ @version $Revision: 766 $ $Date: 2008-08-01 13:05:20 +0200 (ven, 01 ago 2008) $ @since ? (pre 2.1)
613614615616617618619620621622623624
} else { if ( pool.getQueue() instanceof BoundedBuffer ) { BoundedBuffer bb = (BoundedBuffer) pool.getQueue(); return bb.size() == 0; } else { return true; }
639640641642643644645646647648649650
} else { if ( pool.getQueue() instanceof BoundedBuffer ) { BoundedBuffer bb = (BoundedBuffer) pool.getQueue(); return bb.size(); } else { return 1; }
140141142143144145146147148149150
{ if ( log.isDebugEnabled() ) { log.debug( "Creating a Bounded Buffer to use for the pool" ); } queue = new BoundedBuffer( config.getBoundarySize() ); pool = new PooledExecutor( queue, config.getMaximumPoolSize() ); pool.setThreadFactory( new MyThreadFactory() ); } else {
9899100101102103104105106107108
this.multicastAddressString = multicastAddressString; this.multicastPort = multicastPort; this.cacheMgr = cacheMgr; // create a small thread pool to handle a barage pooledExecutor = new PooledExecutor( new BoundedBuffer( 100 ), maxPoolSize ); pooledExecutor.discardOldestWhenBlocked(); //pooledExecutor.setMinimumPoolSize(1); pooledExecutor.setThreadFactory( new MyThreadFactory() ); if ( log.isInfoEnabled() )
569570571572573574575576577578579
final boolean useQueueing = poolConfig.getChild("use-queueing").getValueAsBoolean(false); final int queueSize = poolConfig.getChild("queue-size").getValueAsInteger(-1); if (useQueueing) { if (queueSize > 0) { m_executor = new PooledExecutor(new BoundedBuffer(queueSize)); } else { m_executor = new PooledExecutor(new LinkedQueue()); } } else { m_executor = new PooledExecutor();
232233234235236237238239240241242
final int keepAliveTime, final boolean waitWhenBlocked) { m_threadPool = new PooledExecutor(new BoundedBuffer(threadPoolInitSize), threadPoolMaxSize); m_threadPool.setKeepAliveTime(keepAliveTime); m_threadPool.createThreads(threadPoolInitSize);
113114115116117118119120121122123
this.instRep = instRep; Channel c = null; if (unlimitedQueue) { c = new LinkedQueue(); } else { c = new BoundedBuffer(queueSize); } pool = new PooledExecutor(c, maxPoolSize); pool.setMinimumPoolSize(minPoolSize); pool.setKeepAliveTime(1000 * 60 * threadKeepAliveTime);
58596061626364
*/ protected abstract boolean shouldEvictNode(NodeEntry ne); protected BaseEvictionAlgorithm() { recycleQueue = new BoundedBuffer(RegionManager.CAPACITY); }
92939495969798
public static class MockEvictionAlgorithm extends BaseEvictionAlgorithm { public MockEvictionAlgorithm(int recycleQueueCapacity) { recycleQueue = new BoundedBuffer(recycleQueueCapacity); }
137138139140141142143144145146147
} else { // have thread per channel for sending messages and a thread for receiving them PooledExecutor executor = null; if (useAsyncSend) { executor = new PooledExecutor(new BoundedBuffer(maxOutstandingMessages), 1); } TcpTransportChannel channel = new TcpTransportChannel(wireFormat, socket, executor); addClient(channel); } }