velosurf.sql
Class PooledStatement

java.lang.Object
  extended by velosurf.sql.PooledStatement
All Implemented Interfaces:
RowHandler
Direct Known Subclasses:
PooledPreparedStatement, PooledSimpleStatement

public abstract class PooledStatement
extends java.lang.Object
implements RowHandler

This abstract class represents a pooled object.

It has two booleans : inUse and useOver (understand : usageOver).

The cycle of those two booleans is the following :

states (inUse - useOver) : (false-false) -> (true-false) -> (true-true) -> [delay] (false-false)

Author:
Claude Brisson

Field Summary
protected  java.util.List<java.lang.String> columnNames
          column names in natural order.
protected  ConnectionWrapper connection
          database connection.
private  boolean inUse
          is this object in use?
protected  java.sql.ResultSet resultSet
          result set.
private  long tagTime
          time tag.
private  boolean valid
          valid statement?
 
Constructor Summary
PooledStatement()
          build a new pooled object.
 
Method Summary
abstract  void close()
          close this pooled object.
abstract  ConnectionWrapper getConnection()
          get the connection used by this statement.
 long getTagTime()
          get the time tag of this pooled object.
 boolean isInUse()
          check whether this pooled object is in use.
 boolean isValid()
          check whether this pooled object is marked as valid or invalid.
 void notifyInUse()
          notify this object that it is in use.
 void notifyOver()
          notify this object that it is no more in use.
 void resetTagTime()
          reset the time tag.
 void setInvalid()
          definitely mark this statement as meant to be deleted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface velosurf.sql.RowHandler
get, keySet
 

Field Detail

tagTime

private long tagTime
time tag.


valid

private boolean valid
valid statement?


inUse

private boolean inUse
is this object in use?


connection

protected ConnectionWrapper connection
database connection.


resultSet

protected java.sql.ResultSet resultSet
result set.


columnNames

protected java.util.List<java.lang.String> columnNames
column names in natural order.

Constructor Detail

PooledStatement

public PooledStatement()
build a new pooled object.

Method Detail

getTagTime

public long getTagTime()
get the time tag of this pooled object.

Returns:
the time tag

resetTagTime

public void resetTagTime()
reset the time tag.


notifyInUse

public void notifyInUse()
notify this object that it is in use.


notifyOver

public void notifyOver()
notify this object that it is no more in use.


isInUse

public boolean isInUse()
check whether this pooled object is in use.

Returns:
whether this object is in use

isValid

public boolean isValid()
check whether this pooled object is marked as valid or invalid. (used in the recovery process)

Returns:
whether this object is in use

setInvalid

public void setInvalid()
definitely mark this statement as meant to be deleted.


getConnection

public abstract ConnectionWrapper getConnection()
get the connection used by this statement.

Returns:
the connection used by this statement

close

public abstract void close()
                    throws java.sql.SQLException
close this pooled object.

Throws:
java.sql.SQLException - when thrown by the database engine


~ooOoo~