xmlBlaster 2.2.0 API

org.xmlBlaster.j2ee.k2
Class BlasterManagedConnection

java.lang.Object
  extended by org.xmlBlaster.j2ee.k2.BlasterManagedConnection
All Implemented Interfaces:
javax.resource.spi.ManagedConnection

public class BlasterManagedConnection
extends java.lang.Object
implements javax.resource.spi.ManagedConnection

ManagedConnection for xmlBlaster.

The way I have interpreted the spec it is possible for one ManagedConection to hold one physical connection and no more.

We now support connection sharing.

This is the old note about it: This might not be totaly spec compliant, since it does not support connection sharing. However, according to a mail on the Connector list from the lead spec writer, one way to be spec compliant without support for connection sharing is throwing an exception in getConnection if there already is one active. This will also happen in asociatConnection. This is the way it is done here. Comment: this is NOT the way it is implemented int JBoss, therefore we need to suppport connection sharing!

This mc now supports the session based login.


Field Summary
(package private)  Global clonedGlob
           
(package private)  boolean closed
           
private  java.util.Set handles
          Holds all current BlasterConnectionImpl handles.
(package private)  boolean isDestroyed
           
(package private)  java.util.Vector listeners
           
(package private)  java.io.PrintWriter logWriter
           
(package private)  BlasterManagedConnectionFactory mcf
           
(package private)  java.lang.String me
           
(package private)  I_XmlBlasterAccess physicalPipe
           
(package private)  java.lang.String pwd
           
(package private)  java.lang.String user
           
 
Constructor Summary
BlasterManagedConnection(BlasterManagedConnectionFactory mcf, java.lang.String user, java.lang.String pwd)
           
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
           
 void associateConnection(java.lang.Object obj)
          Move a handler from one mc to this one
 void cleanup()
          Cleans up the connection.
 void destroy()
          Destroy the physical connection
private  void destroyHandles()
          Destroy all handles.
private  void doLogin()
           
(package private)  I_XmlBlasterAccess getBlasterConnection()
           
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          Get the physical connection handler.
(package private)  I_XmlBlasterAccess getFailoverBlasterConnection()
          This is used both internaly and by handles.
(package private)  Global getGlobal()
           
 javax.resource.spi.LocalTransaction getLocalTransaction()
           
 java.io.PrintWriter getLogWriter()
           
(package private)  BlasterManagedConnectionFactory getManagedConnectionFactory()
           
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
           
(package private)  java.lang.String getUserName()
           
 javax.transaction.xa.XAResource getXAResource()
           
(package private)  void handleClose(BlasterConnection impl)
           
(package private)  void handleError(BlasterConnection impl, java.lang.Exception ex)
           
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
           
(package private)  void removeHandle(BlasterConnectionImpl handle)
           
 void setLogWriter(java.io.PrintWriter out)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mcf

BlasterManagedConnectionFactory mcf

user

java.lang.String user

pwd

java.lang.String pwd

physicalPipe

I_XmlBlasterAccess physicalPipe

logWriter

java.io.PrintWriter logWriter

isDestroyed

boolean isDestroyed

closed

boolean closed

me

java.lang.String me

listeners

java.util.Vector listeners

clonedGlob

Global clonedGlob

handles

private java.util.Set handles
Holds all current BlasterConnectionImpl handles.

Constructor Detail

BlasterManagedConnection

public BlasterManagedConnection(BlasterManagedConnectionFactory mcf,
                                java.lang.String user,
                                java.lang.String pwd)
                         throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo info)
                               throws javax.resource.ResourceException
Get the physical connection handler.

This bummer will be called in two situations.

1. When a new mc has bean created and a connection is needed

2. When an mc has been fetched from the pool (returned in match*)

It may also be called multiple time without a cleanup, to support connection sharing.

Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

destroyHandles

private void destroyHandles()
                     throws javax.resource.ResourceException
Destroy all handles.

Throws:
javax.resource.ResourceException - Failed to close one or more handles.

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroy the physical connection

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Cleans up the connection. Not shure what to do here. The spec says: clean al client specific states out, but keep the physical pipe up. This is not possible with xmlBlaster. One thing in spec is clear. A client may not use a connection that was cleaned!!

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

associateConnection

public void associateConnection(java.lang.Object obj)
                         throws javax.resource.ResourceException
Move a handler from one mc to this one

Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Specified by:
getMetaData in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

removeHandle

void removeHandle(BlasterConnectionImpl handle)

getBlasterConnection

I_XmlBlasterAccess getBlasterConnection()
                                  throws XmlBlasterException
Throws:
XmlBlasterException

getFailoverBlasterConnection

I_XmlBlasterAccess getFailoverBlasterConnection()
                                          throws XmlBlasterException
This is used both internaly and by handles. We do lot of sanity checks here (failover ;-) Move to failoverGetConnection

Throws:
XmlBlasterException

handleClose

void handleClose(BlasterConnection impl)

handleError

void handleError(BlasterConnection impl,
                 java.lang.Exception ex)

getUserName

java.lang.String getUserName()

getManagedConnectionFactory

BlasterManagedConnectionFactory getManagedConnectionFactory()

getGlobal

Global getGlobal()

doLogin

private void doLogin()
              throws javax.resource.spi.CommException
Throws:
javax.resource.spi.CommException

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.