You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2003/11/14 17:00:24 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound ConnectionHandleInterceptor.java ConnectionInfo.java ConnectionInterceptor.java ConnectionReturnAction.java GeronimoConnectionEventListener.java LocalXAResource.java LocalXAResourceInsertionInterceptor.java MCFConnectionInterceptor.java ManagedConnectionInfo.java MultiPoolConnectionInterceptor.java ProxyConnectionManager.java SecurityDomain.java SecurityDomainImpl.java SinglePoolConnectionInterceptor.java TransactionCachingInterceptor.java TransactionEnlistingInterceptor.java XAResourceInsertionInterceptor.java
djencks 2003/11/14 08:00:23
Modified: modules/core/src/java/org/apache/geronimo/connector/deployment
DeploymentHelper.java
modules/core/src/java/org/apache/geronimo/connector/outbound
ConnectionHandleInterceptor.java
ConnectionInfo.java ConnectionInterceptor.java
ConnectionReturnAction.java
GeronimoConnectionEventListener.java
LocalXAResource.java
LocalXAResourceInsertionInterceptor.java
MCFConnectionInterceptor.java
ManagedConnectionInfo.java
MultiPoolConnectionInterceptor.java
ProxyConnectionManager.java SecurityDomain.java
SecurityDomainImpl.java
SinglePoolConnectionInterceptor.java
TransactionCachingInterceptor.java
TransactionEnlistingInterceptor.java
XAResourceInsertionInterceptor.java
Log:
Whitespace and format corrections (begone, vile tabs)
Revision Changes Path
1.2 +67 -68 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/DeploymentHelper.java
Index: DeploymentHelper.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/DeploymentHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeploymentHelper.java 11 Nov 2003 21:11:56 -0000 1.1
+++ DeploymentHelper.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -90,8 +90,7 @@
*
* @version $Revision$ $Date$
*/
-public final class DeploymentHelper
-{
+public final class DeploymentHelper {
private final URL url;
@@ -109,26 +108,26 @@
public DeploymentHelper(URL aURL, URLType aType) throws DeploymentException {
url = aURL;
type = aType;
- try {
- if ( URLType.PACKED_ARCHIVE == type ) {
- if (!url.getPath().endsWith(".rar")) {
- raURL = null;
- graURL = null;
- return;
- }
- raURL = new URL("jar:"+url.toExternalForm()+"!/META-INF/ra.xml");
- graURL = new URL("jar:"+url.toExternalForm()+"!/META-INF/geronimo-ra.xml");
- } else if ( URLType.UNPACKED_ARCHIVE == type ) {
- raURL = new URL(url, "META-INF/ra.xml");
- graURL = new URL(url, "META-INF/geronimo-ra.xml");
- } else {
- raURL = null;
- graURL = null;
- return;
- }
- } catch (MalformedURLException e1) {
- throw new DeploymentException("Should never occurs", e1);
- }
+ try {
+ if (URLType.PACKED_ARCHIVE == type) {
+ if (!url.getPath().endsWith(".rar")) {
+ raURL = null;
+ graURL = null;
+ return;
+ }
+ raURL = new URL("jar:" + url.toExternalForm() + "!/META-INF/ra.xml");
+ graURL = new URL("jar:" + url.toExternalForm() + "!/META-INF/geronimo-ra.xml");
+ } else if (URLType.UNPACKED_ARCHIVE == type) {
+ raURL = new URL(url, "META-INF/ra.xml");
+ graURL = new URL(url, "META-INF/geronimo-ra.xml");
+ } else {
+ raURL = null;
+ graURL = null;
+ return;
+ }
+ } catch (MalformedURLException e1) {
+ throw new DeploymentException("Should never occurs", e1);
+ }
}
/**
@@ -139,13 +138,13 @@
*
* @throws DeploymentException
*/
- public URL locateDD() throws DeploymentException {
- return raURL;
- }
-
- public URL locateGeronimoDD() throws DeploymentException {
- return graURL;
- }
+ public URL locateDD() throws DeploymentException {
+ return raURL;
+ }
+
+ public URL locateGeronimoDD() throws DeploymentException {
+ return graURL;
+ }
/**
* Build a ClassSpaceMetadata abstracting the connector archives.
@@ -167,26 +166,26 @@
List raArchives = raCS.getUrls();
- if ( URLType.PACKED_ARCHIVE == type ) {
- String rootJar = "jar:"+url.toExternalForm();
+ if (URLType.PACKED_ARCHIVE == type) {
+ String rootJar = "jar:" + url.toExternalForm();
try {
JarFile jFile = new JarFile(url.getFile());
Enumeration entries = jFile.entries();
- while ( entries.hasMoreElements() ) {
+ while (entries.hasMoreElements()) {
JarEntry jEntry = (JarEntry) entries.nextElement();
- if ( jEntry.isDirectory() ) {
+ if (jEntry.isDirectory()) {
continue;
}
- if ( jEntry.getName().endsWith(".jar") ) {
+ if (jEntry.getName().endsWith(".jar")) {
raArchives.add(
- new URL(rootJar + "!/" + jEntry.getName()));
+ new URL(rootJar + "!/" + jEntry.getName()));
}
// TODO handle the .so and .dll entries.
}
} catch (IOException e) {
throw new DeploymentException("Should never occurs", e);
}
- } else if ( URLType.UNPACKED_ARCHIVE == type ) {
+ } else if (URLType.UNPACKED_ARCHIVE == type) {
File rootDeploy = new File(url.getFile());
File[] jarFiles = rootDeploy.listFiles(new FileFilter() {
public boolean accept(File pathname) {
@@ -215,8 +214,8 @@
public ObjectName buildDeploymentName() {
return JMXUtil.getObjectName(
"geronimo.deployment:role=DeploymentUnit,url="
- + ObjectName.quote(url.toString())
- + ",type=Connector");
+ + ObjectName.quote(url.toString())
+ + ",type=Connector");
}
/**
@@ -228,8 +227,8 @@
public ObjectName buildClassSpaceName() {
return JMXUtil.getObjectName(
"geronimo.deployment:role=DeploymentUnitClassSpace,url="
- + ObjectName.quote(url.toString())
- + ",type=Connector");
+ + ObjectName.quote(url.toString())
+ + ",type=Connector");
}
/**
@@ -238,39 +237,39 @@
* @return Connector deployment name.
*/
- public ObjectName buildResourceAdapterDeploymentName(GeronimoResourceAdapter gra) {
- return JMXUtil.getObjectName(
- "geronimo.management:j2eeType=JCAResourceAdapter,name="
- + gra.getName());
- }
-
- public ObjectName buildManagedConnectionFactoryDeploymentName(GeronimoConnectionDefinition gcd) {
- return JMXUtil.getObjectName(
- "geronimo.management:j2eeType=JCAManagedConnectionFactory,name="
- + gcd.getName());
- }
-
-
- public ObjectName buildConnectionManagerFactoryDeploymentName(GeronimoConnectionDefinition gcd) {
- return JMXUtil.getObjectName(
- "geronimo.management:j2eeType=ConnectionManager,name="
- + gcd.getName());
- }
-
-
- public ObjectName buildMCFHelperDeploymentName(GeronimoConnectionDefinition gcd) {
- return JMXUtil.getObjectName(
- "geronimo.management:j2eeType=MCFHelper,name="
- + gcd.getName());
- }
+ public ObjectName buildResourceAdapterDeploymentName(GeronimoResourceAdapter gra) {
+ return JMXUtil.getObjectName(
+ "geronimo.management:j2eeType=JCAResourceAdapter,name="
+ + gra.getName());
+ }
+
+ public ObjectName buildManagedConnectionFactoryDeploymentName(GeronimoConnectionDefinition gcd) {
+ return JMXUtil.getObjectName(
+ "geronimo.management:j2eeType=JCAManagedConnectionFactory,name="
+ + gcd.getName());
+ }
+
+
+ public ObjectName buildConnectionManagerFactoryDeploymentName(GeronimoConnectionDefinition gcd) {
+ return JMXUtil.getObjectName(
+ "geronimo.management:j2eeType=ConnectionManager,name="
+ + gcd.getName());
+ }
+
+
+ public ObjectName buildMCFHelperDeploymentName(GeronimoConnectionDefinition gcd) {
+ return JMXUtil.getObjectName(
+ "geronimo.management:j2eeType=MCFHelper,name="
+ + gcd.getName());
+ }
/**
* @param gra
* @return
*/
public ObjectName buildBootstrapContextName(GeronimoResourceAdapter gra) {
- return JMXUtil.getObjectName(
- gra.getBootstrapContext());
+ return JMXUtil.getObjectName(
+ gra.getBootstrapContext());
}
1.2 +27 -27 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java
Index: ConnectionHandleInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionHandleInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectionHandleInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ConnectionHandleInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -68,36 +68,36 @@
*/
public class ConnectionHandleInterceptor implements ConnectionInterceptor {
- private final ConnectionInterceptor next;
+ private final ConnectionInterceptor next;
- public ConnectionHandleInterceptor(ConnectionInterceptor next) {
- this.next = next;
- }
+ public ConnectionHandleInterceptor(ConnectionInterceptor next) {
+ this.next = next;
+ }
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- next.getConnection(ci);
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- if (ci.getConnectionHandle() == null) {
- ci.setConnectionHandle(
- mci.getManagedConnection().getConnection(
- mci.getSubject(),
- mci.getConnectionRequestInfo()));
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ next.getConnection(ci);
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ if (ci.getConnectionHandle() == null) {
+ ci.setConnectionHandle(
+ mci.getManagedConnection().getConnection(
+ mci.getSubject(),
+ mci.getConnectionRequestInfo()));
- } else {
- mci.getManagedConnection().associateConnection(
- ci.getConnectionHandle());
- } // end of else
- mci.addConnectionHandle(ci.getConnectionHandle());
- }
+ } else {
+ mci.getManagedConnection().associateConnection(
+ ci.getConnectionHandle());
+ } // end of else
+ mci.addConnectionHandle(ci.getConnectionHandle());
+ }
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- if (ci.getConnectionHandle() != null) {
- ci.getManagedConnectionInfo().removeConnectionHandle(
- ci.getConnectionHandle());
- }
- next.returnConnection(ci, cra);
- }
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ if (ci.getConnectionHandle() != null) {
+ ci.getManagedConnectionInfo().removeConnectionHandle(
+ ci.getConnectionHandle());
+ }
+ next.returnConnection(ci, cra);
+ }
}
1.2 +39 -39 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java
Index: ConnectionInfo.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectionInfo.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ConnectionInfo.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -67,46 +67,46 @@
*/
public class ConnectionInfo {
- private ManagedConnectionInfo mci;
- private Object connection;
+ private ManagedConnectionInfo mci;
+ private Object connection;
- public ConnectionInfo() {
- } // ConnectionInfo constructor
+ public ConnectionInfo() {
+ } // ConnectionInfo constructor
- public ConnectionInfo(ManagedConnectionInfo mci) {
- this.mci = mci;
- }
-
- /**
- * Get the Mci value.
- * @return the Mci value.
- */
- public ManagedConnectionInfo getManagedConnectionInfo() {
- return mci;
- }
-
- /**
- * Set the Mci value.
- * @param mci The new Mci value.
- */
- public void setManagedConnectionInfo(ManagedConnectionInfo mci) {
- this.mci = mci;
- }
-
- /**
- * Get the Connection value.
- * @return the Connection value.
- */
- public Object getConnectionHandle() {
- return connection;
- }
-
- /**
- * Set the Connection value.
- * @param newConnection The new Connection value.
- */
- public void setConnectionHandle(Object connection) {
- this.connection = connection;
- }
+ public ConnectionInfo(ManagedConnectionInfo mci) {
+ this.mci = mci;
+ }
+
+ /**
+ * Get the Mci value.
+ * @return the Mci value.
+ */
+ public ManagedConnectionInfo getManagedConnectionInfo() {
+ return mci;
+ }
+
+ /**
+ * Set the Mci value.
+ * @param mci The new Mci value.
+ */
+ public void setManagedConnectionInfo(ManagedConnectionInfo mci) {
+ this.mci = mci;
+ }
+
+ /**
+ * Get the Connection value.
+ * @return the Connection value.
+ */
+ public Object getConnectionHandle() {
+ return connection;
+ }
+
+ /**
+ * Set the Connection value.
+ * @param newConnection The new Connection value.
+ */
+ public void setConnectionHandle(Object connection) {
+ this.connection = connection;
+ }
} // ConnectionInfo
1.2 +2 -2 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java
Index: ConnectionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ConnectionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -71,8 +71,8 @@
*/
public interface ConnectionInterceptor {
- void getConnection(ConnectionInfo ci) throws ResourceException;
+ void getConnection(ConnectionInfo ci) throws ResourceException;
- void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra);
+ void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra);
} // ConnectionInterceptor
1.2 +6 -6 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java
Index: ConnectionReturnAction.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectionReturnAction.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ConnectionReturnAction.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -67,13 +67,13 @@
*/
public class ConnectionReturnAction {
- public final static ConnectionReturnAction RETURN_HANDLE =
- new ConnectionReturnAction();
- public final static ConnectionReturnAction DESTROY =
- new ConnectionReturnAction();
+ public final static ConnectionReturnAction RETURN_HANDLE =
+ new ConnectionReturnAction();
+ public final static ConnectionReturnAction DESTROY =
+ new ConnectionReturnAction();
- private ConnectionReturnAction() {
+ private ConnectionReturnAction() {
- } // ConnectionReturnAction constructor
+ } // ConnectionReturnAction constructor
} // ConnectionReturnAction
1.2 +90 -90 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
Index: GeronimoConnectionEventListener.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GeronimoConnectionEventListener.java 11 Nov 2003 21:11:56 -0000 1.1
+++ GeronimoConnectionEventListener.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -71,96 +71,96 @@
* @version 1.0
*/
public class GeronimoConnectionEventListener
- implements ConnectionEventListener {
+ implements ConnectionEventListener {
- private final ManagedConnectionInfo mci;
- private final ConnectionInterceptor stack;
- private final Set connectionHandles = new HashSet();
-
- public GeronimoConnectionEventListener(
- final ConnectionInterceptor stack,
- final ManagedConnectionInfo mci) {
- this.stack = stack;
- this.mci = mci;
- } // ConnectionEventListener constructor
-
- /**
- * The <code>connectionClosed</code> method
- *
- * @param connectionEvent a <code>ConnectionEvent</code> value
- */
- public void connectionClosed(ConnectionEvent connectionEvent) {
- if (connectionEvent.getSource() != mci.getManagedConnection()) {
- throw new IllegalArgumentException(
- "ConnectionClosed event received from wrong ManagedConnection. Expected "
- + mci.getManagedConnection()
- + ", actual "
- + connectionEvent.getSource());
- } // end of if ()
- ConnectionInfo ci = new ConnectionInfo(mci);
- ci.setConnectionHandle(connectionEvent.getConnectionHandle());
- stack.returnConnection(ci, ConnectionReturnAction.RETURN_HANDLE);
- }
-
- /**
- * The <code>connectionErrorOccurred</code> method
- *
- * @param connectionEvent a <code>ConnectionEvent</code> value
- */
- public void connectionErrorOccurred(ConnectionEvent connectionEvent) {
- if (connectionEvent.getSource() != mci.getManagedConnection()) {
- throw new IllegalArgumentException(
- "ConnectionError event received from wrong ManagedConnection. Expected "
- + mci.getManagedConnection()
- + ", actual "
- + connectionEvent.getSource());
- } // end of if ()
- ConnectionInfo ci = new ConnectionInfo(mci);
- ci.setConnectionHandle(connectionEvent.getConnectionHandle());
- stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
- }
-
- /**
- * The <code>localTransactionStarted</code> method
- *
- * @param event a <code>ConnectionEvent</code> value
- * @todo implement this method
- */
- public void localTransactionStarted(ConnectionEvent event) {
- }
-
- /**
- * The <code>localTransactionCommitted</code> method
- *
- * @param event a <code>ConnectionEvent</code> value
- * @todo implement this method
- */
- public void localTransactionCommitted(ConnectionEvent event) {
- }
-
- /**
- * The <code>localTransactionRolledback</code> method
- *
- * @param event a <code>ConnectionEvent</code> value
- * @todo implement this method
- */
- public void localTransactionRolledback(ConnectionEvent event) {
- }
-
- public void addConnectionHandle(Object handle) {
- connectionHandles.add(handle);
- }
-
- public void removeConnectionHandle(Object handle) {
- connectionHandles.remove(handle);
- }
-
- public boolean hasConnectionHandles() {
- return !connectionHandles.isEmpty();
- }
-
- public void clearConnectionHandles() {
- connectionHandles.clear();
- }
+ private final ManagedConnectionInfo mci;
+ private final ConnectionInterceptor stack;
+ private final Set connectionHandles = new HashSet();
+
+ public GeronimoConnectionEventListener(
+ final ConnectionInterceptor stack,
+ final ManagedConnectionInfo mci) {
+ this.stack = stack;
+ this.mci = mci;
+ } // ConnectionEventListener constructor
+
+ /**
+ * The <code>connectionClosed</code> method
+ *
+ * @param connectionEvent a <code>ConnectionEvent</code> value
+ */
+ public void connectionClosed(ConnectionEvent connectionEvent) {
+ if (connectionEvent.getSource() != mci.getManagedConnection()) {
+ throw new IllegalArgumentException(
+ "ConnectionClosed event received from wrong ManagedConnection. Expected "
+ + mci.getManagedConnection()
+ + ", actual "
+ + connectionEvent.getSource());
+ } // end of if ()
+ ConnectionInfo ci = new ConnectionInfo(mci);
+ ci.setConnectionHandle(connectionEvent.getConnectionHandle());
+ stack.returnConnection(ci, ConnectionReturnAction.RETURN_HANDLE);
+ }
+
+ /**
+ * The <code>connectionErrorOccurred</code> method
+ *
+ * @param connectionEvent a <code>ConnectionEvent</code> value
+ */
+ public void connectionErrorOccurred(ConnectionEvent connectionEvent) {
+ if (connectionEvent.getSource() != mci.getManagedConnection()) {
+ throw new IllegalArgumentException(
+ "ConnectionError event received from wrong ManagedConnection. Expected "
+ + mci.getManagedConnection()
+ + ", actual "
+ + connectionEvent.getSource());
+ } // end of if ()
+ ConnectionInfo ci = new ConnectionInfo(mci);
+ ci.setConnectionHandle(connectionEvent.getConnectionHandle());
+ stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
+ }
+
+ /**
+ * The <code>localTransactionStarted</code> method
+ *
+ * @param event a <code>ConnectionEvent</code> value
+ * @todo implement this method
+ */
+ public void localTransactionStarted(ConnectionEvent event) {
+ }
+
+ /**
+ * The <code>localTransactionCommitted</code> method
+ *
+ * @param event a <code>ConnectionEvent</code> value
+ * @todo implement this method
+ */
+ public void localTransactionCommitted(ConnectionEvent event) {
+ }
+
+ /**
+ * The <code>localTransactionRolledback</code> method
+ *
+ * @param event a <code>ConnectionEvent</code> value
+ * @todo implement this method
+ */
+ public void localTransactionRolledback(ConnectionEvent event) {
+ }
+
+ public void addConnectionHandle(Object handle) {
+ connectionHandles.add(handle);
+ }
+
+ public void removeConnectionHandle(Object handle) {
+ connectionHandles.remove(handle);
+ }
+
+ public boolean hasConnectionHandles() {
+ return !connectionHandles.isEmpty();
+ }
+
+ public void clearConnectionHandles() {
+ connectionHandles.clear();
+ }
} // ConnectionEventListener
1.2 +162 -162 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/LocalXAResource.java
Index: LocalXAResource.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/LocalXAResource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalXAResource.java 11 Nov 2003 21:11:56 -0000 1.1
+++ LocalXAResource.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -74,167 +74,167 @@
*/
public class LocalXAResource implements XAResource {
- private final LocalTransaction localTx;
- private Xid xid;
- private int txTimeout;
-
- public LocalXAResource(LocalTransaction localTx) {
- this.localTx = localTx;
- } // LocalXAResource constructor
-
- // Implementation of javax.transaction.xa.XAResource
-
- /**
- * The <code>commit</code> method
- *
- * @param xid a <code>Xid</code> value
- * @param flag a <code>boolean</code> value
- * @exception XAException if an error occurs
- */
- public void commit(Xid xid, boolean flag) throws XAException {
- if (this.xid == null || !this.xid.equals(xid)) {
- throw new XAException();
- } // end of if ()
- try {
- localTx.commit();
- } catch (ResourceException e) {
- XAException xae = new XAException();
- //xae.setLinkedException(e);
- throw xae;
- } // end of try-catch
- finally {
- this.xid = null;
- } // end of finally
-
- }
-
- /**
- * The <code>forget</code> method
- *
- * @param xid a <code>Xid</code> value
- * @exception XAException if an error occurs
- */
- public void forget(Xid xid) throws XAException {
- this.xid = null;
- }
-
- /**
- * The <code>getTransactionTimeout</code> method
- *
- * @return an <code>int</code> value
- * @exception XAException if an error occurs
- */
- public int getTransactionTimeout() throws XAException {
- return txTimeout;
- }
-
- /**
- * The <code>isSameRM</code> method
- *
- * @param XAResource a <code>XAResource</code> value
- * @return a <code>boolean</code> value
- * @exception XAException if an error occurs
- */
- public boolean isSameRM(XAResource xares) throws XAException {
- return this == xares;
- }
-
- /**
- * The <code>recover</code> method
- *
- * @param n an <code>int</code> value
- * @return a <code>Xid[]</code> value
- * @exception XAException if an error occurs
- */
- public Xid[] recover(int n) throws XAException {
- return null;
- }
-
- /**
- * The <code>rollback</code> method
- *
- * @param xid a <code>Xid</code> value
- * @exception XAException if an error occurs
- */
- public void rollback(Xid xid) throws XAException {
- if (this.xid == null || !this.xid.equals(xid)) {
- throw new XAException();
- } // end of if ()
- try {
- localTx.rollback();
- } catch (ResourceException e) {
- XAException xae = new XAException();
- //xae.setLinkedException(e);
- throw xae;
- } // end of try-catch
- finally {
- this.xid = null;
- } // end of finally
-
- }
-
- /**
- * The <code>setTransactionTimeout</code> method
- *
- * @param n an <code>int</code> value
- * @return a <code>boolean</code> value
- * @exception XAException if an error occurs
- */
- public boolean setTransactionTimeout(int txTimeout) throws XAException {
- this.txTimeout = txTimeout;
- return true;
- }
-
- /**
- * The <code>start</code> method
- *
- * @param xid a <code>Xid</code> value
- * @param n an <code>int</code> value
- * @exception XAException if an error occurs
- */
- public void start(Xid xid, int flag) throws XAException {
- if (flag == XAResource.TMNOFLAGS) {
- if (xid != null) {
- throw new XAException();
- } // end of if ()
- this.xid = xid;
- try {
- localTx.begin();
- } catch (ResourceException e) {
- throw new XAException(); //"could not start local tx", e);
- } // end of try-catch
-
- } // end of if ()
- if (flag == XAResource.TMRESUME && xid != this.xid) {
- throw new XAException();
- } // end of if ()
- throw new XAException("unknown state");
- }
-
- /**
- * The <code>end</code> method
- *
- * @param xid a <code>Xid</code> value
- * @param n an <code>int</code> value
- * @exception XAException if an error occurs
- */
- public void end(Xid xid, int flag) throws XAException {
- if (xid != this.xid) {
- throw new XAException();
- } // end of if ()
- //we could keep track of if the flag is TMSUCCESS...
- }
-
- /**
- * The <code>prepare</code> method
- *
- * @param xid a <code>Xid</code> value
- * @return an <code>int</code> value
- * @exception XAException if an error occurs
- */
- public int prepare(Xid xid) throws XAException {
- //log warning that semantics are incorrect...
- return XAResource.XA_OK;
- }
+ private final LocalTransaction localTx;
+ private Xid xid;
+ private int txTimeout;
+
+ public LocalXAResource(LocalTransaction localTx) {
+ this.localTx = localTx;
+ } // LocalXAResource constructor
+
+ // Implementation of javax.transaction.xa.XAResource
+
+ /**
+ * The <code>commit</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @param flag a <code>boolean</code> value
+ * @exception XAException if an error occurs
+ */
+ public void commit(Xid xid, boolean flag) throws XAException {
+ if (this.xid == null || !this.xid.equals(xid)) {
+ throw new XAException();
+ } // end of if ()
+ try {
+ localTx.commit();
+ } catch (ResourceException e) {
+ XAException xae = new XAException();
+ //xae.setLinkedException(e);
+ throw xae;
+ } // end of try-catch
+ finally {
+ this.xid = null;
+ } // end of finally
+
+ }
+
+ /**
+ * The <code>forget</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @exception XAException if an error occurs
+ */
+ public void forget(Xid xid) throws XAException {
+ this.xid = null;
+ }
+
+ /**
+ * The <code>getTransactionTimeout</code> method
+ *
+ * @return an <code>int</code> value
+ * @exception XAException if an error occurs
+ */
+ public int getTransactionTimeout() throws XAException {
+ return txTimeout;
+ }
+
+ /**
+ * The <code>isSameRM</code> method
+ *
+ * @param XAResource a <code>XAResource</code> value
+ * @return a <code>boolean</code> value
+ * @exception XAException if an error occurs
+ */
+ public boolean isSameRM(XAResource xares) throws XAException {
+ return this == xares;
+ }
+
+ /**
+ * The <code>recover</code> method
+ *
+ * @param n an <code>int</code> value
+ * @return a <code>Xid[]</code> value
+ * @exception XAException if an error occurs
+ */
+ public Xid[] recover(int n) throws XAException {
+ return null;
+ }
+
+ /**
+ * The <code>rollback</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @exception XAException if an error occurs
+ */
+ public void rollback(Xid xid) throws XAException {
+ if (this.xid == null || !this.xid.equals(xid)) {
+ throw new XAException();
+ } // end of if ()
+ try {
+ localTx.rollback();
+ } catch (ResourceException e) {
+ XAException xae = new XAException();
+ //xae.setLinkedException(e);
+ throw xae;
+ } // end of try-catch
+ finally {
+ this.xid = null;
+ } // end of finally
+
+ }
+
+ /**
+ * The <code>setTransactionTimeout</code> method
+ *
+ * @param n an <code>int</code> value
+ * @return a <code>boolean</code> value
+ * @exception XAException if an error occurs
+ */
+ public boolean setTransactionTimeout(int txTimeout) throws XAException {
+ this.txTimeout = txTimeout;
+ return true;
+ }
+
+ /**
+ * The <code>start</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @param n an <code>int</code> value
+ * @exception XAException if an error occurs
+ */
+ public void start(Xid xid, int flag) throws XAException {
+ if (flag == XAResource.TMNOFLAGS) {
+ if (xid != null) {
+ throw new XAException();
+ } // end of if ()
+ this.xid = xid;
+ try {
+ localTx.begin();
+ } catch (ResourceException e) {
+ throw new XAException(); //"could not start local tx", e);
+ } // end of try-catch
+
+ } // end of if ()
+ if (flag == XAResource.TMRESUME && xid != this.xid) {
+ throw new XAException();
+ } // end of if ()
+ throw new XAException("unknown state");
+ }
+
+ /**
+ * The <code>end</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @param n an <code>int</code> value
+ * @exception XAException if an error occurs
+ */
+ public void end(Xid xid, int flag) throws XAException {
+ if (xid != this.xid) {
+ throw new XAException();
+ } // end of if ()
+ //we could keep track of if the flag is TMSUCCESS...
+ }
+
+ /**
+ * The <code>prepare</code> method
+ *
+ * @param xid a <code>Xid</code> value
+ * @return an <code>int</code> value
+ * @exception XAException if an error occurs
+ */
+ public int prepare(Xid xid) throws XAException {
+ //log warning that semantics are incorrect...
+ return XAResource.XA_OK;
+ }
} // LocalXAResource
1.2 +17 -17 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java
Index: LocalXAResourceInsertionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/LocalXAResourceInsertionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalXAResourceInsertionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ LocalXAResourceInsertionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -67,26 +67,26 @@
* @version 1.0
*/
public class LocalXAResourceInsertionInterceptor
- implements ConnectionInterceptor {
+ implements ConnectionInterceptor {
- private final ConnectionInterceptor next;
+ private final ConnectionInterceptor next;
- public LocalXAResourceInsertionInterceptor(final ConnectionInterceptor next) {
- this.next = next;
- } // XAResourceInsertionInterceptor constructor
+ public LocalXAResourceInsertionInterceptor(final ConnectionInterceptor next) {
+ this.next = next;
+ } // XAResourceInsertionInterceptor constructor
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- next.getConnection(ci);
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- mci.setXAResource(
- new LocalXAResource(
- mci.getManagedConnection().getLocalTransaction()));
- }
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ next.getConnection(ci);
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ mci.setXAResource(
+ new LocalXAResource(
+ mci.getManagedConnection().getLocalTransaction()));
+ }
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- next.returnConnection(ci, cra);
- }
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ next.returnConnection(ci, cra);
+ }
} // XAResourceInsertionInterceptor
1.2 +22 -21 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java
Index: MCFConnectionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MCFConnectionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ MCFConnectionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -71,31 +71,32 @@
public class MCFConnectionInterceptor implements ConnectionInterceptor {
private final ConnectionManagerDeployment head;
- public MCFConnectionInterceptor(ConnectionManagerDeployment head) {
+
+ public MCFConnectionInterceptor(ConnectionManagerDeployment head) {
this.head = head;
- } // MCFConnectionInterceptor constructor
+ } // MCFConnectionInterceptor constructor
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- ManagedConnection mc =
- mci.getManagedConnectionFactory().createManagedConnection(
- mci.getSubject(),
- mci.getConnectionRequestInfo());
- mci.setManagedConnection(mc);
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ ManagedConnection mc =
+ mci.getManagedConnectionFactory().createManagedConnection(
+ mci.getSubject(),
+ mci.getConnectionRequestInfo());
+ mci.setManagedConnection(mc);
GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(head.getStack(), mci);
mci.setConnectionEventListener(listener);
- }
+ }
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- ManagedConnection mc = mci.getManagedConnection();
- try {
- mc.destroy();
- } catch (ResourceException e) {
- //log and forget
- } // end of try-catch
- }
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ ManagedConnection mc = mci.getManagedConnection();
+ try {
+ mc.destroy();
+ } catch (ResourceException e) {
+ //log and forget
+ } // end of try-catch
+ }
} // MCFConnectionInterceptor
1.2 +159 -159 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java
Index: ManagedConnectionInfo.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ManagedConnectionInfo.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ManagedConnectionInfo.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -74,164 +74,164 @@
*/
public class ManagedConnectionInfo {
- private ManagedConnectionFactory mcf;
- private ConnectionRequestInfo cri;
- private Subject subject;
- private Transaction tx;
- private ManagedConnection mc;
- private XAResource xares;
- private long lastUsed;
- private ConnectionInterceptor poolInterceptor;
-
- private GeronimoConnectionEventListener listener;
-
- public ManagedConnectionInfo(
- ManagedConnectionFactory mcf,
- ConnectionRequestInfo cri) {
- this.mcf = mcf;
- this.cri = cri;
- } // ManagedConnectionInfo constructor
-
- /**
- * Get the Mcf value.
- * @return the Mcf value.
- */
- public ManagedConnectionFactory getManagedConnectionFactory() {
- return mcf;
- }
-
- /**
- * Set the Mcf value.
- * @param newMcf The new Mcf value.
- */
- public void setManagedConnectionFactory(ManagedConnectionFactory mcf) {
- this.mcf = mcf;
- }
-
- /**
- * Get the Cri value.
- * @return the Cri value.
- */
- public ConnectionRequestInfo getConnectionRequestInfo() {
- return cri;
- }
-
- /**
- * Set the Cri value.
- * @param newCri The new Cri value.
- */
- public void setConnectionRequestInfo(ConnectionRequestInfo cri) {
- this.cri = cri;
- }
-
- /**
- * Get the Subject value.
- * @return the Subject value.
- */
- public Subject getSubject() {
- return subject;
- }
-
- /**
- * Set the Subject value.
- * @param newSubject The new Subject value.
- */
- public void setSubject(Subject subject) {
- this.subject = subject;
- }
-
- /**
- * Get the Tx value.
- * @return the Tx value.
- */
- public Transaction getTransaction() {
- return tx;
- }
-
- /**
- * Set the Tx value.
- * @param newTx The new Tx value.
- */
- public void setTransaction(Transaction tx) {
- this.tx = tx;
- }
-
- /**
- * Get the Mc value.
- * @return the Mc value.
- */
- public ManagedConnection getManagedConnection() {
- return mc;
- }
-
- /**
- * Set the Mc value.
- * @param newMc The new Mc value.
- */
- public void setManagedConnection(ManagedConnection mc) {
- this.mc = mc;
- }
-
- /**
- * Get the Xares value.
- * @return the Xares value.
- */
- public XAResource getXAResource() {
- return xares;
- }
-
- /**
- * Set the Xares value.
- * @param newXares The new Xares value.
- */
- public void setXAResource(XAResource xares) {
- this.xares = xares;
- }
-
- public long getLastUsed() {
- return lastUsed;
- }
-
- public void setLastUsed(long lastUsed) {
- this.lastUsed = lastUsed;
- }
-
- public void setPoolInterceptor(ConnectionInterceptor poolInterceptor) {
- this.poolInterceptor = poolInterceptor;
- }
-
- public ConnectionInterceptor getPoolInterceptor() {
- return poolInterceptor;
- }
-
- public void setConnectionEventListener(GeronimoConnectionEventListener listener) {
- this.listener = listener;
- }
-
- public void addConnectionHandle(Object handle) {
- listener.addConnectionHandle(handle);
- }
-
- public void removeConnectionHandle(Object handle) {
- listener.removeConnectionHandle(handle);
- }
-
- public boolean hasConnectionHandles() {
- return listener.hasConnectionHandles();
- }
-
- public void clearConnectionHandles() {
- listener.clearConnectionHandles();
- }
-
- public boolean securityMatches(ManagedConnectionInfo other) {
- return (
- subject == null
- ? other.getSubject() == null
- : subject.equals(other.getSubject()))
- && (cri == null
- ? other.getConnectionRequestInfo() == null
- : cri.equals(other.getConnectionRequestInfo()));
- }
+ private ManagedConnectionFactory mcf;
+ private ConnectionRequestInfo cri;
+ private Subject subject;
+ private Transaction tx;
+ private ManagedConnection mc;
+ private XAResource xares;
+ private long lastUsed;
+ private ConnectionInterceptor poolInterceptor;
+
+ private GeronimoConnectionEventListener listener;
+
+ public ManagedConnectionInfo(
+ ManagedConnectionFactory mcf,
+ ConnectionRequestInfo cri) {
+ this.mcf = mcf;
+ this.cri = cri;
+ } // ManagedConnectionInfo constructor
+
+ /**
+ * Get the Mcf value.
+ * @return the Mcf value.
+ */
+ public ManagedConnectionFactory getManagedConnectionFactory() {
+ return mcf;
+ }
+
+ /**
+ * Set the Mcf value.
+ * @param newMcf The new Mcf value.
+ */
+ public void setManagedConnectionFactory(ManagedConnectionFactory mcf) {
+ this.mcf = mcf;
+ }
+
+ /**
+ * Get the Cri value.
+ * @return the Cri value.
+ */
+ public ConnectionRequestInfo getConnectionRequestInfo() {
+ return cri;
+ }
+
+ /**
+ * Set the Cri value.
+ * @param newCri The new Cri value.
+ */
+ public void setConnectionRequestInfo(ConnectionRequestInfo cri) {
+ this.cri = cri;
+ }
+
+ /**
+ * Get the Subject value.
+ * @return the Subject value.
+ */
+ public Subject getSubject() {
+ return subject;
+ }
+
+ /**
+ * Set the Subject value.
+ * @param newSubject The new Subject value.
+ */
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ /**
+ * Get the Tx value.
+ * @return the Tx value.
+ */
+ public Transaction getTransaction() {
+ return tx;
+ }
+
+ /**
+ * Set the Tx value.
+ * @param newTx The new Tx value.
+ */
+ public void setTransaction(Transaction tx) {
+ this.tx = tx;
+ }
+
+ /**
+ * Get the Mc value.
+ * @return the Mc value.
+ */
+ public ManagedConnection getManagedConnection() {
+ return mc;
+ }
+
+ /**
+ * Set the Mc value.
+ * @param newMc The new Mc value.
+ */
+ public void setManagedConnection(ManagedConnection mc) {
+ this.mc = mc;
+ }
+
+ /**
+ * Get the Xares value.
+ * @return the Xares value.
+ */
+ public XAResource getXAResource() {
+ return xares;
+ }
+
+ /**
+ * Set the Xares value.
+ * @param newXares The new Xares value.
+ */
+ public void setXAResource(XAResource xares) {
+ this.xares = xares;
+ }
+
+ public long getLastUsed() {
+ return lastUsed;
+ }
+
+ public void setLastUsed(long lastUsed) {
+ this.lastUsed = lastUsed;
+ }
+
+ public void setPoolInterceptor(ConnectionInterceptor poolInterceptor) {
+ this.poolInterceptor = poolInterceptor;
+ }
+
+ public ConnectionInterceptor getPoolInterceptor() {
+ return poolInterceptor;
+ }
+
+ public void setConnectionEventListener(GeronimoConnectionEventListener listener) {
+ this.listener = listener;
+ }
+
+ public void addConnectionHandle(Object handle) {
+ listener.addConnectionHandle(handle);
+ }
+
+ public void removeConnectionHandle(Object handle) {
+ listener.removeConnectionHandle(handle);
+ }
+
+ public boolean hasConnectionHandles() {
+ return listener.hasConnectionHandles();
+ }
+
+ public void clearConnectionHandles() {
+ listener.clearConnectionHandles();
+ }
+
+ public boolean securityMatches(ManagedConnectionInfo other) {
+ return (
+ subject == null
+ ? other.getSubject() == null
+ : subject.equals(other.getSubject()))
+ && (cri == null
+ ? other.getConnectionRequestInfo() == null
+ : cri.equals(other.getConnectionRequestInfo()));
+ }
} // ManagedConnectionInfo
1.2 +83 -82 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
Index: MultiPoolConnectionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MultiPoolConnectionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ MultiPoolConnectionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -75,90 +75,91 @@
*/
public class MultiPoolConnectionInterceptor implements ConnectionInterceptor {
- private final ConnectionInterceptor next;
+ private final ConnectionInterceptor next;
- private int maxSize;
+ private int maxSize;
- private int blockingTimeout;
+ private int blockingTimeout;
- private final boolean useSubject;
+ private final boolean useSubject;
- private final boolean useCRI;
-
- private final Map pools = new HashMap();
-
- public MultiPoolConnectionInterceptor(
- final ConnectionInterceptor next,
- int maxSize,
- int blockingTimeout,
- final boolean useSubject,
- final boolean useCRI) {
- this.next = next;
- this.maxSize = maxSize;
- this.blockingTimeout = blockingTimeout;
- this.useSubject = useSubject;
- this.useCRI = useCRI;
- }
-
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- SubjectCRIKey key =
- new SubjectCRIKey(
- useSubject ? mci.getSubject() : null,
- useCRI ? mci.getConnectionRequestInfo() : null);
- SinglePoolConnectionInterceptor poolInterceptor = null;
- synchronized (pools) {
- poolInterceptor = (SinglePoolConnectionInterceptor) pools.get(key);
- if (poolInterceptor == null) {
- poolInterceptor =
- new SinglePoolConnectionInterceptor(
- next,
- mci.getSubject(),
- mci.getConnectionRequestInfo(),
- maxSize,
- blockingTimeout);
- pools.put(key, poolInterceptor);
- } // end of if ()
-
- }
- mci.setPoolInterceptor(poolInterceptor);
- poolInterceptor.getConnection(ci);
- }
-
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- ConnectionInterceptor poolInterceptor = mci.getPoolInterceptor();
- poolInterceptor.returnConnection(ci, cra);
- }
-
- static class SubjectCRIKey {
- private final Subject subject;
- private final ConnectionRequestInfo cri;
- private final int hashcode;
-
- public SubjectCRIKey(
- final Subject subject,
- final ConnectionRequestInfo cri) {
- this.subject = subject;
- this.cri = cri;
- this.hashcode =
- (subject == null ? 17 : subject.hashCode() * 17)
- ^ (cri == null ? 1 : cri.hashCode());
- }
- public boolean equals(Object other) {
- if (!(other instanceof SubjectCRIKey)) {
- return false;
- } // end of if ()
- SubjectCRIKey o = (SubjectCRIKey) other;
- if (hashcode != o.hashcode) {
- return false;
- } // end of if ()
- return subject == null
- ? o.subject == null
- : subject.equals(o.subject)
- && cri == null ? o.cri == null : cri.equals(o.cri);
- }
- }
+ private final boolean useCRI;
+
+ private final Map pools = new HashMap();
+
+ public MultiPoolConnectionInterceptor(
+ final ConnectionInterceptor next,
+ int maxSize,
+ int blockingTimeout,
+ final boolean useSubject,
+ final boolean useCRI) {
+ this.next = next;
+ this.maxSize = maxSize;
+ this.blockingTimeout = blockingTimeout;
+ this.useSubject = useSubject;
+ this.useCRI = useCRI;
+ }
+
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ SubjectCRIKey key =
+ new SubjectCRIKey(
+ useSubject ? mci.getSubject() : null,
+ useCRI ? mci.getConnectionRequestInfo() : null);
+ SinglePoolConnectionInterceptor poolInterceptor = null;
+ synchronized (pools) {
+ poolInterceptor = (SinglePoolConnectionInterceptor) pools.get(key);
+ if (poolInterceptor == null) {
+ poolInterceptor =
+ new SinglePoolConnectionInterceptor(
+ next,
+ mci.getSubject(),
+ mci.getConnectionRequestInfo(),
+ maxSize,
+ blockingTimeout);
+ pools.put(key, poolInterceptor);
+ } // end of if ()
+
+ }
+ mci.setPoolInterceptor(poolInterceptor);
+ poolInterceptor.getConnection(ci);
+ }
+
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ ConnectionInterceptor poolInterceptor = mci.getPoolInterceptor();
+ poolInterceptor.returnConnection(ci, cra);
+ }
+
+ static class SubjectCRIKey {
+ private final Subject subject;
+ private final ConnectionRequestInfo cri;
+ private final int hashcode;
+
+ public SubjectCRIKey(
+ final Subject subject,
+ final ConnectionRequestInfo cri) {
+ this.subject = subject;
+ this.cri = cri;
+ this.hashcode =
+ (subject == null ? 17 : subject.hashCode() * 17)
+ ^ (cri == null ? 1 : cri.hashCode());
+ }
+
+ public boolean equals(Object other) {
+ if (!(other instanceof SubjectCRIKey)) {
+ return false;
+ } // end of if ()
+ SubjectCRIKey o = (SubjectCRIKey) other;
+ if (hashcode != o.hashcode) {
+ return false;
+ } // end of if ()
+ return subject == null
+ ? o.subject == null
+ : subject.equals(o.subject)
+ && cri == null ? o.cri == null : cri.equals(o.cri);
+ }
+ }
} // MultiPoolConnectionInterceptor
1.2 +83 -83 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ProxyConnectionManager.java
Index: ProxyConnectionManager.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ProxyConnectionManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProxyConnectionManager.java 11 Nov 2003 21:11:56 -0000 1.1
+++ ProxyConnectionManager.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -81,89 +81,89 @@
*
*/
public class ProxyConnectionManager
- implements Serializable, ConnectionManager, LazyAssociatableConnectionManager {
+ implements Serializable, ConnectionManager, LazyAssociatableConnectionManager {
- /**
- * The field agentID holds the agentID of the mbean server
- * we use to lookup the stack if we are deserialized.
- */
- private final String agentID;
-
- /**
- * The field <code>CMName</code> holds the object name of
- * the ConnectionManagerDeployment that sets us up.
- *
- */
- private final ObjectName CMName;
-
- private transient ConnectionInterceptor stack;
-
- public ProxyConnectionManager(
- String agentID,
- ObjectName CMName,
- ConnectionInterceptor stack) {
- this.agentID = agentID;
- this.CMName = CMName;
- this.stack = stack;
- } // ProxyConnectionManager constructor
-
- public Object allocateConnection(
- ManagedConnectionFactory mcf,
- ConnectionRequestInfo cri)
- throws ResourceException {
- internalGetStack();
- ManagedConnectionInfo mci = new ManagedConnectionInfo(mcf, cri);
- ConnectionInfo ci = new ConnectionInfo(mci);
- stack.getConnection(ci);
- return ci.getConnectionHandle();
- }
-
- public void associateConnection(
- Object connection,
- ManagedConnectionFactory mcf,
- ConnectionRequestInfo cri)
- throws ResourceException {
- internalGetStack();
- ManagedConnectionInfo mci = new ManagedConnectionInfo(mcf, cri);
- ConnectionInfo ci = new ConnectionInfo(mci);
- ci.setConnectionHandle(connection);
- stack.getConnection(ci);
- }
-
- private void internalGetStack() throws ResourceException {
- if (stack == null) {
- MBeanServer server =
- (MBeanServer) MBeanServerFactory.findMBeanServer(agentID).get(
- 0);
- try {
- this.stack =
- (ConnectionInterceptor) server.getAttribute(
- this.CMName,
- "Stack");
- } catch (InstanceNotFoundException e) {
- throw new ResourceException("Could not get stack from jmx", e);
- } catch (MBeanException e) {
- throw new ResourceException("Could not get stack from jmx", e);
- } catch (ReflectionException e) {
- throw new ResourceException("Could not get stack from jmx", e);
- } catch (AttributeNotFoundException e) {
- throw new ResourceException("Could not get stack from jmx", e);
- }
-
- } // end of if ()
- }
-
- /**
- * The <code>getStack</code> method is called through jmx to get
- * the actual ConnectionInterceptor stack for deserialized copies
- * of this object.
- *
- * @return a <code>ConnectionInterceptor</code> value
- *
- * @jmx.managed-operation
- */
- public ConnectionInterceptor getStack() {
- return stack;
- }
+ /**
+ * The field agentID holds the agentID of the mbean server
+ * we use to lookup the stack if we are deserialized.
+ */
+ private final String agentID;
+
+ /**
+ * The field <code>CMName</code> holds the object name of
+ * the ConnectionManagerDeployment that sets us up.
+ *
+ */
+ private final ObjectName CMName;
+
+ private transient ConnectionInterceptor stack;
+
+ public ProxyConnectionManager(
+ String agentID,
+ ObjectName CMName,
+ ConnectionInterceptor stack) {
+ this.agentID = agentID;
+ this.CMName = CMName;
+ this.stack = stack;
+ } // ProxyConnectionManager constructor
+
+ public Object allocateConnection(
+ ManagedConnectionFactory mcf,
+ ConnectionRequestInfo cri)
+ throws ResourceException {
+ internalGetStack();
+ ManagedConnectionInfo mci = new ManagedConnectionInfo(mcf, cri);
+ ConnectionInfo ci = new ConnectionInfo(mci);
+ stack.getConnection(ci);
+ return ci.getConnectionHandle();
+ }
+
+ public void associateConnection(
+ Object connection,
+ ManagedConnectionFactory mcf,
+ ConnectionRequestInfo cri)
+ throws ResourceException {
+ internalGetStack();
+ ManagedConnectionInfo mci = new ManagedConnectionInfo(mcf, cri);
+ ConnectionInfo ci = new ConnectionInfo(mci);
+ ci.setConnectionHandle(connection);
+ stack.getConnection(ci);
+ }
+
+ private void internalGetStack() throws ResourceException {
+ if (stack == null) {
+ MBeanServer server =
+ (MBeanServer) MBeanServerFactory.findMBeanServer(agentID).get(
+ 0);
+ try {
+ this.stack =
+ (ConnectionInterceptor) server.getAttribute(
+ this.CMName,
+ "Stack");
+ } catch (InstanceNotFoundException e) {
+ throw new ResourceException("Could not get stack from jmx", e);
+ } catch (MBeanException e) {
+ throw new ResourceException("Could not get stack from jmx", e);
+ } catch (ReflectionException e) {
+ throw new ResourceException("Could not get stack from jmx", e);
+ } catch (AttributeNotFoundException e) {
+ throw new ResourceException("Could not get stack from jmx", e);
+ }
+
+ } // end of if ()
+ }
+
+ /**
+ * The <code>getStack</code> method is called through jmx to get
+ * the actual ConnectionInterceptor stack for deserialized copies
+ * of this object.
+ *
+ * @return a <code>ConnectionInterceptor</code> value
+ *
+ * @jmx.managed-operation
+ */
+ public ConnectionInterceptor getStack() {
+ return stack;
+ }
} // ProxyConnectionManager
1.2 +1 -1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SecurityDomain.java
Index: SecurityDomain.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SecurityDomain.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SecurityDomain.java 11 Nov 2003 21:11:56 -0000 1.1
+++ SecurityDomain.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -68,6 +68,6 @@
*/
public interface SecurityDomain {
- Subject getSubject();
+ Subject getSubject();
} // SecurityDomain
1.2 +5 -5 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SecurityDomainImpl.java
Index: SecurityDomainImpl.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SecurityDomainImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SecurityDomainImpl.java 11 Nov 2003 21:11:56 -0000 1.1
+++ SecurityDomainImpl.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -68,12 +68,12 @@
* @version 1.0
*/
public class SecurityDomainImpl implements SecurityDomain {
- public SecurityDomainImpl() {
+ public SecurityDomainImpl() {
- } // SecurityDomainImpl constructor
+ } // SecurityDomainImpl constructor
- public Subject getSubject() {
- return new Subject();
- }
+ public Subject getSubject() {
+ return new Subject();
+ }
} // SecurityDomainImpl
1.2 +184 -184 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
Index: SinglePoolConnectionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SinglePoolConnectionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ SinglePoolConnectionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -76,193 +76,193 @@
*/
public class SinglePoolConnectionInterceptor implements ConnectionInterceptor {
- private final ConnectionInterceptor next;
+ private final ConnectionInterceptor next;
- private FIFOSemaphore permits;
+ private FIFOSemaphore permits;
- private PoolDeque pool;
+ private PoolDeque pool;
- private final Subject defaultSubject;
+ private final Subject defaultSubject;
- private final ConnectionRequestInfo defaultCRI;
-
- private int maxSize;
-
- private int blockingTimeout;
-
- public SinglePoolConnectionInterceptor(
- final ConnectionInterceptor next,
- final Subject defaultSubject,
- final ConnectionRequestInfo defaultCRI,
- int maxSize,
- int blockingTimeout) {
- this.next = next;
- this.defaultSubject = defaultSubject;
- this.defaultCRI = defaultCRI;
- this.maxSize = maxSize;
- this.blockingTimeout = blockingTimeout;
- permits = new FIFOSemaphore(maxSize);
- pool = new PoolDeque(maxSize);
- }
-
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- try {
- if (permits.attempt(blockingTimeout)) {
- ManagedConnectionInfo newMCI = null;
- synchronized (pool) {
- if (pool.isEmpty()) {
- next.getConnection(ci);
- return;
- } else {
- newMCI = (ManagedConnectionInfo) pool.removeFirst();
- } // end of else
- try {
- ManagedConnection matchedMC =
- newMCI
- .getManagedConnectionFactory()
- .matchManagedConnections(
- Collections.singleton(
- newMCI.getManagedConnection()),
- mci.getSubject(),
- mci.getConnectionRequestInfo());
- if (matchedMC != null) {
- ci.setManagedConnectionInfo(newMCI);
- return;
- } else {
- //matching failed.
- ConnectionInfo returnCI = new ConnectionInfo();
- returnCI.setManagedConnectionInfo(newMCI);
- returnConnection(
- returnCI,
- ConnectionReturnAction.RETURN_HANDLE);
- throw new ResourceException("The pooling strategy does not match the MatchManagedConnections implementation. Please investigate and reconfigure this pool");
- }
- } catch (ResourceException e) {
- //something is wrong: destroy connection, rethrow, release permit
- ConnectionInfo returnCI = new ConnectionInfo();
- returnCI.setManagedConnectionInfo(newMCI);
- returnConnection(
- returnCI,
- ConnectionReturnAction.DESTROY);
- throw e;
- } // end of try-catch
- }
- } else {
- throw new ResourceException(
- "No ManagedConnections available "
- + "within configured blocking timeout ( "
- + blockingTimeout
- + " [ms] )");
-
- } // end of else
-
- } catch (InterruptedException ie) {
- throw new ResourceException("Interrupted while requesting permit!");
- } // end of try-catch
- }
-
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- boolean wasInPool = false;
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- if (cra == ConnectionReturnAction.DESTROY) {
- synchronized (pool) {
- wasInPool = pool.remove(mci);
- }
- } else {
- if (mci.hasConnectionHandles()) {
- return;
- }
- } // end of else
-
- ManagedConnection mc = mci.getManagedConnection();
- try {
- mc.cleanup();
- } catch (ResourceException e) {
- cra = ConnectionReturnAction.DESTROY;
- }
-
- if (cra == ConnectionReturnAction.DESTROY) {
-
- next.returnConnection(ci, cra);
- } else {
- synchronized (pool) {
- mci.setLastUsed(System.currentTimeMillis());
- pool.addFirst(mci);
- }
-
- } // end of else
-
- }
-
- static class PoolDeque {
-
- private final ManagedConnectionInfo[] deque;
- private int first = 0;
- private int last = -1;
-
- public PoolDeque(int size) {
- deque = new ManagedConnectionInfo[size];
- }
-
- public boolean isEmpty() {
- return first > last;
- }
-
- public ManagedConnectionInfo removeFirst() {
- if (isEmpty()) {
- throw new IllegalStateException("deque is empty");
- }
- return deque[first++];
- }
-
- public void addFirst(ManagedConnectionInfo mci) {
- if (first == 0) {
- throw new IllegalStateException("deque is at first element already");
- }
-
- deque[--first] = mci;
- }
-
- public void addLast(ManagedConnectionInfo mci) {
- if (last == deque.length - 1) {
- throw new IllegalStateException("deque is full");
- }
-
- deque[++last] = mci;
- }
-
- public ManagedConnectionInfo peekLast() {
- if (isEmpty()) {
- throw new IllegalStateException("deque is empty");
- }
-
- return deque[last];
- }
-
- public ManagedConnectionInfo removeLast() {
- if (isEmpty()) {
- throw new IllegalStateException("deque is empty");
- }
-
- return deque[last--];
- }
-
- public boolean remove(ManagedConnectionInfo mci) {
- for (int i = first; i <= last; i++) {
- if (deque[i] == mci) {
- for (int j = i + 1; j <= last; j++) {
- deque[j - 1] = deque[j];
- }
- last--;
- return true;
- }
-
- }
- return false;
- }
- }
+ private final ConnectionRequestInfo defaultCRI;
+
+ private int maxSize;
+
+ private int blockingTimeout;
+
+ public SinglePoolConnectionInterceptor(
+ final ConnectionInterceptor next,
+ final Subject defaultSubject,
+ final ConnectionRequestInfo defaultCRI,
+ int maxSize,
+ int blockingTimeout) {
+ this.next = next;
+ this.defaultSubject = defaultSubject;
+ this.defaultCRI = defaultCRI;
+ this.maxSize = maxSize;
+ this.blockingTimeout = blockingTimeout;
+ permits = new FIFOSemaphore(maxSize);
+ pool = new PoolDeque(maxSize);
+ }
+
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ try {
+ if (permits.attempt(blockingTimeout)) {
+ ManagedConnectionInfo newMCI = null;
+ synchronized (pool) {
+ if (pool.isEmpty()) {
+ next.getConnection(ci);
+ return;
+ } else {
+ newMCI = (ManagedConnectionInfo) pool.removeFirst();
+ } // end of else
+ try {
+ ManagedConnection matchedMC =
+ newMCI
+ .getManagedConnectionFactory()
+ .matchManagedConnections(
+ Collections.singleton(
+ newMCI.getManagedConnection()),
+ mci.getSubject(),
+ mci.getConnectionRequestInfo());
+ if (matchedMC != null) {
+ ci.setManagedConnectionInfo(newMCI);
+ return;
+ } else {
+ //matching failed.
+ ConnectionInfo returnCI = new ConnectionInfo();
+ returnCI.setManagedConnectionInfo(newMCI);
+ returnConnection(
+ returnCI,
+ ConnectionReturnAction.RETURN_HANDLE);
+ throw new ResourceException("The pooling strategy does not match the MatchManagedConnections implementation. Please investigate and reconfigure this pool");
+ }
+ } catch (ResourceException e) {
+ //something is wrong: destroy connection, rethrow, release permit
+ ConnectionInfo returnCI = new ConnectionInfo();
+ returnCI.setManagedConnectionInfo(newMCI);
+ returnConnection(
+ returnCI,
+ ConnectionReturnAction.DESTROY);
+ throw e;
+ } // end of try-catch
+ }
+ } else {
+ throw new ResourceException(
+ "No ManagedConnections available "
+ + "within configured blocking timeout ( "
+ + blockingTimeout
+ + " [ms] )");
+
+ } // end of else
+
+ } catch (InterruptedException ie) {
+ throw new ResourceException("Interrupted while requesting permit!");
+ } // end of try-catch
+ }
+
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ boolean wasInPool = false;
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ if (cra == ConnectionReturnAction.DESTROY) {
+ synchronized (pool) {
+ wasInPool = pool.remove(mci);
+ }
+ } else {
+ if (mci.hasConnectionHandles()) {
+ return;
+ }
+ } // end of else
+
+ ManagedConnection mc = mci.getManagedConnection();
+ try {
+ mc.cleanup();
+ } catch (ResourceException e) {
+ cra = ConnectionReturnAction.DESTROY;
+ }
+
+ if (cra == ConnectionReturnAction.DESTROY) {
+
+ next.returnConnection(ci, cra);
+ } else {
+ synchronized (pool) {
+ mci.setLastUsed(System.currentTimeMillis());
+ pool.addFirst(mci);
+ }
+
+ } // end of else
+
+ }
+
+ static class PoolDeque {
+
+ private final ManagedConnectionInfo[] deque;
+ private int first = 0;
+ private int last = -1;
+
+ public PoolDeque(int size) {
+ deque = new ManagedConnectionInfo[size];
+ }
+
+ public boolean isEmpty() {
+ return first > last;
+ }
+
+ public ManagedConnectionInfo removeFirst() {
+ if (isEmpty()) {
+ throw new IllegalStateException("deque is empty");
+ }
+ return deque[first++];
+ }
+
+ public void addFirst(ManagedConnectionInfo mci) {
+ if (first == 0) {
+ throw new IllegalStateException("deque is at first element already");
+ }
+
+ deque[--first] = mci;
+ }
+
+ public void addLast(ManagedConnectionInfo mci) {
+ if (last == deque.length - 1) {
+ throw new IllegalStateException("deque is full");
+ }
+
+ deque[++last] = mci;
+ }
+
+ public ManagedConnectionInfo peekLast() {
+ if (isEmpty()) {
+ throw new IllegalStateException("deque is empty");
+ }
+
+ return deque[last];
+ }
+
+ public ManagedConnectionInfo removeLast() {
+ if (isEmpty()) {
+ throw new IllegalStateException("deque is empty");
+ }
+
+ return deque[last--];
+ }
+
+ public boolean remove(ManagedConnectionInfo mci) {
+ for (int i = first; i <= last; i++) {
+ if (deque[i] == mci) {
+ for (int j = i + 1; j <= last; j++) {
+ deque[j - 1] = deque[j];
+ }
+ last--;
+ return true;
+ }
+
+ }
+ return false;
+ }
+ }
} // SinglePoolConnectionInterceptor
1.2 +21 -40 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java
Index: TransactionCachingInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TransactionCachingInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ TransactionCachingInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -60,6 +60,7 @@
import java.util.Iterator;
import java.util.Collection;
import java.util.LinkedList;
+
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.SystemException;
@@ -75,31 +76,25 @@
*
* @version 1.0
*/
-public class TransactionCachingInterceptor implements ConnectionInterceptor
-{
+public class TransactionCachingInterceptor implements ConnectionInterceptor {
private final ConnectionInterceptor next;
private final TransactionManager tm;
private final WeakHashMap txToMCIListMap = new WeakHashMap();
- public TransactionCachingInterceptor(final ConnectionInterceptor next, final TransactionManager tm)
- {
+ public TransactionCachingInterceptor(final ConnectionInterceptor next, final TransactionManager tm) {
this.next = next;
this.tm = tm;
} // TransactionCachingInterceptor constructor
- public void getConnection(ConnectionInfo ci) throws ResourceException
- {
- try
- {
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ try {
Transaction tx = tm.getTransaction();
- if (TxUtils.isActive(tx))
- {
+ if (TxUtils.isActive(tx)) {
ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
Collection mcis = null;
- synchronized (txToMCIListMap)
- {
- mcis = (Collection)txToMCIListMap.get(tx);
+ synchronized (txToMCIListMap) {
+ mcis = (Collection) txToMCIListMap.get(tx);
}
/*Access to mcis should not need to be synchronized
* unless several requests in the same transaction in
@@ -107,13 +102,10 @@
* time. This cannot occur with transactions imported
* through jca. I don't know about any other possible
* ways this could occur.*/
- if (mcis != null)
- {
- for (Iterator i = mcis.iterator(); i.hasNext();)
- {
- ManagedConnectionInfo oldmci = (ManagedConnectionInfo)i.next();
- if (mci.securityMatches(oldmci))
- {
+ if (mcis != null) {
+ for (Iterator i = mcis.iterator(); i.hasNext();) {
+ ManagedConnectionInfo oldmci = (ManagedConnectionInfo) i.next();
+ if (mci.securityMatches(oldmci)) {
ci.setManagedConnectionInfo(oldmci);
return;
} // end of if ()
@@ -121,49 +113,38 @@
} // end of for ()
} // end of if ()
- else
- {
+ else {
mcis = new LinkedList();
- synchronized (txToMCIListMap)
- {
+ synchronized (txToMCIListMap) {
txToMCIListMap.put(tx, mcis);
}
} // end of else
next.getConnection(ci);
//put it in the map
- synchronized (mcis)
- {
+ synchronized (mcis) {
mcis.add(ci.getManagedConnectionInfo());
}
} // end of if ()
- else
- {
+ else {
next.getConnection(ci);
} // end of else
- }
- catch (SystemException e)
- {
+ } catch (SystemException e) {
throw new ResourceException("Could not get transaction from transaction manager", e);
} // end of try-catch
}
- public void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra)
- {
+ public void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra) {
- try
- {
+ try {
Transaction tx = tm.getTransaction();
- if (cra == ConnectionReturnAction.DESTROY || !TxUtils.isActive(tx))
- {
+ if (cra == ConnectionReturnAction.DESTROY || !TxUtils.isActive(tx)) {
next.returnConnection(ci, cra);
}
//if tx is active, we keep it cached and do nothing.
- }
- catch (SystemException e)
- {
+ } catch (SystemException e) {
//throw new ResourceException("Could not get transaction from transaction manager", e);
} // end of try-catch
1.2 +57 -57 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java
Index: TransactionEnlistingInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TransactionEnlistingInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ TransactionEnlistingInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -75,64 +75,64 @@
*/
public class TransactionEnlistingInterceptor implements ConnectionInterceptor {
- private final ConnectionInterceptor next;
- private final TransactionManager tm;
+ private final ConnectionInterceptor next;
+ private final TransactionManager tm;
- public TransactionEnlistingInterceptor(
- ConnectionInterceptor next,
- TransactionManager tm) {
- this.next = next;
- this.tm = tm;
- } // TransactionEnlistingInterceptor constructor
-
- public void getConnection(ConnectionInfo ci) throws ResourceException {
- next.getConnection(ci);
- try {
- Transaction tx = tm.getTransaction();
- if (TxUtils.isActive(tx)) {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- XAResource xares = mci.getXAResource();
- tx.enlistResource(xares);
- mci.setTransaction(tx);
- } // end of if ()
-
- } catch (SystemException e) {
- throw new ResourceException("Could not get transaction", e);
- } // end of try-catch
- catch (RollbackException e) {
- throw new ResourceException(
- "Could not enlist resource in rolled back transaction",
- e);
- } // end of catch
-
- }
-
- /**
- * The <code>returnConnection</code> method
- *
- * @todo Probably the logic needs improvement if a connection
- * error occurred and we are destroying the handle.
- * @param ci a <code>ConnectionInfo</code> value
- * @param cra a <code>ConnectionReturnAction</code> value
- * @exception ResourceException if an error occurs
- */
- public void returnConnection(
- ConnectionInfo ci,
- ConnectionReturnAction cra) {
- try {
- Transaction tx = tm.getTransaction();
- if (TxUtils.isActive(tx)) {
- ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
- XAResource xares = mci.getXAResource();
- tx.delistResource(xares, XAResource.TMSUSPEND);
- mci.setTransaction(null);
- } // end of if ()
-
- } catch (SystemException e) {
- //throw new ResourceException("Could not get transaction", e);
- } // end of try-catch
+ public TransactionEnlistingInterceptor(
+ ConnectionInterceptor next,
+ TransactionManager tm) {
+ this.next = next;
+ this.tm = tm;
+ } // TransactionEnlistingInterceptor constructor
+
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
+ next.getConnection(ci);
+ try {
+ Transaction tx = tm.getTransaction();
+ if (TxUtils.isActive(tx)) {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ XAResource xares = mci.getXAResource();
+ tx.enlistResource(xares);
+ mci.setTransaction(tx);
+ } // end of if ()
+
+ } catch (SystemException e) {
+ throw new ResourceException("Could not get transaction", e);
+ } // end of try-catch
+ catch (RollbackException e) {
+ throw new ResourceException(
+ "Could not enlist resource in rolled back transaction",
+ e);
+ } // end of catch
+
+ }
+
+ /**
+ * The <code>returnConnection</code> method
+ *
+ * @todo Probably the logic needs improvement if a connection
+ * error occurred and we are destroying the handle.
+ * @param ci a <code>ConnectionInfo</code> value
+ * @param cra a <code>ConnectionReturnAction</code> value
+ * @exception ResourceException if an error occurs
+ */
+ public void returnConnection(
+ ConnectionInfo ci,
+ ConnectionReturnAction cra) {
+ try {
+ Transaction tx = tm.getTransaction();
+ if (TxUtils.isActive(tx)) {
+ ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
+ XAResource xares = mci.getXAResource();
+ tx.delistResource(xares, XAResource.TMSUSPEND);
+ mci.setTransaction(null);
+ } // end of if ()
+
+ } catch (SystemException e) {
+ //throw new ResourceException("Could not get transaction", e);
+ } // end of try-catch
- next.returnConnection(ci, cra);
- }
+ next.returnConnection(ci, cra);
+ }
} // TransactionEnlistingInterceptor
1.2 +4 -8 incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java
Index: XAResourceInsertionInterceptor.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/XAResourceInsertionInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XAResourceInsertionInterceptor.java 11 Nov 2003 21:11:56 -0000 1.1
+++ XAResourceInsertionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
@@ -66,25 +66,21 @@
*
* @version 1.0
*/
-public class XAResourceInsertionInterceptor implements ConnectionInterceptor
-{
+public class XAResourceInsertionInterceptor implements ConnectionInterceptor {
private final ConnectionInterceptor next;
- public XAResourceInsertionInterceptor(final ConnectionInterceptor next)
- {
+ public XAResourceInsertionInterceptor(final ConnectionInterceptor next) {
this.next = next;
} // XAResourceInsertionInterceptor constructor
- public void getConnection(ConnectionInfo ci) throws ResourceException
- {
+ public void getConnection(ConnectionInfo ci) throws ResourceException {
next.getConnection(ci);
ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
mci.setXAResource(mci.getManagedConnection().getXAResource());
}
- public void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra)
- {
+ public void returnConnection(ConnectionInfo ci, ConnectionReturnAction cra) {
next.returnConnection(ci, cra);
}