Class ProxyConnection

  • All Implemented Interfaces:
    java.lang.Comparable, ConnectionInfoIF, ProxyConnectionIF

    public class ProxyConnection
    extends java.lang.Object
    implements ProxyConnectionIF
    Manages a connection. This is wrapped up inside a...
    Since:
    Proxool 0.10
    Version:
    $Revision: 1.40 $, $Date: 2007/05/15 23:17:21 $
    Author:
    bill, $Author: billhorsman $ (current maintainer)
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ProxyConnection​(java.sql.Connection connection, long id, java.lang.String delegateUrl, org.logicalcobwebs.proxool.ConnectionPool connectionPool, ConnectionPoolDefinitionIF definition, int status)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addOpenStatement​(java.sql.Statement statement)
      By calling this we can keep track of any statements that are left open when this connection is returned to the pool.
      void addSqlCall​(java.lang.String sqlCall)  
      void close()
      Doesn't really close the connection, just puts it back in the pool.
      int compareTo​(java.lang.Object o)
      Compares using getId()
      boolean equals​(java.lang.Object obj)
      Whether the underlying connections are equal
      long getAge()
      The age in millseconds since this connection was built
      java.util.Date getBirthDate()
      Like ConnectionInfoIF.getBirthTime() but in Date format
      long getBirthTime()
      The time that this connection was created.
      java.sql.Connection getConnection()
      The real, delegate connection that we are using
      protected org.logicalcobwebs.proxool.ConnectionPool getConnectionPool()
      The ConnectionPool that this connection belongs to
      ConnectionPoolDefinitionIF getDefinition()
      Get the definition that was used to create this connection
      java.lang.String getDelegateHashcode()
      The hashcode (in hex) of the delegate connection object.
      java.lang.String getDelegateUrl()
      The URL that this connection is using (the definition might have changed since this connection was built).
      long getId()
      A unique ID for this connection
      java.lang.String getLastSqlCall()
      Get the most recent of all the ConnectionInfoIF.getSqlCalls()
      int getMark()
      Sometimes we want do something to a connection but can't because it is still active and we don't want to disrupt its use.
      java.lang.String getProxyHashcode()
      The hashcode (in hex) of the ProxyConnection object.
      int getReasonCode()
      Get the reason why this connection is marked
      java.lang.String getReasonForMark()
      Why this connection is marked (for instance, if a thread has marked it for expiry then it's nice to know why)
      java.lang.String getRequester()
      The name of the thread that asked for this connection.
      java.lang.String[] getSqlCalls()
      A log of the last SQL used on this connection.
      int getStatus()
      The status of the connection.
      long getTimeLastStartActive()
      When this connection was last given out.
      long getTimeLastStopActive()
      When this connection was last given back (or zero if it is still active).
      boolean isActive()  
      boolean isAvailable()  
      boolean isClosed()
      Whether this connection is available.
      boolean isMarkedForExpiry()
      Whether this connection is due for expiry
      boolean isNull()  
      boolean isOffline()  
      boolean isReallyClosed()
      Find out if the delegated connection is close.
      void markForExpiry​(java.lang.String reason)
      Mark this connection for expiry (destruction) as soon as it stops being active.
      protected void open()
      This gets called /just/ before a connection is served.
      void reallyClose()
      Close the connection for real
      void registerClosedStatement​(java.sql.Statement statement)
      Notify that a statement has been closed and won't need closing when the connection is returned to the poo.
      void setBirthTime​(long birthTime)  
      void setId​(long id)  
      protected void setNeedToReset​(boolean needToReset)
      The subclass should call this to indicate that a change has been made to the connection that might mean it needs to be reset (like setting autoCommit to false or something).
      void setRequester​(java.lang.String requester)  
      boolean setStatus​(int newStatus)
      Forces the new status regardless of the old state
      boolean setStatus​(int oldStatus, int newStatus)
      Changes the status and lets the ConnectionPool know so that it can keep count of how many connections are at each status.
      void setTimeLastStartActive​(long timeLastStartActive)  
      void setTimeLastStopActive​(long timeLastStopActive)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait