Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.logicalcobwebs.proxool.ProxyConnection
Fields inherited from interface org.logicalcobwebs.proxool.ConnectionInfoIF | |
MARK_FOR_EXPIRY , MARK_FOR_USE , STATUS_ACTIVE , STATUS_AVAILABLE , STATUS_NULL , STATUS_OFFLINE |
Constructor Summary | |
|
Method Summary | |
protected void |
|
void |
|
void |
|
int | |
boolean |
|
long |
|
Date | |
long | |
Connection | |
protected org.logicalcobwebs.proxool.ConnectionPool |
|
ConnectionPoolDefinitionIF |
|
String | |
String | |
long |
|
String |
|
int |
|
String | |
int |
|
String | |
String | |
String[] |
|
int |
|
long | |
long | |
boolean |
|
boolean | |
boolean |
|
boolean | |
boolean |
|
boolean | |
boolean | |
void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
void |
|
boolean |
|
boolean |
|
void |
|
void |
|
String |
|
protected ProxyConnection(Connection connection, long id, String delegateUrl, org.logicalcobwebs.proxool.ConnectionPool connectionPool, ConnectionPoolDefinitionIF definition, int status) throws SQLException
- Parameters:
connection
- the real connection that is usedid
- unique IDdelegateUrl
-connectionPool
- the pool it is a member ofdefinition
- the definition that was used to build it (could possibly be different from the one held in the connectionPool)status
-ConnectionInfoIF.STATUS_ACTIVE
,ConnectionInfoIF.STATUS_AVAILABLE
,STATUS_FORCE
,ConnectionInfoIF.STATUS_NULL
, orConnectionInfoIF.STATUS_OFFLINE
protected void addOpenStatement(Statement statement)
By calling this we can keep track of any statements that are left open when this connection is returned to the pool.
- Parameters:
statement
- the statement that we have just opened/created.
- See Also:
registerClosedStatement(Statement)
public void addSqlCall(String sqlCall)
public void close() throws SQLException
- Specified by:
- close in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.close()
public int compareTo(Object o)
Compares usinggetId()
- Parameters:
o
- must be anotherConnectionInfoIF
implementation
- Returns:
- the comparison
- See Also:
Comparable.compareTo(Object)
public boolean equals(Object obj)
Whether the underlying connections are equal
- Parameters:
obj
- the object (probably another connection) that we are being compared to
- Returns:
- whether they are the same
public long getAge()
- Specified by:
- getAge in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getAge()
public Date getBirthDate()
- Specified by:
- getBirthDate in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getBirthDate()
public long getBirthTime()
- Specified by:
- getBirthTime in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getBirthTime()
public Connection getConnection()
- Specified by:
- getConnection in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.getConnection()
protected org.logicalcobwebs.proxool.ConnectionPool getConnectionPool()
The ConnectionPool that this connection belongs to
- Returns:
- connectionPool
public ConnectionPoolDefinitionIF getDefinition()
Get the definition that was used to create this connection
- Specified by:
- getDefinition in interface ProxyConnectionIF
- Returns:
- definition
public String getDelegateHashcode()
- Specified by:
- getDelegateHashcode in interface ConnectionInfoIF
public String getDelegateUrl()
- Specified by:
- getDelegateUrl in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getDelegateUrl()
public long getId()
A unique ID for this connection
- Specified by:
- getId in interface ConnectionInfoIF
public String getLastSqlCall()
Get the most recent of all thegetSqlCalls()
- Specified by:
- getLastSqlCall in interface ProxyConnectionIF
- Returns:
- the SQL (could be a batch of SQLs)
public 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. 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 isexpire
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
public String getProxyHashcode()
- Specified by:
- getProxyHashcode in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getProxyHashcode()
public int getReasonCode()
Get the reason why this connection ismarked
- Specified by:
- getReasonCode in interface ProxyConnectionIF
- Returns:
ConnectionListenerIF.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
, orConnectionListenerIF.VALIDATION_FAIL
public String getReasonForMark()
- Specified by:
- getReasonForMark in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.getReasonForMark()
public String getRequester()
- Specified by:
- getRequester in interface ConnectionInfoIF
- See Also:
ConnectionInfoIF.getRequester()
public String[] getSqlCalls()
A log of the last SQL used on this connection. Only populated ifConnectionPoolDefinitionIF.isTrace()
is enabled.
- Specified by:
- getSqlCalls in interface ConnectionInfoIF
- Returns:
- the most recent SQL to be used
public long getTimeLastStartActive()
- Specified by:
- getTimeLastStartActive in interface ConnectionInfoIF
public long getTimeLastStopActive()
- Specified by:
- getTimeLastStopActive in interface ConnectionInfoIF
public boolean isActive()
- Specified by:
- isActive in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.isActive()
public boolean isAvailable()
- Specified by:
- isAvailable in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.isAvailable()
public boolean isClosed()
Whether this connection is available. (When you close the connection it doesn't really close, it just becomes available for others to use).
- Returns:
- true if the connection is not active
public boolean isMarkedForExpiry()
- Specified by:
- isMarkedForExpiry in interface ProxyConnectionIF
public boolean isNull()
- Specified by:
- isNull in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.isNull()
public boolean isOffline()
- Specified by:
- isOffline in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.isOffline()
public boolean isReallyClosed() throws SQLException
- Specified by:
- isReallyClosed in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.isReallyClosed()
public void markForExpiry(String reason)
- Specified by:
- markForExpiry in interface ProxyConnectionIF
protected void open()
public void reallyClose() throws SQLException
Close the connection for real
- Specified by:
- reallyClose in interface ProxyConnectionIF
public void registerClosedStatement(Statement statement)
- Specified by:
- registerClosedStatement in interface ProxyConnectionIF
public 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). We don't reset unless this has been called to avoid the overhead of unnecessary resetting.
- Parameters:
needToReset
- true if the connection might need resetting.
public void setRequester(String requester)
- Specified by:
- setRequester in interface ProxyConnectionIF
- See Also:
ConnectionInfoIF.getRequester()
public boolean setStatus(int newStatus)
- Specified by:
- setStatus in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.setStatus(int)
public boolean setStatus(int oldStatus, int newStatus)
- Specified by:
- setStatus in interface ProxyConnectionIF
- See Also:
ProxyConnectionIF.setStatus(int,int)
public void setTimeLastStartActive(long timeLastStartActive)
public void setTimeLastStopActive(long timeLastStopActive)
public String toString()
- See Also:
Object.toString