org.apache.excalibur.mpool
Class BlockingFixedSizePool

java.lang.Object
  |
  +--org.apache.excalibur.mpool.BlockingFixedSizePool
All Implemented Interfaces:
Disposable, Initializable, Pool

public final class BlockingFixedSizePool
extends Object
implements Pool, Disposable, Initializable

This is an Pool that caches Poolable objects for reuse. Please note that this pool offers no resource limiting whatsoever.

Since:
4.1
Version:
CVS $Revision: 1.11 $ $Date: 2003/03/22 12:46:28 $
Author:
Berin Loritsch

Field Summary
protected  Object m_semaphore
          The semaphor we synchronize on
 
Constructor Summary
BlockingFixedSizePool(ObjectFactory factory, int size)
           
BlockingFixedSizePool(ObjectFactory factory, int size, long timeout)
           
 
Method Summary
 Object acquire()
          Acquire an instance of the pooled object.
 void dispose()
           
 void initialize()
           
 Object newInstance()
          Create a new instance of the object being pooled.
 void release(Object object)
          Release the instance of the pooled object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_semaphore

protected final Object m_semaphore
The semaphor we synchronize on

Constructor Detail

BlockingFixedSizePool

public BlockingFixedSizePool(ObjectFactory factory,
                             int size)
                      throws Exception

BlockingFixedSizePool

public BlockingFixedSizePool(ObjectFactory factory,
                             int size,
                             long timeout)
                      throws Exception
Method Detail

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Exception

acquire

public Object acquire()
Description copied from interface: Pool
Acquire an instance of the pooled object.

Specified by:
acquire in interface Pool
Returns:
the pooled Object instance

release

public void release(Object object)
Description copied from interface: Pool
Release the instance of the pooled object.

Specified by:
release in interface Pool
Parameters:
object - The pooled object to release to the pool.

newInstance

public Object newInstance()
                   throws Exception
Description copied from interface: Pool
Create a new instance of the object being pooled.

Specified by:
newInstance in interface Pool
Returns:
the pooled Object instance
Throws:
Exception - if the instance cannot be created

dispose

public void dispose()
Specified by:
dispose in interface Disposable


Copyright © 2002 Apache Avalon Project. All Rights Reserved.