Search in sources :

Example 1 with ConnectionPool

use of org.apache.activemq.jms.pool.ConnectionPool in project jim-framework by jiangmin168168.

the class ProductController method test.

@RequestMapping("/test/{productId}")
public Long test(@PathVariable final long productId) {
    productProducer.sendMessage(productId);
    Map<String, PooledConnectionFactory> pooledConnectionFactoryMap = ConnectionFactoryContainer.getAllPooledConnectionFactory();
    for (Map.Entry<String, PooledConnectionFactory> entry : pooledConnectionFactoryMap.entrySet()) {
        JimPooledConnectionFactory jimPooledConnectionFactory = (JimPooledConnectionFactory) entry.getValue();
        // jimPooledConnectionFactory.setExpiryTimeout();
        GenericKeyedObjectPool<ConnectionKey, ConnectionPool> jimConnectionsPool = ((JimPooledConnectionFactory) entry.getValue()).getJimConnectionsPool();
        // jimConnectionsPool.
        jimConnectionsPool.clearOldest();
        // jimConnectionsPool.set
        Map<String, List<DefaultPooledObjectInfo>> defStringListMap = jimConnectionsPool.listAllObjects();
        for (Map.Entry<String, List<DefaultPooledObjectInfo>> entry1 : defStringListMap.entrySet()) {
            List<DefaultPooledObjectInfo> defaultPooledObjectInfos = entry1.getValue();
            System.out.println("123");
            for (DefaultPooledObjectInfo defaultPooledObjectInfo : defaultPooledObjectInfos) {
                // defaultPooledObjectInfo.
                System.out.println("123");
            // ((ConnectionPool)defaultPooledObjectInfo.pooledObject.getObject()).connection;
            }
        }
        // jimConnectionsPool.get
        System.out.println("123");
    // ((ObjectDeque)((java.util.concurrent.ConcurrentHashMap.MapEntry)((java.util.concurrent.ConcurrentHashMap)jimConnectionsPool.poolMap).entrySet().toArray()[0]).getValue()).allObjects
    }
    return productId;
}
Also used : ConnectionPool(org.apache.activemq.jms.pool.ConnectionPool) DefaultPooledObjectInfo(org.apache.commons.pool2.impl.DefaultPooledObjectInfo) ConnectionKey(org.apache.activemq.jms.pool.ConnectionKey) JimPooledConnectionFactory(com.jim.framework.activemq.producer.JimPooledConnectionFactory) JimPooledConnectionFactory(com.jim.framework.activemq.producer.JimPooledConnectionFactory) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) List(java.util.List) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JimPooledConnectionFactory (com.jim.framework.activemq.producer.JimPooledConnectionFactory)1 List (java.util.List)1 Map (java.util.Map)1 ConnectionKey (org.apache.activemq.jms.pool.ConnectionKey)1 ConnectionPool (org.apache.activemq.jms.pool.ConnectionPool)1 PooledConnectionFactory (org.apache.activemq.pool.PooledConnectionFactory)1 DefaultPooledObjectInfo (org.apache.commons.pool2.impl.DefaultPooledObjectInfo)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1