站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档

ManagedConnection (JBoss J2EE API) - JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档


javax.resource.spi
Interface ManagedConnection


public interface ManagedConnection

A ManagedConnection instance represents a connection to the underlying recource. A ManagedConnection provides access to the two transaction interfaces, XAResource and LocalTransaction. These interfaces are used to manage transactions on the resource.


Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Adds a connection event listener
 void associateConnection(Object connection)
          Associates a new application level connection handle with the connection.
 void cleanup()
          Application server calls this to force cleanup of connection.
 void destroy()
          Destroys the connection to the underlying resource.
 Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
          Creates a new connection handle for the underlying connection.
 LocalTransaction getLocalTransaction()
          Returns a LocalTransaction instance.
 PrintWriter getLogWriter()
          Gets the logwriter for this instance.
 ManagedConnectionMetaData getMetaData()
          Gets metadata inormation for this instances underlying resource manager instance.
 XAResource getXAResource()
          Returns an XAResource instance.
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes a connection event listener
 void setLogWriter(PrintWriter out)
          Sets the logwriter for this instance.
 

Method Detail

getConnection

public Object getConnection(Subject subject,
                            ConnectionRequestInfo cxRequestInfo)
                     throws ResourceException
Creates a new connection handle for the underlying connection.

Parameters:
subject - the subject
cxRequestInfo - the connection request info
Throws:
ResourceException - for a generic error
ResourceAdapterInternalException - for an internal error in the resource adapter
SecurityException - for a security problem
CommException - for a communication failure with the EIS
EISSystemException - for an error from the EIS

destroy

public void destroy()
             throws ResourceException
Destroys the connection to the underlying resource.

Throws:
ResourceException - for a generic error
IllegalStateException - if the connection is not a legal state for destruction

cleanup

public void cleanup()
             throws ResourceException
Application server calls this to force cleanup of connection.

Throws:
ResourceException - for a generic error
ResourceAdapterInternalException - for an internal error in the resource adapter
IllegalStateException - if the connection is not a legal state for cleanup

associateConnection

public void associateConnection(Object connection)
                         throws ResourceException
Associates a new application level connection handle with the connection.

Parameters:
connection - the connection
Throws:
ResourceException - for a generic error
IllegalStateException - for an illegal state
ResourceAdapterInternalException - for an internal error in the resource adapter

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Adds a connection event listener

Parameters:
listener - the listener

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Removes a connection event listener

Parameters:
listener - the listener

getXAResource

public XAResource getXAResource()
                         throws ResourceException
Returns an XAResource instance.

Returns:
the XAResource
Throws:
ResourceException - for a generic error
NotSupportedException - if not supported
ResourceAdapterInternalException - for an internal error in the resource adapter

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Returns a LocalTransaction instance.

Returns:
the local transaction
Throws:
ResourceException - for a generic error
NotSupportedException - if not supported
ResourceAdapterInternalException - for an internal error in the resource adapter

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException
Gets metadata inormation for this instances underlying resource manager instance.

Returns:
the managed connection meta data
Throws:
ResourceException - for a generic error
NotSupportedException - if not supported

getLogWriter

public PrintWriter getLogWriter()
                         throws ResourceException
Gets the logwriter for this instance.

Returns:
the log writer
Throws:
ResourceException - for a generic error

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws ResourceException
Sets the logwriter for this instance.

Parameters:
out - the writer
Throws:
ResourceException - for a generic error
ResourceAdapterInternalException - for an internal error in the resource adapter


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.