@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)
202203204205206207208
// private ArrayBlockingQueue queue; public PanelInputStream(int maxSize) { // boolean orderedFIFO = true; // this.queue = new ArrayBlockingQueue(maxSize, orderedFIFO); this.queue = new BoundedBuffer(maxSize); }
108109110111112113114115116117118
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);
118119120121122123124125126127128
42434445464748
/** * subclasses override to provide their own queue implementation */ protected Channel createQueue() { return new BoundedBuffer(1500); }
50515253545556
/** * set the max capacity of the queue */ public synchronized void setQueueLimit(int size) { this.queue = new BoundedBuffer(size); }
26272829303132
/** * subclasses override to provide their own queue implementation */ protected Channel createQueue() { return new BoundedBuffer(5000); }
34353637383940
107108109110111112113114115116117
581582583584585586587588589590591
final boolean useQueueing = poolConfig.getChild("use-queueing").getValueAsBoolean(false); final int queueSize = poolConfig.getChild("queue-size").getValueAsInteger(-1); if (useQueueing) { if (queueSize > 0) { this.executor = new PooledExecutor(new BoundedBuffer(queueSize)); } else { this.executor = new PooledExecutor(new LinkedQueue()); } } else { this.executor = new PooledExecutor();
339340341342343344345346347348349350351352353354355356357
if ( pool.getQueue() != null ) { if ( pool.getQueue() instanceof BoundedBuffer ) { BoundedBuffer bb = (BoundedBuffer) pool.getQueue(); se = new StatElement(); se.setName( "Queue Size" ); se.setData( "" + bb.size() ); elems.add( se ); se = new StatElement(); se.setName( "Queue Capacity" ); se.setData( "" + bb.capacity() ); elems.add( se ); } } se = new StatElement();