Connection (Java EE 5)

Java EE API


javax.resource.cci Interface Connection


public interface Connection


该 Connection 表示客户端用于访问底层物理连接的应用程序级句柄。与 Connection 实例关联的实际物理连接由 ManagedConnection 实例表示。

通过对 ConnectionFactory 实例使用 getConnection 方法,客户端可以获取 Connection 实例。连接可以与 0 个或多个 Interaction 实例关联。

英文文档:

A Connection represents an application-level handle that is used by a client to access the underlying physical connection. The actual physical connection associated with a Connection instance is represented by a ManagedConnection instance.

A client gets a Connection instance by using the getConnection method on a ConnectionFactory instance. A connection can be associated with zero or more Interaction instances.

Version:
0.8
Author:
Rahul Sharma
See Also:
ConnectionFactory, Interaction

Method Summary
 void
 Interaction
 LocalTransaction
 ConnectionMetaData
 ResultSetInfo
 

Method Detail

public Interaction createInteraction() throws ResourceException
创建一个与此 Connection 关联的 Interaction。Interaction 使应用程序能够执行 EIS 功能。
return Interaction 实例
ThrowsResourceException: 无法创建 Interaction
英文文档:

createInteraction

Interaction createInteraction()
                              throws ResourceException
Creates an Interaction associated with this Connection. An Interaction enables an application to execute EIS functions.

Returns:
Interaction instance
Throws:
ResourceException - Failed to create an Interaction

public LocalTransaction getLocalTransaction() throws ResourceException
返回一个 LocalTransaction 实例,该实例使组件能够在 Connection 上划分资源管理器本地事务。如果资源适配器不允许组件使用 LocalTransaction 接口在 Connection 上划分本地事务,则 getLocalTransaction 方法应该抛出 NotSupportedException。
return LocalTransaction 实例
ThrowsResourceException: 由于资源适配器错误而无法返回 LocalTransaction 实例
ThrowsNotSupportedException: 此 Connection 不支持划分资源管理器本地事务
See also javax.resource.cci.LocalTransaction
英文文档:

getLocalTransaction

LocalTransaction getLocalTransaction()
                                     throws ResourceException
Returns an LocalTransaction instance that enables a component to demarcate resource manager local transactions on the Connection. If a resource adapter does not allow a component to demarcate local transactions on an Connection using LocalTransaction interface, then the method getLocalTransaction should throw a NotSupportedException.

Returns:
LocalTransaction instance
Throws:
ResourceException - Failed to return a LocalTransaction instance because of a resource adapter error
NotSupportedException - Demarcation of Resource manager local transactions is not supported on this Connection
See Also:
LocalTransaction

public ConnectionMetaData getMetaData() throws ResourceException
获取有关通过活动连接表示的底层 EIS 实例的信息。
return 代表有关 EIS 实例的信息的 ConnectionMetaData 实例
ThrowsResourceException: 无法获取有关连接的 EIS 实例的信息。错误可能是资源适配器内部错误、特定于 EIS 的错误或者与通信有关的错误。
英文文档:

getMetaData

ConnectionMetaData getMetaData()
                               throws ResourceException
Gets the information on the underlying EIS instance represented through an active connection.

Returns:
ConnectionMetaData instance representing information about the EIS instance
Throws:
ResourceException - Failed to get information about the connected EIS instance. Error can be resource adapter-internal, EIS-specific or communication related.

public ResultSetInfo getResultSetInfo() throws ResourceException
获取连接的 EIS 实例所支持的 ResultSet 功能的有关信息。
return ResultSetInfo 实例
ThrowsResourceException: 无法获取与 ResultSet 有关的信息
ThrowsNotSupportedException: 不支持 ResultSet 功能
英文文档:

getResultSetInfo

ResultSetInfo getResultSetInfo()
                               throws ResourceException
Gets the information on the ResultSet functionality supported by a connected EIS instance.

Returns:
ResultSetInfo instance
Throws:
ResourceException - Failed to get ResultSet related information
NotSupportedException - ResultSet functionality is not supported

public void close() throws ResourceException
在应用程序级别关闭连接句柄。客户端不应该使用关闭的连接与 EIS 交互。
ThrowsResourceException: 如果关闭连接句柄失败,则抛出此异常。

对任何无效的连接调用 close(例如,对已经关闭的连接句柄调用 close)也应该抛出此异常。

英文文档:

close

void close()
           throws ResourceException
Initiates close of the connection handle at the application level. A client should not use a closed connection to interact with an EIS.

Throws:
ResourceException - Exception thrown if close on a connection handle fails.

Any invalid connection close invocation--example, calling close on a connection handle that is already closed--should also throw this exception.



Submit a bug or feature

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

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

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