FileDocCategorySizeDatePackage
ConnectionEvent.javaAPI DocGlassfish v2 API5861Fri May 04 22:35:36 BST 2007javax.resource.spi

ConnectionEvent

public class ConnectionEvent extends EventObject
The ConnectionEvent class provides information about the source of a connection related event.A ConnectionEvent instance contains the following information:
  • Type of the connection event
  • ManagedConnection instance that generated the connection event. A ManagedConnection instance is returned from the method ConnectionEvent.getSource.
  • Connection handle associated with the ManagedConnection instance; required for the CONNECTION_CLOSED event and optional for the other event types.
  • Optionally, an exception indicating the connection related error. Note that exception is used for CONNECTION_ERROR_OCCURRED.

This class defines following types of event notifications:

  • CONNECTION_CLOSED
  • LOCAL_TRANSACTION_STARTED
  • LOCAL_TRANSACTION_COMMITTED
  • LOCAL_TRANSACTION_ROLLEDBACK
  • CONNECTION_ERROR_OCCURRED
version
0.5
author
Rahul Sharma
see
javax.resource.spi.ConnectionEventListener

Fields Summary
public static final int
CONNECTION_CLOSED
Event notification that an application component has closed the connection
public static final int
LOCAL_TRANSACTION_STARTED
Event notification that a Resource Manager Local Transaction was started on the connection
public static final int
LOCAL_TRANSACTION_COMMITTED
Event notification that a Resource Manager Local Transaction was committed on the connection
public static final int
LOCAL_TRANSACTION_ROLLEDBACK
Event notification that a Resource Manager Local Transaction was rolled back on the connection
public static final int
CONNECTION_ERROR_OCCURRED
Event notification that an error occurred on the connection. This event indicates that the ManagedConnection instance is now invalid and unusable.
private Exception
exception
Exception associated with the ConnectionEvent instance.
protected int
id
Type of the event
private Object
connectionHandle
Constructors Summary
public ConnectionEvent(ManagedConnection source, int eid)
Construct a ConnectionEvent object. Exception defaults to null.

param
source ManagedConnection that is the source of the event
param
eid type of the Connection event

    
  
                                                                       
       
    super(source);         
    this.id = eid;
  
public ConnectionEvent(ManagedConnection source, int eid, Exception exception)
Construct a ConnectionEvent object.

param
source ManagedConnection that is the source of the event
param
exception exception about to be thrown to the application
param
eid type of the Connection event

    super(source);  
    this.exception = exception;
    this.id = eid;
  
Methods Summary
public java.lang.ObjectgetConnectionHandle()
Get the connection handle associated with the Managed Connection instance. Used for CONNECTION_CLOSED event.

return
the connection handle. May be null

    return connectionHandle;
  
public java.lang.ExceptiongetException()
Get the exception. May be null.

return
the exception about to be thrown.

    return exception;
  
public intgetId()
Get the type of event

    return id;
  
public voidsetConnectionHandle(java.lang.Object connectionHandle)
Set the connection handle. Used for CONNECTION_CLOSED event

    this.connectionHandle = connectionHandle;