|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectSessionPool
public class SessionPool
Maintains SeConnection
's for a single set of connection properties (for instance: by
server, port, user and password) in a pool to recycle used connections.
We are making use of an Apache Commons ObjectPool to maintain connections. This connection pool is configurable in the sense that some parameters can be passed to establish the pooling policy. To pass parameters to the connection pool, you should set properties in the parameters Map passed to SdeDataStoreFactory.createDataStore, which will invoke SdeConnectionPoolFactory to get the SDE instance's pool singleton. That instance singleton will be created with the preferences passed the first time createDataStore is called for a given SDE instance/user, if subsequent calls change that preferences, they will be ignored.
The expected optional parameters that you can set up in the argument Map for createDataStore are:
Nested Class Summary | |
---|---|
protected class |
SessionPool.SeConnectionFactory
PoolableObjectFactory intended to be used by a Jakarta's commons-pool objects pool, that provides ArcSDE's SeConnections. |
Field Summary | |
---|---|
protected ArcSDEConnectionConfig |
config
this connection pool connection's parameters |
static int |
DEFAULT_CONNECTIONS
default number of connections a pool creates at first population |
static int |
DEFAULT_MAX_CONNECTIONS
default number of maximun allowable connections a pool can hold |
static int |
DEFAULT_MAX_WAIT_TIME
|
protected static Level |
INFO_LOG_LEVEL
DOCUMENT ME! |
protected GenericObjectPool |
pool
Apache commons-pool used to pool arcsde connections |
Constructor Summary | |
---|---|
protected |
SessionPool(ArcSDEConnectionConfig config)
Creates a new SdeConnectionPool object with the connection parameters holded by config |
Method Summary | |
---|---|
void |
close()
closes all connections in this pool. |
protected SessionPool.SeConnectionFactory |
createConnectionFactory()
SeConnectionFactory used to create ISession instances for the pool. |
protected void |
finalize()
Ensures proper closure of connection pool at this object's finalization stage. |
int |
getAvailableCount()
TODO: Document this method! |
List<String> |
getAvailableLayerNames()
Gets the list of available layer names on the database |
ArcSDEConnectionConfig |
getConfig()
DOCUMENT ME! |
int |
getInUseCount()
Number of active sessions. |
int |
getPoolSize()
returns the number of actual connections held by this connection pool. |
ISession |
getSession()
Grab a session from the pool, this session is the responsibility of the calling code and must be closed after use. |
ISession |
getSession(Transaction transaction)
Retrieve the connection for the provided transaction. |
boolean |
isClosed()
Returns whether this pool is closed |
String |
toString()
|
Methods inherited from class Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Level INFO_LOG_LEVEL
public static final int DEFAULT_CONNECTIONS
public static final int DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_WAIT_TIME
protected ArcSDEConnectionConfig config
protected GenericObjectPool pool
Constructor Detail |
---|
protected SessionPool(ArcSDEConnectionConfig config) throws IOException
config
config
- holds connection options such as server, user and password, as well as tuning
options as maximum number of connections allowed
IOException
- If connection could not be established
NullPointerException
- If config is nullMethod Detail |
---|
protected SessionPool.SeConnectionFactory createConnectionFactory()
ISession
instances for the pool.
Subclass may overide to customize this behaviour.
public int getPoolSize()
public void close()
public boolean isClosed()
protected void finalize()
finalize
in class Object
public int getAvailableCount()
public int getInUseCount()
public ISession getSession(Transaction transaction) throws IOException
The connection is held open until while the transaction is underway. A a Transaction.State is registered for this SessionPool in order to hold the session.
transaction
-
IOException
public ISession getSession() throws DataSourceException, UnavailableArcSDEConnectionException
DataSourceException
- If we could not get a connection
UnavailableArcSDEConnectionException
- If we are out of connections
IllegalStateException
- If pool has been closed.public List<String> getAvailableLayerNames() throws IOException
List<String>
with the registered featureclasses on the ArcSDE
database
DataSourceException
IOException
public ArcSDEConnectionConfig getConfig()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |