|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--anvil.database.PooledConnection
Abstract class wrapping connection objects.
| Field Summary | |
protected long |
closedAt
Closing timestamp. |
protected java.lang.Object |
connection
Connection object |
protected long |
createdAt
Creation timestamp. |
protected ConnectionPool |
myPool
Pool where this connections belongs into. |
protected java.lang.String |
name
Name of connection "[name_of_pool]-[count]". |
protected long |
releasedAt
Timestamp for last release. |
protected boolean |
reserved
Being reserved? |
protected long |
reservedAt
Timestamp for last reserve. |
protected int |
timeout
Timeout |
| Constructor Summary | |
PooledConnection(ConnectionPool myPool,
java.lang.String name,
java.lang.Object connection)
Creates the connection. |
|
| Method Summary | |
protected abstract void |
closeConnection()
|
boolean |
equals(java.lang.Object o)
|
long |
getClosingTime()
Timestamp of last close. |
java.lang.Object |
getConnection()
Gets the connection object. |
long |
getCreationTime()
Timestamp of creation time. |
java.lang.String |
getName()
Gets the name of connection. |
ConnectionPool |
getPool()
Gets the pool where connection belongs into. |
long |
getReleaseTime()
Timestamp of last release. |
long |
getReserveTime()
Timestamp of last reservation. |
boolean |
hasTimedOut()
Checks if the connection has timed out. |
boolean |
isAlive()
Checks if the connection is still alive. |
protected abstract boolean |
isConnectionClosed()
|
boolean |
isReserved()
Is this connection reserved? |
void |
release()
Releases the connection |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ConnectionPool myPool
protected java.lang.String name
protected java.lang.Object connection
protected int timeout
protected long createdAt
protected long closedAt
protected long reservedAt
protected long releasedAt
protected boolean reserved
| Constructor Detail |
public PooledConnection(ConnectionPool myPool,
java.lang.String name,
java.lang.Object connection)
myPool - Connection poolname - Name of connectionconnection - java.sql.Connection| Method Detail |
public java.lang.String getName()
public ConnectionPool getPool()
public boolean isReserved()
true if reserved, false otherwise.public long getCreationTime()
public long getClosingTime()
public long getReserveTime()
public long getReleaseTime()
public java.lang.Object getConnection()
protected abstract boolean isConnectionClosed()
throws java.lang.Exception
java.lang.Exception
protected abstract void closeConnection()
throws java.lang.Exception
java.lang.Exceptionpublic boolean isAlive()
java.sql.Connection has not yet
been closed, and maximum lifetime is not exceeded. However,
lifetime can be exceeded if connection is reserved.
true if alive, false otherwise.public boolean hasTimedOut()
true if timed out, false otherwise.public void release()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||