public class ProxyConnection extends java.lang.Object implements ProxyConnectionIF
MARK_FOR_EXPIRY, MARK_FOR_USE, STATUS_ACTIVE, STATUS_AVAILABLE, STATUS_NULL, STATUS_OFFLINE| Modifier and Type | Method and Description |
|---|---|
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
|
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.
|
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) |
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() |
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object (probably another connection) that we
are being compared topublic boolean isClosed()
public ConnectionPoolDefinitionIF getDefinition()
getDefinition in interface ProxyConnectionIFpublic void registerClosedStatement(java.sql.Statement statement)
ProxyConnectionIFregisterClosedStatement in interface ProxyConnectionIFstatement - the statement that has just been closedProxyConnectionIF.registerClosedStatement(java.sql.Statement)public void reallyClose()
throws java.sql.SQLException
reallyClose in interface ProxyConnectionIFjava.sql.SQLException - if anything goes wrongpublic boolean isReallyClosed()
throws java.sql.SQLException
ProxyConnectionIFisReallyClosed in interface ProxyConnectionIFjava.sql.SQLException - if anything went wrongProxyConnectionIF.isReallyClosed()public void close()
throws java.sql.SQLException
ProxyConnectionIFclose in interface ProxyConnectionIFjava.sql.SQLExceptionProxyConnectionIF.close()public int getMark()
ConnectionInfoIFexpire 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.getMark in interface ConnectionInfoIFpublic int getStatus()
ConnectionInfoIFgetStatus in interface ConnectionInfoIFpublic boolean setStatus(int newStatus)
ProxyConnectionIFsetStatus in interface ProxyConnectionIFnewStatus - the status to change toProxyConnectionIF.setStatus(int)public boolean setStatus(int oldStatus,
int newStatus)
ProxyConnectionIFsetStatus in interface ProxyConnectionIFoldStatus - the expected existing status. if the existing
status is not this value then no change is made and false is returned.newStatus - the status to change toProxyConnectionIF.setStatus(int, int)public long getId()
ConnectionInfoIFgetId in interface ConnectionInfoIFpublic void setId(long id)
public long getBirthTime()
ConnectionInfoIFgetBirthTime in interface ConnectionInfoIFConnectionInfoIF.getBirthTime()public java.util.Date getBirthDate()
ConnectionInfoIFConnectionInfoIF.getBirthTime() but in Date formatgetBirthDate in interface ConnectionInfoIFConnectionInfoIF.getBirthDate()public long getAge()
ConnectionInfoIFgetAge in interface ConnectionInfoIFConnectionInfoIF.getAge()public void setBirthTime(long birthTime)
ConnectionInfoIF.getBirthTime()public long getTimeLastStartActive()
ConnectionInfoIFgetTimeLastStartActive in interface ConnectionInfoIFConnectionInfoIF.getTimeLastStartActive()public void setTimeLastStartActive(long timeLastStartActive)
public long getTimeLastStopActive()
ConnectionInfoIFgetTimeLastStopActive in interface ConnectionInfoIFConnectionInfoIF.getTimeLastStopActive()public void setTimeLastStopActive(long timeLastStopActive)
ConnectionInfoIF.getTimeLastStopActive()public java.lang.String getRequester()
ConnectionInfoIFgetRequester in interface ConnectionInfoIFConnectionInfoIF.getRequester()public void setRequester(java.lang.String requester)
setRequester in interface ProxyConnectionIFConnectionInfoIF.getRequester()public boolean isNull()
isNull in interface ProxyConnectionIFProxyConnectionIF.isNull()public boolean isAvailable()
isAvailable in interface ProxyConnectionIFProxyConnectionIF.isAvailable()public boolean isActive()
isActive in interface ProxyConnectionIFProxyConnectionIF.isActive()public boolean isOffline()
isOffline in interface ProxyConnectionIFProxyConnectionIF.isOffline()public void markForExpiry(java.lang.String reason)
ProxyConnectionIFmarkForExpiry in interface ProxyConnectionIFreason - why we are marking this connectionProxyConnectionIF.markForExpiry(java.lang.String)public boolean isMarkedForExpiry()
ProxyConnectionIFisMarkedForExpiry in interface ProxyConnectionIFProxyConnectionIF.isMarkedForExpiry()public java.lang.String getReasonForMark()
ProxyConnectionIFgetReasonForMark in interface ProxyConnectionIFProxyConnectionIF.getReasonForMark()public java.sql.Connection getConnection()
ProxyConnectionIFgetConnection in interface ProxyConnectionIFProxyConnectionIF.getConnection()public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.lang.String getDelegateUrl()
ConnectionInfoIFgetDelegateUrl in interface ConnectionInfoIFConnectionInfoIF.getDelegateUrl()public java.lang.String getProxyHashcode()
ConnectionInfoIFgetProxyHashcode in interface ConnectionInfoIFConnectionInfoIF.getProxyHashcode()public java.lang.String getDelegateHashcode()
ConnectionInfoIFgetDelegateHashcode in interface ConnectionInfoIFConnectionInfoIF.getDelegateHashcode()public int compareTo(java.lang.Object o)
getId()compareTo in interface java.lang.Comparableo - must be another ConnectionInfoIF implementationComparable.compareTo(Object)public java.lang.String[] getSqlCalls()
ConnectionInfoIFConnectionPoolDefinitionIF.isTrace()
is enabled.getSqlCalls in interface ConnectionInfoIFpublic java.lang.String getLastSqlCall()
ProxyConnectionIFConnectionInfoIF.getSqlCalls()getLastSqlCall in interface ProxyConnectionIFpublic int getReasonCode()
ProxyConnectionIFmarkedgetReasonCode in interface ProxyConnectionIFConnectionListenerIF.MAXIMUM_ACTIVE_TIME_EXPIRED,
ConnectionListenerIF.HOUSE_KEEPER_TEST_FAIL,
ConnectionListenerIF.FATAL_SQL_EXCEPTION_DETECTED,
ConnectionListenerIF.MANUAL_EXPIRY,
ConnectionListenerIF.MAXIMUM_CONNECTION_LIFETIME_EXCEEDED,
ConnectionListenerIF.RESET_FAIL,
ConnectionListenerIF.SHUTDOWN, or
ConnectionListenerIF.VALIDATION_FAILpublic void addSqlCall(java.lang.String sqlCall)