Skip to content
Permalink
Browse files
GERONIMO-4359 switch to slf4j
  • Loading branch information
djencks committed Oct 15, 2008
1 parent b253841 commit 2d3121d6e3949df49535dea3f70638a839ca21ab
Showing 19 changed files with 103 additions and 73 deletions.
@@ -38,6 +38,12 @@
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-transaction</artifactId>
@@ -17,28 +17,28 @@
package org.apache.geronimo.connector.outbound;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

import javax.resource.ResourceException;
import javax.resource.spi.ConnectionRequestInfo;
import javax.resource.spi.ManagedConnectionFactory;
import javax.resource.spi.ManagedConnection;
import javax.resource.spi.ManagedConnectionFactory;
import javax.security.auth.Subject;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @version $Rev$ $Date$
*/
public abstract class AbstractSinglePoolConnectionInterceptor implements ConnectionInterceptor, PoolingAttributes {
protected static Log log = LogFactory.getLog(AbstractSinglePoolConnectionInterceptor.class.getName());
protected static Logger log = LoggerFactory.getLogger(AbstractSinglePoolConnectionInterceptor.class);
protected final ConnectionInterceptor next;
private final ReadWriteLock resizeLock = new ReentrantReadWriteLock();
protected Semaphore permits;
@@ -19,13 +19,13 @@

import javax.transaction.TransactionManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PartitionedPool;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* GenericConnectionManager sets up a connection manager stack according to the
@@ -34,7 +34,7 @@
* @version $Rev$ $Date$
*/
public class GenericConnectionManager extends AbstractConnectionManager {
protected static final Log log = LogFactory.getLog(AbstractSinglePoolConnectionInterceptor.class.getName());
protected static final Logger log = LoggerFactory.getLogger(AbstractSinglePoolConnectionInterceptor.class);

//default constructor for use as endpoint
public GenericConnectionManager() {
@@ -25,8 +25,9 @@
import javax.resource.spi.ConnectionEvent;
import javax.resource.spi.ConnectionEventListener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* ConnectionEventListener.java
@@ -38,7 +39,7 @@
*/
public class GeronimoConnectionEventListener implements ConnectionEventListener {

private static Log log = LogFactory.getLog(GeronimoConnectionEventListener.class.getName());
private static Logger log = LoggerFactory.getLogger(GeronimoConnectionEventListener.class.getName());

private final ManagedConnectionInfo managedConnectionInfo;
private final ConnectionInterceptor stack;
@@ -20,18 +20,18 @@
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* MCFConnectionInterceptor.java
*
*
* @version $Rev$ $Date$
*/
public class MCFConnectionInterceptor implements ConnectionInterceptor {

protected static final Log log = LogFactory.getLog(MCFConnectionInterceptor.class.getName());
protected static final Logger log = LoggerFactory.getLogger(MCFConnectionInterceptor.class.getName());

private ConnectionInterceptor stack;

@@ -43,11 +43,11 @@ public void getConnection(ConnectionInfo connectionInfo) throws ResourceExceptio
if (mci.getManagedConnection() != null) {
return;
}

try {
ManagedConnection mc = mci.getManagedConnectionFactory().createManagedConnection(
mci.getSubject(),
mci.getConnectionRequestInfo());
mci.getSubject(),
mci.getConnectionRequestInfo());
mci.setManagedConnection(mc);
GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(stack, mci);
mci.setConnectionEventListener(listener);
@@ -77,7 +77,7 @@ public void returnConnection(
public void destroy() {
// MCF is the "tail" of the stack. So, we're all done...
}

public void setStack(ConnectionInterceptor stack) {
this.stack = stack;
}
@@ -24,8 +24,9 @@
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* SinglePoolConnectionInterceptor chooses a single connection from the pool. If selectOneAssumeMatch
@@ -39,7 +40,7 @@
* @version $Rev$ $Date$
*/
public class SinglePoolConnectionInterceptor extends AbstractSinglePoolConnectionInterceptor {
private static final Log log = LogFactory.getLog(SinglePoolConnectionInterceptor.class.getName());
private static final Logger log = LoggerFactory.getLogger(SinglePoolConnectionInterceptor.class.getName());

private boolean selectOneAssumeMatch;

@@ -25,10 +25,10 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.connector.ConnectionReleaser;
import org.apache.geronimo.connector.ConnectorTransactionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* TransactionCachingInterceptor.java
@@ -51,7 +51,7 @@
* @version 1.0
*/
public class TransactionCachingInterceptor implements ConnectionInterceptor, ConnectionReleaser {
protected static Log log = LogFactory.getLog(TransactionCachingInterceptor.class.getName());
protected static Logger log = LoggerFactory.getLogger(TransactionCachingInterceptor.class.getName());

private final ConnectionInterceptor next;
private final TransactionManager transactionManager;
@@ -80,13 +80,15 @@ public void getConnection(ConnectionInfo connectionInfo) throws ResourceExceptio
connectionInfo.setManagedConnectionInfo(managedConnectionInfo);
//return;
if (log.isTraceEnabled()) {
log.trace("supplying connection from tx cache " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
log.trace(
"supplying connection from tx cache " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
}
} else {
next.getConnection(connectionInfo);
managedConnectionInfos.setShared(connectionInfo.getManagedConnectionInfo());
if (log.isTraceEnabled()) {
log.trace("supplying connection from pool " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
log.trace(
"supplying connection from pool " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
}
}
}
@@ -110,7 +112,8 @@ public void returnConnection(ConnectionInfo connectionInfo, ConnectionReturnActi
if (transaction != null) {
if (TxUtil.isActive(transaction)) {
if (log.isTraceEnabled()) {
log.trace("tx active, not returning connection" + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
log.trace(
"tx active, not returning connection" + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
}
return;
}
@@ -134,14 +137,16 @@ public void returnConnection(ConnectionInfo connectionInfo, ConnectionReturnActi
private void internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) {
if (connectionInfo.getManagedConnectionInfo().hasConnectionHandles()) {
if (log.isTraceEnabled()) {
log.trace("not returning connection from tx cache (has handles) " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
log.trace(
"not returning connection from tx cache (has handles) " + connectionInfo.getConnectionHandle() + " for managed connection " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
}
return;
}
//No transaction, no handles, we return it.
next.returnConnection(connectionInfo, connectionReturnAction);
if (log.isTraceEnabled()) {
log.trace("completed return of connection through tx cache " + connectionInfo.getConnectionHandle() + " for MCI: " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
log.trace(
"completed return of connection through tx cache " + connectionInfo.getConnectionHandle() + " for MCI: " + connectionInfo.getManagedConnectionInfo() + " and MC " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " to tx caching interceptor " + this);
}
}

@@ -32,12 +32,12 @@
import javax.resource.ResourceException;
import javax.resource.spi.DissociatableManagedConnection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.connector.outbound.ConnectionInfo;
import org.apache.geronimo.connector.outbound.ConnectionReturnAction;
import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
import org.apache.geronimo.connector.outbound.ManagedConnectionInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* ConnectionTrackingCoordinator tracks connections that are in use by
@@ -56,7 +56,7 @@
* @version $Rev$ $Date$
*/
public class ConnectionTrackingCoordinator implements TrackedConnectionAssociator, ConnectionTracker {
private static final Log log = LogFactory.getLog(ConnectionTrackingCoordinator.class.getName());
private static final Logger log = LoggerFactory.getLogger(ConnectionTrackingCoordinator.class.getName());

private final boolean lazyConnect;
private final ThreadLocal<ConnectorInstanceContext> currentInstanceContexts = new ThreadLocal<ConnectorInstanceContext>();
@@ -19,15 +19,15 @@
import javax.resource.ResourceException;
import javax.transaction.Transaction;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @version $Rev$ $Date$
*/
public class GeronimoTransactionListener implements TransactionManagerMonitor {
private static final Log log = LogFactory.getLog(GeronimoTransactionListener.class);
private static final Logger log = LoggerFactory.getLogger(GeronimoTransactionListener.class);
private final TrackedConnectionAssociator trackedConnectionAssociator;

public GeronimoTransactionListener(TrackedConnectionAssociator trackedConnectionAssociator) {
@@ -32,10 +32,10 @@
import javax.transaction.SystemException;
import javax.transaction.xa.XAException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.transaction.manager.ImportedTransactionActiveException;
import org.apache.geronimo.transaction.manager.XAWork;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Work wrapper providing an execution context to a Work instance.
@@ -44,7 +44,7 @@
*/
public class WorkerContext implements Work {

private static final Log log = LogFactory.getLog(WorkerContext.class);
private static final Logger log = LoggerFactory.getLogger(WorkerContext.class);

/**
* Null WorkListener used as the default WorkListener.
@@ -21,8 +21,9 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* Based class for WorkExecutorPool. Sub-classes define the synchronization
@@ -37,7 +38,7 @@ public class WorkExecutorPoolImpl implements WorkExecutorPool {
* A timed out pooled executor.
*/
private ThreadPoolExecutor pooledExecutor;
private static Log log = LogFactory.getLog(WorkExecutorPoolImpl.class);
private static Logger log = LoggerFactory.getLogger(WorkExecutorPoolImpl.class);

/**
* Creates a pool with the specified minimum and maximum sizes. The Channel
@@ -39,8 +39,8 @@
import org.apache.geronimo.connector.outbound.connectiontracking.GeronimoTransactionListener;
import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;

/**
@@ -49,7 +49,7 @@
* @version $Rev$ $Date$
*/
public class ConnectionManagerTestUtils extends TestCase implements DefaultInterceptor {
protected static final Log log = LogFactory.getLog(ConnectionManagerTestUtils.class);
protected static final Logger log = LoggerFactory.getLogger(ConnectionManagerTestUtils.class);

protected boolean useTransactionCaching = true;
protected boolean useLocalTransactions = false;
@@ -32,10 +32,10 @@
import javax.resource.spi.work.WorkListener;

import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
import org.apache.geronimo.transaction.manager.XAWork;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Timing is crucial for this test case, which focuses on the synchronization
@@ -251,7 +251,7 @@ protected void perform(Work work,
}

public static class DummyWork implements Work {
private Log log = LogFactory.getLog(getClass());
private Logger log = LoggerFactory.getLogger(getClass());

private final String name;
private final int tempo;
@@ -278,7 +278,7 @@ public String toString() {
}

public static class DummyWorkListener implements WorkListener {
private Log log = LogFactory.getLog(getClass());
private Logger log = LoggerFactory.getLogger(getClass());

public WorkEvent acceptedEvent;
public WorkEvent rejectedEvent;
@@ -39,10 +39,16 @@

<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>

0 comments on commit 2d3121d

Please sign in to comment.