FileDocCategorySizeDatePackage
PoolFiller.javaAPI DocJBoss 4.2.13087Fri Jul 13 21:01:18 BST 2007org.jboss.resource.connectionmanager

PoolFiller

public class PoolFiller extends Object implements Runnable
PoolFiller
author
David Jencks
author
Scott.Stark@jboss.org
author
Adrian Brock
version
$Revision: 60788 $

Fields Summary
private final LinkedList
pools
private final Thread
fillerThread
private static final PoolFiller
filler
Constructors Summary
public PoolFiller()

      fillerThread = new Thread(this, "JCA PoolFiller");
      fillerThread.start();
   
Methods Summary
public static voidfillPool(InternalManagedConnectionPool mcp)


       
   
      filler.internalFillPool(mcp);
   
private voidinternalFillPool(InternalManagedConnectionPool mcp)

      synchronized (pools)
      {
         pools.addLast(mcp);
         pools.notify();
      }
   
public voidrun()

      ClassLoader myClassLoader = getClass().getClassLoader();
      Thread.currentThread().setContextClassLoader(myClassLoader);
      //keep going unless interrupted
      while (true)
      {
         try 
         {
            InternalManagedConnectionPool mcp = null;
            //keep iterating through pools till empty, exception escapes.
            while (true)
            {
                     
               synchronized (pools)
               {
                  mcp = (InternalManagedConnectionPool)pools.removeFirst();
               }
               if (mcp == null) 
                  break;
                        
               mcp.fillToMin();
            }
         }
         catch (Exception e)
         {
         }
                        
         try 
         {
            synchronized (pools)
            {
               while(pools.isEmpty())
               {
                  pools.wait();                        
                  
               }
            }
         }
         catch (InterruptedException ie)
         {
            return;
         }
      }