se.kmr.scam.local.pool
Class PoolEntry

java.lang.Object
  extended byse.kmr.scam.local.pool.PoolEntry

public class PoolEntry
extends Object

A wrapper class that holds a Connection. This class keeps track of the time the connection was created, how often it has been used, and its current allocation state.

Version:
$Revision: 1.4 $
See Also:
ConnectionPool, Connection

Field Summary
static int AVAILABLE
          The state in which the entry is available for allocation
static int IN_USE
          The state which an entry has when it is currently allocated to a client.
static DateFormat timeFormat
           
 
Constructor Summary
PoolEntry(Connection con)
          Creates a new pool entry containing the specified connection
 
Method Summary
 void allocate()
          Changes the entry state to IN_USE and increments the times used counter.
 void close()
          Closes the underlying resource.
 Connection getConnection()
          Returns the connection
 long getCreationTime()
          Returns the creation time in milliseconds
 int getHandle()
          Returns the entry's handle, which is a sequentially assigned number that uniquely identifies this entry.
 int getState()
          Returns the allocation state of the entry.
 int getTimesUsed()
          Returns the number of times the resource has been used
 boolean isValid()
          Returns true if the connection is still valid
 void setState(int newState)
          Sets the entry's state
 String toString()
          Returns the entry as a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timeFormat

public static final DateFormat timeFormat

AVAILABLE

public static final int AVAILABLE
The state in which the entry is available for allocation

See Also:
Constant Field Values

IN_USE

public static final int IN_USE
The state which an entry has when it is currently allocated to a client.

See Also:
Constant Field Values
Constructor Detail

PoolEntry

public PoolEntry(Connection con)
Creates a new pool entry containing the specified connection

Parameters:
con - the connection
Method Detail

isValid

public boolean isValid()
Returns true if the connection is still valid


getConnection

public Connection getConnection()
Returns the connection


getCreationTime

public long getCreationTime()
Returns the creation time in milliseconds


getTimesUsed

public int getTimesUsed()
Returns the number of times the resource has been used


allocate

public void allocate()
Changes the entry state to IN_USE and increments the times used counter.


close

public void close()
Closes the underlying resource.


getState

public int getState()
Returns the allocation state of the entry.


setState

public void setState(int newState)
Sets the entry's state


getHandle

public int getHandle()
Returns the entry's handle, which is a sequentially assigned number that uniquely identifies this entry.


toString

public String toString()
Returns the entry as a string



Copyright © 2003 SCAM. All Rights Reserved.