ConnectionEvent (Java EE 5)

Java EE API


javax.resource.spi Class ConnectionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by javax.resource.spi.ConnectionEvent
All Implemented Interfaces:
Serializable

public class ConnectionEvent
extends EventObject

Extends: java.util.EventObject

ConnectionEvent 类提供与连接有关的事件源的信息。ConnectionEvent 实例包含以下信息:
  • 连接事件的类型
  • 生成连接事件的 ManagedConnection 实例。从 ConnectionEvent.getSource 方法返回的 ManagedConnection 实例。
  • 与 ManagedConnection 实例关联的连接句柄;对于 CONNECTION_CLOSED 事件这是必需的,对于其他事件类型可选。
  • 还可以包含指示与连接有关的错误的异常。注意,异常用于 CONNECTION_ERROR_OCCURRED。

此类定义以下类型的事件通知:

  • CONNECTION_CLOSED
  • LOCAL_TRANSACTION_STARTED
  • LOCAL_TRANSACTION_COMMITTED
  • LOCAL_TRANSACTION_ROLLEDBACK
  • CONNECTION_ERROR_OCCURRED
英文文档:

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 Also:
ConnectionEventListener, Serialized Form

Field Summary
static int
static int
protected  int
static int
static int
static int
 
Fields inherited from class java.util.EventObject
 
Constructor Summary
 
Method Summary
 Object
 Exception
 int
 void
 
Methods inherited from class java.util.EventObject
 
Methods inherited from class java.lang.Object
 

Field Detail

英文文档:

CONNECTION_CLOSED

public static final int CONNECTION_CLOSED
Event notification that an application component has closed the connection

See Also:
Constant Field Values


英文文档:

LOCAL_TRANSACTION_STARTED

public static final int LOCAL_TRANSACTION_STARTED
Event notification that a Resource Manager Local Transaction was started on the connection

See Also:
Constant Field Values


英文文档:

LOCAL_TRANSACTION_COMMITTED

public static final int LOCAL_TRANSACTION_COMMITTED
Event notification that a Resource Manager Local Transaction was committed on the connection

See Also:
Constant Field Values


英文文档:

LOCAL_TRANSACTION_ROLLEDBACK

public static final int LOCAL_TRANSACTION_ROLLEDBACK
Event notification that a Resource Manager Local Transaction was rolled back on the connection

See Also:
Constant Field Values


英文文档:

CONNECTION_ERROR_OCCURRED

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.

See Also:
Constant Field Values


英文文档:

id

protected int id
Type of the event

Constructor Detail

public ConnectionEvent(ManagedConnection source, int eid)
构造一个 ConnectionEvent 对象。异常默认为 null。
source 作为事件源的 ManagedConnection
eid Connection 事件类型
英文文档:

ConnectionEvent

public ConnectionEvent(ManagedConnection source,
                       int eid)
Construct a ConnectionEvent object. Exception defaults to null.

Parameters:
source - ManagedConnection that is the source of the event
eid - type of the Connection event


public ConnectionEvent(ManagedConnection source, int eid, Exception exception)
构造一个 ConnectionEvent 对象。
source 作为事件源的 ManagedConnection
exception 将对应用程序抛出的异常
eid Connection 事件类型
英文文档:

ConnectionEvent

public ConnectionEvent(ManagedConnection source,
                       int eid,
                       Exception exception)
Construct a ConnectionEvent object.

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

Method Detail

public Object getConnectionHandle()
获取与 ManagedConnection 实例关联的连接句柄。用于 CONNECTION_CLOSED 事件。
return 连接句柄。可以为 null
英文文档:

getConnectionHandle

public Object getConnectionHandle()
Get the connection handle associated with the Managed Connection instance. Used for CONNECTION_CLOSED event.

Returns:
the connection handle. May be null

public void setConnectionHandle(Object connectionHandle)
设置连接句柄。用于 CONNECTION_CLOSED 事件
英文文档:

setConnectionHandle

public void setConnectionHandle(Object connectionHandle)
Set the connection handle. Used for CONNECTION_CLOSED event


public Exception getException()
获取异常。可以为 null。
return 要抛出的异常。
英文文档:

getException

public Exception getException()
Get the exception. May be null.

Returns:
the exception about to be thrown.

public int getId()
获取事件类型。
英文文档:

getId

public int getId()
Get the type of event



Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!