org.logicalcobwebs.proxool
Class ConnectionInfo

java.lang.Object
  extended by org.logicalcobwebs.proxool.ConnectionInfo
All Implemented Interfaces:
java.lang.Comparable, ConnectionInfoIF

 class ConnectionInfo
extends java.lang.Object
implements ConnectionInfoIF

Implementation of ConnectionInfoIF. Unlike ConnectionPool it is frozen and will not change. Used with a snapshot

Since:
Proxool 0.7
Version:
$Revision: 1.8 $, $Date: 2005/10/07 08:18:23 $
Author:
bill, $Author: billhorsman $ (current maintainer)

Field Summary
private  long age
           
private  java.util.Date birthDate
           
private  java.lang.String delegateDriver
           
private  java.lang.String delegateHashcode
           
private  java.lang.String delegateUrl
           
private  long id
           
private  int mark
           
private  java.lang.String proxyHashcode
           
private  java.lang.String requester
           
private  java.util.List sqlCalls
           
private  int status
           
private  long timeLastStartActive
           
private  long timeLastStopActive
           
 
Fields inherited from interface org.logicalcobwebs.proxool.ConnectionInfoIF
MARK_FOR_EXPIRY, MARK_FOR_USE, STATUS_ACTIVE, STATUS_AVAILABLE, STATUS_NULL, STATUS_OFFLINE
 
Constructor Summary
ConnectionInfo()
           
 
Method Summary
 void addSqlCall(java.lang.String sqlCall)
           
 int compareTo(java.lang.Object o)
          Compares using getId()
 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.lang.String getDelegateDriver()
           
 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
 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.
 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).
 void setAge(long age)
           
 void setBirthDate(java.util.Date birthDate)
           
 void setDelegateDriver(java.lang.String delegateDriver)
           
 void setDelegateHashcode(java.lang.String delegateHashcode)
           
 void setDelegateUrl(java.lang.String delegateUrl)
           
 void setId(long id)
           
 void setMark(int mark)
           
 void setProxyHashcode(java.lang.String proxyHashcode)
           
 void setRequester(java.lang.String requester)
           
 void setStatus(int status)
           
 void setTimeLastStartActive(long timeLastStartActive)
           
 void setTimeLastStopActive(long timeLastStopActive)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

birthDate

private java.util.Date birthDate

age

private long age

id

private long id

mark

private int mark

status

private int status

timeLastStartActive

private long timeLastStartActive

timeLastStopActive

private long timeLastStopActive

requester

private java.lang.String requester

delegateDriver

private java.lang.String delegateDriver

delegateUrl

private java.lang.String delegateUrl

proxyHashcode

private java.lang.String proxyHashcode

delegateHashcode

private java.lang.String delegateHashcode

sqlCalls

private java.util.List sqlCalls
Constructor Detail

ConnectionInfo

ConnectionInfo()
Method Detail

getBirthDate

public java.util.Date getBirthDate()
Description copied from interface: ConnectionInfoIF
Like ConnectionInfoIF.getBirthTime() but in Date format

Specified by:
getBirthDate in interface ConnectionInfoIF
Returns:
birthDate

getBirthTime

public long getBirthTime()
Description copied from interface: ConnectionInfoIF
The time that this connection was created. The number of milliseconds since midnight, January 1, 1970 UTC.

Specified by:
getBirthTime in interface ConnectionInfoIF

setBirthDate

public void setBirthDate(java.util.Date birthDate)

getAge

public long getAge()
Description copied from interface: ConnectionInfoIF
The age in millseconds since this connection was built

Specified by:
getAge in interface ConnectionInfoIF

setAge

public void setAge(long age)

getId

public long getId()
Description copied from interface: ConnectionInfoIF
A unique ID for this connection

Specified by:
getId in interface ConnectionInfoIF

setId

public void setId(long id)

getMark

public int getMark()
Description copied from interface: ConnectionInfoIF
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. So we mark it instead and when it stops being active we can perform the necessary operation. The only thing we do at the moment is expire the connection (if it is too old for instance). And this will happen if the housekeeper decides it should but the connection is still active.

Specified by:
getMark in interface ConnectionInfoIF

setMark

public void setMark(int mark)

getStatus

public int getStatus()
Description copied from interface: ConnectionInfoIF
The status of the connection. Can be either: null, available, active or offline.

Specified by:
getStatus in interface ConnectionInfoIF

setStatus

public void setStatus(int status)

getTimeLastStartActive

public long getTimeLastStartActive()
Description copied from interface: ConnectionInfoIF
When this connection was last given out. The number of milliseconds since midnight, January 1, 1970 UTC.

Specified by:
getTimeLastStartActive in interface ConnectionInfoIF

setTimeLastStartActive

public void setTimeLastStartActive(long timeLastStartActive)

getTimeLastStopActive

public long getTimeLastStopActive()
Description copied from interface: ConnectionInfoIF
When this connection was last given back (or zero if it is still active). The number of milliseconds since midnight, January 1, 1970 UTC.

Specified by:
getTimeLastStopActive in interface ConnectionInfoIF

setTimeLastStopActive

public void setTimeLastStopActive(long timeLastStopActive)

getRequester

public java.lang.String getRequester()
Description copied from interface: ConnectionInfoIF
The name of the thread that asked for this connection.

Specified by:
getRequester in interface ConnectionInfoIF

setRequester

public void setRequester(java.lang.String requester)

getDelegateDriver

public java.lang.String getDelegateDriver()

setDelegateDriver

public void setDelegateDriver(java.lang.String delegateDriver)

getDelegateUrl

public java.lang.String getDelegateUrl()
Description copied from interface: ConnectionInfoIF
The URL that this connection is using (the definition might have changed since this connection was built).

Specified by:
getDelegateUrl in interface ConnectionInfoIF
Returns:
delegateUrl

setDelegateUrl

public void setDelegateUrl(java.lang.String delegateUrl)

getProxyHashcode

public java.lang.String getProxyHashcode()
Description copied from interface: ConnectionInfoIF
The hashcode (in hex) of the ProxyConnection object. This uniquely identifies this proxy connection.

Specified by:
getProxyHashcode in interface ConnectionInfoIF
Returns:
proxyHashcode

setProxyHashcode

public void setProxyHashcode(java.lang.String proxyHashcode)

getDelegateHashcode

public java.lang.String getDelegateHashcode()
Description copied from interface: ConnectionInfoIF
The hashcode (in hex) of the delegate connection object. This uniquely identifies the underlying connection.

Specified by:
getDelegateHashcode in interface ConnectionInfoIF
Returns:
delegateHashcode

setDelegateHashcode

public void setDelegateHashcode(java.lang.String delegateHashcode)

compareTo

public int compareTo(java.lang.Object o)
Compares using getId()

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - must be another ConnectionInfoIF implementation
Returns:
the comparison
See Also:
Comparable.compareTo(Object)

getSqlCalls

public java.lang.String[] getSqlCalls()
Description copied from interface: ConnectionInfoIF
A log of the last SQL used on this connection. Only populated if ConnectionPoolDefinitionIF.isTrace() is enabled.

Specified by:
getSqlCalls in interface ConnectionInfoIF
Returns:
the most recent SQL to be used

addSqlCall

public void addSqlCall(java.lang.String sqlCall)