Class SdeConnectionPool

java.lang.Object
com.kheops.util.KObjectPool
com.kheops.jmap.db.SdeConnectionPool
All Implemented Interfaces:
KSchedulerClient

public class SdeConnectionPool extends KObjectPool
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.
  • Constructor Details

    • SdeConnectionPool

      public SdeConnectionPool(SdeConnectionPoolInfo sdeConnectionPoolInfo)
      Creates a new connection pool instance.
      Parameters:
      sdeConnectionPoolInfo - the SdeConnectionPoolInfo instance associated with this SdeConnectionPool
      See Also:
  • Method Details

    • create

      public Object create() throws Exception
      Should not be called.
      Specified by:
      create in class KObjectPool
      Returns:
      a new object (Connection)
      Throws:
      Exception
    • validate

      public boolean validate(Object o)
      Should not be called.
      Specified by:
      validate in class KObjectPool
      Parameters:
      o - object (Connection) to validate
      Returns:
      true if valid
    • expire

      public void expire(Object o)
      Should not be called.
      Specified by:
      expire in class KObjectPool
      Parameters:
      o - object (Connection) to close
    • borrowConnection

      public com.esri.sde.sdk.client.SeConnection borrowConnection() throws Exception
      Borrows a connection from the pool for exclusive use until it is returned by calling the method returnConnection.
      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 method returnConnection.
      Parameters:
      timeout - the maximum time to wait
      unit - 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 method borrowConnection. 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:
      getId in class KObjectPool
    • internalErrorOccurred

      protected void internalErrorOccurred(Exception e)
      Overrides:
      internalErrorOccurred in class KObjectPool
    • getLastException

      public Exception getLastException()
    • setLastException

      public void setLastException(Exception lastException)
      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

      public SdeConnectionPoolInfo getSdePoolInfo()
    • getSystemDefaultTimeout

      protected long getSystemDefaultTimeout()
      Overrides:
      getSystemDefaultTimeout in class KObjectPool
    • isInactive

      public boolean isInactive()