Keel 2.1RC2

org.apache.excalibur.mpool
Class BlockingFixedSizePool

java.lang.Object
  extended byorg.apache.excalibur.mpool.BlockingFixedSizePool
All Implemented Interfaces:
Disposable, Initializable, Pool

public final class BlockingFixedSizePool
extends java.lang.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.4 $ $Date: 2004/02/28 11:47:34 $
Author:

Field Summary
private  Buffer m_buffer
           
private  boolean m_disposed
           
private  ObjectFactory m_factory
           
private  int m_maxSize
           
protected  java.lang.Object m_semaphore
          The semaphor we synchronize on
private  long m_timeout
           
 
Constructor Summary
BlockingFixedSizePool(ObjectFactory factory, int size)
           
BlockingFixedSizePool(ObjectFactory factory, int size, long timeout)
           
 
Method Summary
 java.lang.Object acquire()
          Acquire an instance of the pooled object.
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 void initialize()
          Initialize the component.
 java.lang.Object newInstance()
          Create a new instance of the object being pooled.
 void release(java.lang.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_disposed

private boolean m_disposed

m_buffer

private final Buffer m_buffer

m_factory

private final ObjectFactory m_factory

m_timeout

private final long m_timeout

m_maxSize

private final int m_maxSize

m_semaphore

protected final java.lang.Object m_semaphore
The semaphor we synchronize on

Constructor Detail

BlockingFixedSizePool

public BlockingFixedSizePool(ObjectFactory factory,
                             int size)
                      throws java.lang.Exception

BlockingFixedSizePool

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

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if an error occurs

acquire

public java.lang.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(java.lang.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 java.lang.Object newInstance()
                             throws java.lang.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:
java.lang.Exception - if the instance cannot be created

dispose

public void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.

Specified by:
dispose in interface Disposable

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.