com.ibatis.common.jdbc
Class SimpleDataSource.SimplePooledConnection

java.lang.Object
  extended bycom.ibatis.common.jdbc.SimpleDataSource.SimplePooledConnection
All Implemented Interfaces:
java.lang.reflect.InvocationHandler
Enclosing class:
SimpleDataSource

private static class SimpleDataSource.SimplePooledConnection
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

--------------------------------------------------------------------------------------- SimplePooledConnection ---------------------------------------------------------------------------------------


Field Summary
private  long checkoutTimestamp
           
private static java.lang.String CLOSE
           
private  int connectionTypeCode
           
private  long createdTimestamp
           
private  SimpleDataSource dataSource
           
private  int hashCode
           
private static java.lang.Class[] IFACES
           
private  long lastUsedTimestamp
           
private  java.sql.Connection proxyConnection
           
private  java.sql.Connection realConnection
           
private  boolean valid
           
 
Constructor Summary
SimpleDataSource.SimplePooledConnection(java.sql.Connection connection, SimpleDataSource dataSource)
          Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in
 
Method Summary
 boolean equals(java.lang.Object obj)
          Allows comparing this connection to another
 long getAge()
           
 long getCheckoutTime()
           
 long getCheckoutTimestamp()
           
 int getConnectionTypeCode()
           
 long getCreatedTimestamp()
           
 long getLastUsedTimestamp()
           
 java.sql.Connection getProxyConnection()
           
 java.sql.Connection getRealConnection()
           
 int getRealHashCode()
          Gets the hashcode of the real connection (or 0 if it is null)
 long getTimeElapsedSinceLastUse()
           
private  java.sql.Connection getValidConnection()
           
 int hashCode()
           
 void invalidate()
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Required for InvocationHandler inplementaion.
 boolean isValid()
          Method to see if the connection is usable
 void setCheckoutTimestamp(long timestamp)
           
 void setConnectionTypeCode(int connectionTypeCode)
           
 void setCreatedTimestamp(long createdTimestamp)
           
 void setLastUsedTimestamp(long lastUsedTimestamp)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSE

private static final java.lang.String CLOSE
See Also:
Constant Field Values

IFACES

private static final java.lang.Class[] IFACES

hashCode

private int hashCode

dataSource

private SimpleDataSource dataSource

realConnection

private java.sql.Connection realConnection

proxyConnection

private java.sql.Connection proxyConnection

checkoutTimestamp

private long checkoutTimestamp

createdTimestamp

private long createdTimestamp

lastUsedTimestamp

private long lastUsedTimestamp

connectionTypeCode

private int connectionTypeCode

valid

private boolean valid
Constructor Detail

SimpleDataSource.SimplePooledConnection

public SimpleDataSource.SimplePooledConnection(java.sql.Connection connection,
                                               SimpleDataSource dataSource)
Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in

Parameters:
connection - - the connection that is to be presented as a pooled connection
dataSource - - the dataSource that the connection is from
Method Detail

invalidate

public void invalidate()

isValid

public boolean isValid()
Method to see if the connection is usable

Returns:
True if the connection is usable

getRealConnection

public java.sql.Connection getRealConnection()

getProxyConnection

public java.sql.Connection getProxyConnection()

getRealHashCode

public int getRealHashCode()
Gets the hashcode of the real connection (or 0 if it is null)

Returns:
The hashcode of the real connection (or 0 if it is null)

getConnectionTypeCode

public int getConnectionTypeCode()

setConnectionTypeCode

public void setConnectionTypeCode(int connectionTypeCode)

getCreatedTimestamp

public long getCreatedTimestamp()

setCreatedTimestamp

public void setCreatedTimestamp(long createdTimestamp)

getLastUsedTimestamp

public long getLastUsedTimestamp()

setLastUsedTimestamp

public void setLastUsedTimestamp(long lastUsedTimestamp)

getTimeElapsedSinceLastUse

public long getTimeElapsedSinceLastUse()

getAge

public long getAge()

getCheckoutTimestamp

public long getCheckoutTimestamp()

setCheckoutTimestamp

public void setCheckoutTimestamp(long timestamp)

getCheckoutTime

public long getCheckoutTime()

getValidConnection

private java.sql.Connection getValidConnection()

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)
Allows comparing this connection to another

Parameters:
obj - - the other connection to test for equality
See Also:
Object.equals(java.lang.Object)

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Required for InvocationHandler inplementaion.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - - not used
method - - the method to be executed
args - - the parameters to be passed to the method
Throws:
java.lang.Throwable
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])