org.geotools.arcsde.jndi
Class SharedSessionPool

Object
  extended by SharedSessionPool
All Implemented Interfaces:
ISessionPool

public final class SharedSessionPool
extends Object
implements ISessionPool

A session pool that is not closable and hence can be shared between different applications/datastores when referenced by a JNDI context.

Since:
2.5.7
Author:
Gabriel Roldan (OpenGeo)

Constructor Summary
protected SharedSessionPool(ISessionPool delegate)
           
 
Method Summary
 void close()
          closes all connections in this pool.
protected  void finalize()
           
 int getAvailableCount()
          Returns the number of idle connections
 ArcSDEConnectionConfig getConfig()
           
static ISessionPool getInstance(ArcSDEConnectionConfig config, ISessionPoolFactory factory)
           
 int getInUseCount()
          Number of active sessions.
 int getPoolSize()
          returns the number of actual connections held by this connection pool.
 ISession getSession()
          Shortcut for getSession(true)
 ISession getSession(boolean transactional)
          Grab a session from the pool, this session is the responsibility of the calling code and must be closed after use.
 boolean isClosed()
          Returns whether this pool is closed
 String toString()
           
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SharedSessionPool

protected SharedSessionPool(ISessionPool delegate)
                     throws IOException
Throws:
IOException
Method Detail

getInstance

public static ISessionPool getInstance(ArcSDEConnectionConfig config,
                                       ISessionPoolFactory factory)
                                throws IOException
Throws:
IOException

finalize

protected void finalize()
Overrides:
finalize in class Object

close

public void close()
Description copied from interface: ISessionPool
closes all connections in this pool. The first call closes all SeConnections, further calls have no effect.

Specified by:
close in interface ISessionPool
See Also:
ISessionPool.close()

getAvailableCount

public int getAvailableCount()
Description copied from interface: ISessionPool
Returns the number of idle connections

Specified by:
getAvailableCount in interface ISessionPool
See Also:
ISessionPool.getAvailableCount()

getConfig

public ArcSDEConnectionConfig getConfig()
Specified by:
getConfig in interface ISessionPool
See Also:
ISessionPool.getConfig()

getInUseCount

public int getInUseCount()
Description copied from interface: ISessionPool
Number of active sessions.

Specified by:
getInUseCount in interface ISessionPool
Returns:
Number of active session; used to monitor the live pool.
See Also:
ISessionPool.getInUseCount()

getPoolSize

public int getPoolSize()
Description copied from interface: ISessionPool
returns the number of actual connections held by this connection pool. In other words, the sum of used and available connections, regardless

Specified by:
getPoolSize in interface ISessionPool
See Also:
ISessionPool.getPoolSize()

getSession

public ISession getSession()
                    throws IOException,
                           UnavailableConnectionException
Description copied from interface: ISessionPool
Shortcut for getSession(true)

Specified by:
getSession in interface ISessionPool
Throws:
IOException
UnavailableConnectionException
See Also:
ISessionPool.getSession()

getSession

public ISession getSession(boolean transactional)
                    throws IOException,
                           UnavailableConnectionException
Description copied from interface: ISessionPool
Grab a session from the pool, this session is the responsibility of the calling code and must be closed after use.

Specified by:
getSession in interface ISessionPool
Parameters:
transactional - whether the session is intended to be used on a transaction, so the pool may choose to reuse or not a connection.
Returns:
A Session, when close() is called it will be recycled into the pool
Throws:
IOException - If we could not get a connection
UnavailableConnectionException - If we are out of connections
See Also:
ISessionPool.getSession(boolean)

isClosed

public boolean isClosed()
Description copied from interface: ISessionPool
Returns whether this pool is closed

Specified by:
isClosed in interface ISessionPool
Returns:
See Also:
ISessionPool.isClosed()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2010 Geotools. All Rights Reserved.