org.jminor.common.db
Interface PoolableConnection

All Known Subinterfaces:
DatabaseConnection
All Known Implementing Classes:
DatabaseConnectionImpl

public interface PoolableConnection

Defines a wrapper connection which can be pooled.


Method Summary
 void beginTransaction()
          Begins a transaction on this connection
 void commit()
          Performs a commit
 void commitTransaction()
          Performs a commit and ends the current transaction
 void disconnect()
          Disconnects this connection
 Connection getConnection()
           
 Database getDatabase()
           
 List<LogEntry> getLogEntries()
           
 MethodLogger getMethodLogger()
           
 long getPoolTime()
           
 int getRetryCount()
           
 User getUser()
           
 boolean isLoggingEnabled()
           
 boolean isTransactionOpen()
           
 boolean isValid()
           
 void rollback()
          Performs a rollback
 void rollbackTransaction()
          Performs a rollback and ends the current transaction
 void setLoggingEnabled(boolean enabled)
           
 void setPoolTime(long time)
          Sets the time this connection was checked into a connection pool
 void setRetryCount(int retryCount)
           
 

Method Detail

getConnection

Connection getConnection()
Returns:
the underlying connection object

getPoolTime

long getPoolTime()
Returns:
the time at which this connection was pooled

setPoolTime

void setPoolTime(long time)
Sets the time this connection was checked into a connection pool

Parameters:
time - the time this connection was pooled

setRetryCount

void setRetryCount(int retryCount)
Parameters:
retryCount - the number of retries used to retrieve this connection from the pool

getRetryCount

int getRetryCount()
Returns:
the number of retries required to retrieve this connection from the pool

isValid

boolean isValid()
Returns:
true if the connection is valid

beginTransaction

void beginTransaction()
Begins a transaction on this connection

Throws:
IllegalStateException - in case a transaction is already open

isTransactionOpen

boolean isTransactionOpen()
Returns:
true if a transaction is open

commitTransaction

void commitTransaction()
Performs a commit and ends the current transaction

Throws:
IllegalStateException - in case transaction is not open

rollbackTransaction

void rollbackTransaction()
Performs a rollback and ends the current transaction

Throws:
IllegalStateException - in case transaction is not open

commit

void commit()
            throws SQLException
Performs a commit

Throws:
SQLException - thrown if anything goes wrong during the execution
IllegalStateException - in case a transaction is open

rollback

void rollback()
              throws SQLException
Performs a rollback

Throws:
SQLException - thrown if anything goes wrong during the execution
IllegalStateException - in case a transaction is open

disconnect

void disconnect()
Disconnects this connection


getLogEntries

List<LogEntry> getLogEntries()
Returns:
the log entries

getMethodLogger

MethodLogger getMethodLogger()
Returns:
the MethodLogger being used by this db connection

setLoggingEnabled

void setLoggingEnabled(boolean enabled)
Parameters:
enabled - true to enable logging on this connection, false to disable

isLoggingEnabled

boolean isLoggingEnabled()
Returns:
true if logging is enabled, false otherwise

getUser

User getUser()
Returns:
the connection user

getDatabase

Database getDatabase()
Returns:
the database implementation this connection is based on