Package org.jboss.jca.core.connectionmanager.pool.mcp

Examples of org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool


      //Find sub-pool related with key
      SubPoolContext subPoolContext = getSubPool(key, subject, cri);

      //Sub-pool internal managed connection pool
      ManagedConnectionPool imcp = subPoolContext.getSubPool();

      // Are we doing track by transaction?
      TransactionLocal trackByTx = subPoolContext.getTrackByTx()// TODO - Use TSR

      if (trackByTransaction == null || trackByTx == null)
View Full Code Here


   private ConnectionListener getSimpleConnection(final Subject subject, final ConnectionRequestInfo cri,
         final SubPoolContext subPoolContext)
      throws ResourceException
   {
      ConnectionListener cl = null;
      ManagedConnectionPool imcp = null;

      try
      {
         //Find internal managed pool
         imcp = subPoolContext.getSubPool();

         //Get connection from imcp
         cl = imcp.getConnection(subject, cri);

         if (trace)
         {
            dump("Got connection from pool : " + cl);
         }

         return cl;

      }
      catch (ResourceException re)
      {
         if (re instanceof RetryableException)
         {
            if (log.isDebugEnabled())
               log.debug("Got a RetryableException - trying to reinitialize the pool");

            // The IMCP is down - retry
            imcp = subPoolContext.getSubPool();

            // Make sure that IMCP is running
            if (!imcp.isRunning())
               imcp.reenable();

            //Getting connection from pool
            cl = imcp.getConnection(subject, cri);
            if (trace)
               dump("Got connection from pool (retried) " + cl);

            return cl;
         }
View Full Code Here

    */
   public void returnConnection(ConnectionListener cl, boolean kill) throws ResourceException
   {
      cl.setTrackByTx(false);
      //Get connection listener pool
      ManagedConnectionPool mcp = (ManagedConnectionPool) cl.getContext();

      //Return connection to the pool
      mcp.returnConnection(cl, kill);

      if (trace)
      {
         dump("Returning connection to pool " + cl);
      }
View Full Code Here

            if (!isInterleaving())
            {
               cl.setTrackByTx(true);

               ManagedConnectionPool mcp = (ManagedConnectionPool)cl.getContext();
               Transaction tx = transactionManager.getTransaction();

               // The lock will be initialized when the first connection listener is obtained
               Lock lock = (Lock)transactionSynchronizationRegistry.getResource(LockKey.INSTANCE);
               try
View Full Code Here

   protected ManagedConnectionPool getManagedConnectionPool(Object key, Subject subject, ConnectionRequestInfo cri)
      throws ResourceException
   {
      try
      {
         ManagedConnectionPool mcp = mcpPools.get(key);
         if (mcp == null)
         {
            ManagedConnectionPoolFactory mcpf = new ManagedConnectionPoolFactory();
            ManagedConnectionPool newMcp = mcpf.create(mcf, clf, subject, cri, poolConfiguration, this);

            mcp = mcpPools.putIfAbsent(key, newMcp);
            if (mcp == null)
            {
               mcp = newMcp;
View Full Code Here

      {
         Iterator<ManagedConnectionPool> it = mcpPools.values().iterator();

         while (it.hasNext())
         {
            ManagedConnectionPool other = it.next();
            if (other == pool && pool.isEmpty())
            {
               pool.shutdown();
               it.remove();
               break;
View Full Code Here

      Set<ManagedConnectionPool> clearMcpPools = new HashSet<ManagedConnectionPool>();

      Iterator<ManagedConnectionPool> it = mcpPools.values().iterator();
      while (it.hasNext())
      {
         ManagedConnectionPool mcp = it.next();
         mcp.flush(kill);

         if (mcp.isEmpty())
            clearMcpPools.add(mcp);
      }

      if (clearMcpPools.size() > 0)
      {
         for (ManagedConnectionPool mcp : clearMcpPools)
         {
            mcp.shutdown();
            mcpPools.values().remove(mcp);
         }
      }
   }
View Full Code Here

      // Get specific managed connection pool key
      Object key = getKey(subject, cri, separateNoTx);

      // Get managed connection pool
      ManagedConnectionPool mcp = getManagedConnectionPool(key, subject, cri);

      // Are we doing track by transaction ?
      TransactionSynchronizationRegistry tsr = getTransactionSynchronizationRegistry();
      Object transactionKey = tsr != null ? tsr.getTransactionKey() : null;
View Full Code Here

    */
   public void returnConnection(ConnectionListener cl, boolean kill) throws ResourceException
   {
      cl.setTrackByTx(false);
      //Get connection listener pool
      ManagedConnectionPool mcp = (ManagedConnectionPool) cl.getContext();

      //Return connection to the pool
      mcp.returnConnection(cl, kill);

      if (trace)
         log.tracef("Returning connection to pool %s", cl);
   }
View Full Code Here

            if (!isInterleaving())
            {
               cl.setTrackByTx(true);

               ManagedConnectionPool mcp = (ManagedConnectionPool)cl.getContext();
               Transaction tx = transactionManager.getTransaction();

               // The lock may need to be initialized if we are in the first lazy enlistment
               Lock lock = getLock();
               try
View Full Code Here

TOP

Related Classes of org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.