org.jboss.minerva.pools
Class PoolEvent
java.lang.Object
|
+--java.util.EventObject
|
+--org.jboss.minerva.pools.PoolEvent
- All Implemented Interfaces:
- java.io.Serializable
- public class PoolEvent
- extends java.util.EventObject
An event caused by an object in a pool. The event indicates that the
object was used, closed, or had an error occur. The typical response is
to update the last used time in the pool for used events, and return the
object to the pool for closed or error events.
- Version:
- $Revision: 1.2 $
- Author:
- Aaron Mulder (ammulder@alumni.princeton.edu)
- See Also:
- Serialized Form
Field Summary |
static int |
OBJECT_CLOSED
The object has been closed and should be returned to the pool. |
static int |
OBJECT_ERROR
Indicates that an error occured with the object. |
static int |
OBJECT_USED
Indicates that the object was used, and its timestamp should be updated
accordingly (if the pool tracks timestamps). |
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
PoolEvent(java.lang.Object source,
int type)
Create a new event. |
Method Summary |
int |
getType()
Gets the event type. |
boolean |
isCatastrophic()
Gets whether an object error was so bad that the object should not
be reused by the pool. |
void |
setCatastrophic()
Marks this as an error so severe that the object should not be reused by
the pool. |
Methods inherited from class java.util.EventObject |
getSource, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
OBJECT_CLOSED
public static final int OBJECT_CLOSED
- The object has been closed and should be returned to the pool. Note this
is not a final sort of closing - the object must still be able to be
returned to the pool and reused.
OBJECT_ERROR
public static final int OBJECT_ERROR
- Indicates that an error occured with the object. The object will be
returned to the pool, since there will presumably be an exception
thrown that precludes the client from closing it or returning it
normally. This should not be used for final or destructive errors - the
object must stil be able to be returned to the pool and reused.
OBJECT_USED
public static final int OBJECT_USED
- Indicates that the object was used, and its timestamp should be updated
accordingly (if the pool tracks timestamps).
PoolEvent
public PoolEvent(java.lang.Object source,
int type)
- Create a new event.
- Parameters:
source
- The source must be the object that was returned from the
getObject method of the pool - the pool will use the source for
some purpose depending on the type, so it cannot be an arbitrary
object.type
- The event type.
getType
public int getType()
- Gets the event type.
- See Also:
OBJECT_CLOSED
,
OBJECT_USED
,
OBJECT_ERROR
isCatastrophic
public boolean isCatastrophic()
- Gets whether an object error was so bad that the object should not
be reused by the pool. This is meaningful for error events only.
setCatastrophic
public void setCatastrophic()
- Marks this as an error so severe that the object should not be reused by
the pool.
Copyright © 2000 The jBoss Organization. All Rights Reserved.