|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.connector.ManagedConnectionImpl
public class ManagedConnectionImpl
A ManagedConnectionImpl
instance wraps a physical connection
to an underlying JORAM server, and provides "handles" for handling this
physical connection.
Field Summary | |
---|---|
private javax.jms.XAConnection |
cnx
Physical connection to the JORAM server. |
private java.util.Vector |
handles
Vector of connection handles. |
private int |
hashCode
hashCode |
(package private) java.lang.String |
hostName
Underlying JORAM server host name. |
private java.util.Vector |
listeners
Vector of condition event listeners. |
private ManagedConnectionMetaDataImpl |
metaData
Connection meta data. |
(package private) java.lang.String |
mode
Messaging mode (PTP or PubSub or Unified). |
private java.io.PrintWriter |
out
Out stream for error logging and tracing. |
private JoramAdapter |
ra
Central adapter authority. |
(package private) int |
serverPort
Underlying JORAM server port number. |
(package private) javax.jms.Session |
session
Unique session for the use of managed components, involved in local or distributed transactions. |
private boolean |
startedLocalTx
true if a local transaction has been started. |
(package private) java.lang.String |
userName
User identification. |
private boolean |
valid
true if the connection is valid. |
Constructor Summary | |
---|---|
ManagedConnectionImpl(JoramAdapter ra,
javax.jms.XAConnection cnx,
java.lang.String hostName,
int serverPort,
java.lang.String userName)
Creates a ManagedConnectionImpl instance wrapping a
physical connection to the underlying JORAM server. |
Method Summary | |
---|---|
void |
addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a connection event listener. |
void |
associateConnection(java.lang.Object connection)
Dissociates a given connection handle and associates it to this managed connection. |
void |
begin()
Notifies that the local transaction is beginning. |
void |
cleanup()
Invalidates the created handles and prepares the physical connection to be put back into a connection pool. |
(package private) void |
closeHandle(OutboundConnection handle)
Notifies of the closing of one of the connection handles. |
void |
commit()
Commits the local transaction. |
void |
destroy()
Destroys the physical connection to the underlying JORAM server. |
boolean |
equals(java.lang.Object o)
Compares ManagedConnectionImpl instances according to their
server and user identification parameters. |
java.lang.Object |
getConnection(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Returns a new OutboundConnection instance for handling the
physical connection. |
javax.resource.spi.LocalTransaction |
getLocalTransaction()
Returns this managed connection instance as a LocalTransaction instance for managing local transactions. |
java.io.PrintWriter |
getLogWriter()
Gets the log writer for this ManagedConnectionImpl
instance. |
javax.resource.spi.ManagedConnectionMetaData |
getMetaData()
Returns the metadata information for the underlying JORAM server. |
javax.transaction.xa.XAResource |
getXAResource()
Provides a XAResource instance for managing distributed
transactions. |
int |
hashCode()
Returns a code based on the JORAM server and user identification parameters. |
(package private) boolean |
isValid()
Returns false if the wrapped physical connection has been
lost or destroyed, true if it is still valid. |
(package private) boolean |
matches(java.lang.String hostName,
int serverPort,
java.lang.String userName,
java.lang.String mode)
Returns true if this managed connection matches given
parameters. |
void |
onException(javax.jms.JMSException exc)
Notifies that the wrapped physical connection has been lost. |
void |
removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Removes a connection event listener. |
void |
rollback()
Rollsback the local transaction. |
void |
setLogWriter(java.io.PrintWriter out)
Sets the log writer for this ManagedConnectionImpl
instance. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private JoramAdapter ra
private javax.jms.XAConnection cnx
private java.util.Vector handles
private java.util.Vector listeners
private boolean startedLocalTx
true
if a local transaction has been started.
private ManagedConnectionMetaDataImpl metaData
private java.io.PrintWriter out
private boolean valid
true
if the connection is valid.
private int hashCode
java.lang.String hostName
int serverPort
java.lang.String mode
java.lang.String userName
javax.jms.Session session
Constructor Detail |
---|
ManagedConnectionImpl(JoramAdapter ra, javax.jms.XAConnection cnx, java.lang.String hostName, int serverPort, java.lang.String userName)
ManagedConnectionImpl
instance wrapping a
physical connection to the underlying JORAM server.
ra
- Central adapter authority.cnx
- Physical connection to the JORAM server.hostName
- JORAM server host name.serverPort
- JORAM server port number.userName
- User identification.Method Detail |
---|
public java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
OutboundConnection
instance for handling the
physical connection.
getConnection
in interface javax.resource.spi.ManagedConnection
javax.resource.spi.CommException
- If the wrapped physical connection is lost.
javax.resource.ResourceException
public void associateConnection(java.lang.Object connection) throws javax.resource.ResourceException
associateConnection
in interface javax.resource.spi.ManagedConnection
javax.resource.spi.CommException
- If the wrapped physical connection is lost.
javax.resource.ResourceException
- If the provided handle is invalid.public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
addConnectionEventListener
in interface javax.resource.spi.ManagedConnection
public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
removeConnectionEventListener
in interface javax.resource.spi.ManagedConnection
public javax.transaction.xa.XAResource getXAResource() throws javax.resource.ResourceException
XAResource
instance for managing distributed
transactions.
getXAResource
in interface javax.resource.spi.ManagedConnection
javax.resource.spi.CommException
- If the physical connection
is lost.
javax.resource.spi.IllegalStateException
- If the managed connection is
involved in a local
transaction.
javax.resource.spi.ResourceAdapterInternalException
- If the XA resource can't be
retrieved.
javax.resource.ResourceException
public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceException
LocalTransaction
instance for managing local transactions.
getLocalTransaction
in interface javax.resource.spi.ManagedConnection
javax.resource.spi.CommException
- If the physical connection is lost.
javax.resource.spi.IllegalStateException
- If the managed connection is
involved in a distributed
transaction.
javax.resource.spi.LocalTransactionException
- If the LocalTransaction resource
can't be created.
javax.resource.ResourceException
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceException
getMetaData
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- Never thrown.public void setLogWriter(java.io.PrintWriter out) throws javax.resource.ResourceException
ManagedConnectionImpl
instance.
setLogWriter
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- Never thrown.public java.io.PrintWriter getLogWriter() throws javax.resource.ResourceException
ManagedConnectionImpl
instance.
getLogWriter
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- Never thrown.public void cleanup() throws javax.resource.ResourceException
cleanup
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- Never thrown.public void destroy() throws javax.resource.ResourceException
destroy
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- Never thrown.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
ManagedConnectionImpl
instances according to their
server and user identification parameters.
equals
in class java.lang.Object
public void onException(javax.jms.JMSException exc)
onException
in interface javax.jms.ExceptionListener
public void begin() throws javax.resource.ResourceException
begin
in interface javax.resource.spi.LocalTransaction
javax.resource.spi.CommException
- If the wrapped physical connection
is lost.
javax.resource.spi.LocalTransactionException
- If a local transaction has already
begun.
javax.resource.ResourceException
public void commit() throws javax.resource.ResourceException
commit
in interface javax.resource.spi.LocalTransaction
javax.resource.spi.CommException
- If the wrapped physical connection
is lost.
javax.resource.spi.LocalTransactionException
- If the local transaction has not
begun, or if the commit fails.
javax.resource.ResourceException
public void rollback() throws javax.resource.ResourceException
rollback
in interface javax.resource.spi.LocalTransaction
javax.resource.spi.CommException
- If the wrapped physical connection
is lost.
javax.resource.spi.LocalTransactionException
- If the local transaction has not
begun, or if the rollback fails.
javax.resource.ResourceException
boolean matches(java.lang.String hostName, int serverPort, java.lang.String userName, java.lang.String mode)
true
if this managed connection matches given
parameters.
boolean isValid()
false
if the wrapped physical connection has been
lost or destroyed, true
if it is still valid.
void closeHandle(OutboundConnection handle)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |