org.apache.jackrabbit.core.data.db
Class Pool

java.lang.Object
  extended by org.apache.jackrabbit.core.data.db.Pool

public class Pool
extends Object

Implementation of a simple ConnectionRecoveryManager pool. The maximum number of pooled objects can be set, and if more objects are requested the pool waits until one object is put back.


Field Summary
protected  ArrayList all
           
protected  DbDataStore factory
           
protected  int maxSize
           
protected  EDU.oswego.cs.dl.util.concurrent.LinkedQueue pool
           
 
Constructor Summary
protected Pool(DbDataStore factory, int maxSize)
          Create a new pool using the given factory and maximum pool size.
 
Method Summary
protected  void add(Object o)
          But a connection back into the pool.
protected  Object get()
          Get a connection from the pool.
protected  ArrayList getAll()
          Get all connections (even if they are currently being used).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxSize

protected final int maxSize

all

protected final ArrayList all

factory

protected final DbDataStore factory

pool

protected final EDU.oswego.cs.dl.util.concurrent.LinkedQueue pool
Constructor Detail

Pool

protected Pool(DbDataStore factory,
               int maxSize)
Create a new pool using the given factory and maximum pool size.

Parameters:
factory - the db data store
maxSize - the maximum number of objects in the pool.
Method Detail

get

protected Object get()
              throws InterruptedException,
                     RepositoryException
Get a connection from the pool. This method may open a new connection if required, or if the maximum number of connections are opened, it will wait for one to be returned.

Returns:
the connection
Throws:
InterruptedException
RepositoryException

add

protected void add(Object o)
            throws InterruptedException
But a connection back into the pool.

Parameters:
o - the connection
Throws:
InterruptedException

getAll

protected ArrayList getAll()
Get all connections (even if they are currently being used).

Returns:
all connections


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.