Package com.kheops.jmap.db
Class SdeConnectionPool
java.lang.Object
com.kheops.util.KObjectPool
com.kheops.jmap.db.SdeConnectionPool
- All Implemented Interfaces:
KSchedulerClient
This class manages a pool of ArcSDE connections. A pool has an initial size but
can automatically grow if necessary. Users of a connection pool use the
method
borrowConnection to get exclusive use of an SDE
connection and returnConnection to return the connection in the
pool and thus make it available for others. Optionally, the connections can
be recycled if they are inactive for a certain period of time.-
Field Summary
Fields inherited from class com.kheops.util.KObjectPool
cleanupPeriod, recyclePeriod, shrinkTime, TIMEOUT_UNDEFINED, TIMEOUT_UNLIMITED -
Constructor Summary
ConstructorsConstructorDescriptionSdeConnectionPool(SdeConnectionPoolInfo sdeConnectionPoolInfo) Creates a new connection pool instance. -
Method Summary
Modifier and TypeMethodDescriptioncom.esri.sde.sdk.client.SeConnectionBorrows a connection from the pool for exclusive use until it is returned by calling the methodreturnConnection.com.esri.sde.sdk.client.SeConnectionborrowConnection(long timeout, TimeUnit unit) Borrows a connection from the pool for exclusive use until it is returned by calling the methodreturnConnection.create()Should not be called.voidShould not be called.protected intgetId()longintprotected longprotected voidbooleanvoidreturnConnection(com.esri.sde.sdk.client.SeConnection c) Returns a connection to the poll that was obtained using the methodborrowConnection.voidsetLastException(Exception lastException) This method is used to store the last exception thrown.voidsetRecyclePeriod(long recyclePeriod) voidsetStatus(int status) booleanShould not be called.Methods inherited from class com.kheops.util.KObjectPool
apply, checkIn, checkOut, checkOut, close, createUnlockedInstance, getDefaultTimeout, getMonitoringInfo, getPoolMaximumSize, getPoolSize, getPoolUsageCount, getPoolUsagePeak, initialize, initialize, initialize, reset, resourceAdded, schCallback, setDefaultTimeout, setPoolMaximumSize, setPoolMinimumSize
-
Constructor Details
-
SdeConnectionPool
Creates a new connection pool instance.- Parameters:
sdeConnectionPoolInfo- the SdeConnectionPoolInfo instance associated with this SdeConnectionPool- See Also:
-
-
Method Details
-
create
Should not be called.- Specified by:
createin classKObjectPool- Returns:
- a new object (Connection)
- Throws:
Exception
-
validate
Should not be called.- Specified by:
validatein classKObjectPool- Parameters:
o- object (Connection) to validate- Returns:
- true if valid
-
expire
Should not be called.- Specified by:
expirein classKObjectPool- Parameters:
o- object (Connection) to close
-
borrowConnection
Borrows a connection from the pool for exclusive use until it is returned by calling the methodreturnConnection.- Returns:
- a database connection
- Throws:
Exception
-
borrowConnection
public com.esri.sde.sdk.client.SeConnection borrowConnection(long timeout, TimeUnit unit) throws Exception Borrows a connection from the pool for exclusive use until it is returned by calling the methodreturnConnection.- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- a database connection
-
returnConnection
public void returnConnection(com.esri.sde.sdk.client.SeConnection c) Returns a connection to the poll that was obtained using the methodborrowConnection. This method MUST ABSOLUTELY be called when the connection not needed anymore otherwise it will stay unavailable for ever for other users.- Parameters:
c- the corresponding connection
-
getId
protected int getId()- Overrides:
getIdin classKObjectPool
-
internalErrorOccurred
- Overrides:
internalErrorOccurredin classKObjectPool
-
getLastException
-
setLastException
This method is used to store the last exception thrown.- Parameters:
lastException- an Exception to be store in this object
-
getStatus
public int getStatus()- Returns:
- Returns the status.
-
setStatus
public void setStatus(int status) -
getRecyclePeriod
public long getRecyclePeriod() -
setRecyclePeriod
public void setRecyclePeriod(long recyclePeriod) -
getSdePoolInfo
-
getSystemDefaultTimeout
protected long getSystemDefaultTimeout()- Overrides:
getSystemDefaultTimeoutin classKObjectPool
-
isInactive
public boolean isInactive()
-