activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: polish
Date Mon, 04 Nov 2013 21:51:29 GMT
Updated Branches:
  refs/heads/trunk 4e3595d48 -> d87299426


polish

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/d8729942
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/d8729942
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/d8729942

Branch: refs/heads/trunk
Commit: d872994260df2f7591f35d6a260cb474e9508e4d
Parents: 4e3595d
Author: Timothy Bish <tabish121@gmai.com>
Authored: Mon Nov 4 16:50:37 2013 -0500
Committer: Timothy Bish <tabish121@gmai.com>
Committed: Mon Nov 4 16:51:09 2013 -0500

----------------------------------------------------------------------
 .../jms/pool/PooledConnectionFactory.java       | 96 ++++++++++----------
 1 file changed, 48 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/d8729942/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
index bf49f2d..64eaad2 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java
@@ -21,8 +21,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
-
 import javax.jms.XAConnectionFactory;
+
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericKeyedObjectPool;
 import org.slf4j.Logger;
@@ -71,62 +71,61 @@ public class PooledConnectionFactory implements ConnectionFactory {
     private long expiryTimeout = 0l;
     private boolean createConnectionOnStartup = true;
 
-
     public void initConnectionsPool() {
         if (this.connectionsPool == null) {
             this.connectionsPool = new GenericKeyedObjectPool<ConnectionKey, ConnectionPool>(
-                    new KeyedPoolableObjectFactory<ConnectionKey, ConnectionPool>()
{
+                new KeyedPoolableObjectFactory<ConnectionKey, ConnectionPool>() {
 
-                        @Override
-                        public void activateObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
-                        }
+                    @Override
+                    public void activateObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
+                    }
 
-                        @Override
-                        public void destroyObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
-                            try {
-                                if (LOG.isTraceEnabled()) {
-                                    LOG.trace("Destroying connection: {}", connection);
-                                }
-                                connection.close();
-                            } catch (Exception e) {
-                                LOG.warn("Close connection failed for connection: " + connection
+ ". This exception will be ignored.",e);
+                    @Override
+                    public void destroyObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
+                        try {
+                            if (LOG.isTraceEnabled()) {
+                                LOG.trace("Destroying connection: {}", connection);
                             }
+                            connection.close();
+                        } catch (Exception e) {
+                            LOG.warn("Close connection failed for connection: " + connection
+ ". This exception will be ignored.",e);
                         }
+                    }
 
-                        @Override
-                        public ConnectionPool makeObject(ConnectionKey key) throws Exception
{
-                            Connection delegate = createConnection(key);
+                    @Override
+                    public ConnectionPool makeObject(ConnectionKey key) throws Exception
{
+                        Connection delegate = createConnection(key);
 
-                            ConnectionPool connection = createConnectionPool(delegate);
-                            connection.setIdleTimeout(getIdleTimeout());
-                            connection.setExpiryTimeout(getExpiryTimeout());
-                            connection.setMaximumActiveSessionPerConnection(getMaximumActiveSessionPerConnection());
-                            connection.setBlockIfSessionPoolIsFull(isBlockIfSessionPoolIsFull());
+                        ConnectionPool connection = createConnectionPool(delegate);
+                        connection.setIdleTimeout(getIdleTimeout());
+                        connection.setExpiryTimeout(getExpiryTimeout());
+                        connection.setMaximumActiveSessionPerConnection(getMaximumActiveSessionPerConnection());
+                        connection.setBlockIfSessionPoolIsFull(isBlockIfSessionPoolIsFull());
 
-                            if (LOG.isTraceEnabled()) {
-                                LOG.trace("Created new connection: {}", connection);
-                            }
-
-                            return connection;
+                        if (LOG.isTraceEnabled()) {
+                            LOG.trace("Created new connection: {}", connection);
                         }
 
-                        @Override
-                        public void passivateObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
-                        }
+                        return connection;
+                    }
 
-                        @Override
-                        public boolean validateObject(ConnectionKey key, ConnectionPool connection)
{
-                            if (connection != null && connection.expiredCheck())
{
-                                if (LOG.isTraceEnabled()) {
-                                    LOG.trace("Connection has expired: {} and will be destroyed",
connection);
-                                }
+                    @Override
+                    public void passivateObject(ConnectionKey key, ConnectionPool connection)
throws Exception {
+                    }
 
-                                return false;
+                    @Override
+                    public boolean validateObject(ConnectionKey key, ConnectionPool connection)
{
+                        if (connection != null && connection.expiredCheck()) {
+                            if (LOG.isTraceEnabled()) {
+                                LOG.trace("Connection has expired: {} and will be destroyed",
connection);
                             }
 
-                            return true;
+                            return false;
                         }
-                    });
+
+                        return true;
+                    }
+                });
 
             // Set max idle (not max active) since our connections always idle in the pool.
             this.connectionsPool.setMaxIdle(1);
@@ -157,13 +156,15 @@ public class PooledConnectionFactory implements ConnectionFactory {
     public void setConnectionFactory(final ConnectionFactory toUse) {
         if (toUse instanceof XAConnectionFactory) {
             connectionFactory = new ConnectionFactory() {
-                        public Connection createConnection() throws JMSException {
-                            return ((XAConnectionFactory)toUse).createXAConnection();
-                        }
-                        public Connection createConnection(String userName, String password)
throws JMSException {
-                            return ((XAConnectionFactory)toUse).createXAConnection(userName,
password);
-                        }
-                    };
+                @Override
+                public Connection createConnection() throws JMSException {
+                    return ((XAConnectionFactory)toUse).createXAConnection();
+                }
+                @Override
+                public Connection createConnection(String userName, String password) throws
JMSException {
+                    return ((XAConnectionFactory)toUse).createXAConnection(userName, password);
+                }
+            };
         } else {
             this.connectionFactory = toUse;
         }
@@ -475,5 +476,4 @@ public class PooledConnectionFactory implements ConnectionFactory {
     protected ConnectionPool createConnectionPool(Connection connection) {
         return new ConnectionPool(connection);
     }
-
 }


Mime
View raw message