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/19 10:45:57 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound GeronimoConnectionEventListener.java SinglePoolConnectionInterceptor.java
djencks 2003/11/19 01:45:57
Modified: modules/core/src/java/org/apache/geronimo/connector/outbound
GeronimoConnectionEventListener.java
SinglePoolConnectionInterceptor.java
Log:
Add a little logging and fix a stupid bug
Revision Changes Path
1.3 +9 -0 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GeronimoConnectionEventListener.java 14 Nov 2003 16:00:23 -0000 1.2
+++ GeronimoConnectionEventListener.java 19 Nov 2003 09:45:57 -0000 1.3
@@ -62,6 +62,9 @@
import javax.resource.spi.ConnectionEvent;
import javax.resource.spi.ConnectionEventListener;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
/**
* ConnectionEventListener.java
*
@@ -73,6 +76,8 @@
public class GeronimoConnectionEventListener
implements ConnectionEventListener {
+ private static Log log = LogFactory.getLog(GeronimoConnectionEventListener.class.getName());
+
private final ManagedConnectionInfo mci;
private final ConnectionInterceptor stack;
private final Set connectionHandles = new HashSet();
@@ -97,6 +102,9 @@
+ ", actual "
+ connectionEvent.getSource());
} // end of if ()
+ if (log.isTraceEnabled()) {
+ log.trace("connectionClosed called with " + connectionEvent.getConnectionHandle());
+ }
ConnectionInfo ci = new ConnectionInfo(mci);
ci.setConnectionHandle(connectionEvent.getConnectionHandle());
stack.returnConnection(ci, ConnectionReturnAction.RETURN_HANDLE);
@@ -115,6 +123,7 @@
+ ", actual "
+ connectionEvent.getSource());
} // end of if ()
+ log.info("connectionErrorOccurred called with " + connectionEvent.getConnectionHandle(),connectionEvent.getException());
ConnectionInfo ci = new ConnectionInfo(mci);
ci.setConnectionHandle(connectionEvent.getConnectionHandle());
stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
1.3 +17 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SinglePoolConnectionInterceptor.java 14 Nov 2003 16:00:23 -0000 1.2
+++ SinglePoolConnectionInterceptor.java 19 Nov 2003 09:45:57 -0000 1.3
@@ -64,6 +64,8 @@
import javax.security.auth.Subject;
import EDU.oswego.cs.dl.util.concurrent.FIFOSemaphore;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* SinglePoolConnectionInterceptor.java
@@ -76,6 +78,9 @@
*/
public class SinglePoolConnectionInterceptor implements ConnectionInterceptor {
+ private static Log log = LogFactory.getLog(GeronimoConnectionEventListener.class.getName());
+
+
private final ConnectionInterceptor next;
private FIFOSemaphore permits;
@@ -113,6 +118,9 @@
synchronized (pool) {
if (pool.isEmpty()) {
next.getConnection(ci);
+ if (log.isTraceEnabled()) {
+ log.trace("Returning new connection " + ci.getManagedConnectionInfo());
+ }
return;
} else {
newMCI = (ManagedConnectionInfo) pool.removeFirst();
@@ -128,6 +136,9 @@
mci.getConnectionRequestInfo());
if (matchedMC != null) {
ci.setManagedConnectionInfo(newMCI);
+ if (log.isTraceEnabled()) {
+ log.trace("Returning pooled connection " + ci.getManagedConnectionInfo());
+ }
return;
} else {
//matching failed.
@@ -165,6 +176,9 @@
public void returnConnection(
ConnectionInfo ci,
ConnectionReturnAction cra) {
+ if (log.isTraceEnabled()) {
+ log.trace("returning connection" + ci.getConnectionHandle());
+ }
boolean wasInPool = false;
ManagedConnectionInfo mci = ci.getManagedConnectionInfo();
if (cra == ConnectionReturnAction.DESTROY) {
@@ -185,7 +199,6 @@
}
if (cra == ConnectionReturnAction.DESTROY) {
-
next.returnConnection(ci, cra);
} else {
synchronized (pool) {
@@ -195,6 +208,9 @@
} // end of else
+ if (!wasInPool) {
+ permits.release();
+ }
}
static class PoolDeque {