Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.LinkedQueue


   public void testQueue() throws Exception
   {
      HashSet threads = new HashSet();

      // A chhanel of communication between workers and the test method
      LinkedQueue testChannel = new LinkedQueue();


      for (int i=0; i< NUMBER_OF_PRODUCERS; i++)
      {
         threads.add(new SeveralClientsStressTest.Producer(i, testChannel));
      }

      for (int i=0; i< NUMBER_OF_CONSUMERS; i++)
      {
         threads.add(new SeveralClientsStressTest.Consumer(i, testChannel));
      }


      for (Iterator iter = threads.iterator(); iter.hasNext();)
      {
         Worker worker = (Worker)iter.next();
         worker.start();
      }

      long timeToFinish = System.currentTimeMillis() + TEST_ALIVE_FOR;

      int numberOfProducers = NUMBER_OF_PRODUCERS +1;
      int numberOfConsumers = NUMBER_OF_CONSUMERS +1;

      while (threads.size()>0)
      {
         SeveralClientsStressTest.InternalMessage msg = (SeveralClientsStressTest.InternalMessage)testChannel.poll(2000);

         log.info("Produced:" + producedMessages.get() + " and Consumed:" + readMessages.get() + " messages");

         if (msg!=null)
         {
View Full Code Here


     * @param keepAliveTime
     */
    private void createDynamicThreadPool(final int threadPoolMinSize,
                                         final int threadPoolInitSize,
                                         final int keepAliveTime) {
        m_threadPool = new PooledExecutor(new LinkedQueue());
        m_threadPool.setKeepAliveTime(keepAliveTime);
        m_threadPool.createThreads(threadPoolInitSize);
        m_threadPool.setMinimumPoolSize(threadPoolMinSize);
    }
View Full Code Here

     */
    protected void createDynamicThreadPool(
            final int threadPoolMinSize,
            final int threadPoolInitSize,
            final int keepAliveTime) {
        m_threadPool = new PooledExecutor(new LinkedQueue());
        m_threadPool.setKeepAliveTime(keepAliveTime);
        m_threadPool.createThreads(threadPoolInitSize);
        m_threadPool.setMinimumPoolSize(threadPoolMinSize);
    }
View Full Code Here

    private JournalTransactionStore transactionStore = new JournalTransactionStore(this);
    private int logFileSize=1024*1024*20;
    private int logFileCount=2;

    public JournalPersistenceAdapter() {
        checkpointExecutor = new QueuedExecutor(new LinkedQueue());
        checkpointExecutor.setThreadFactory(new ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                Thread answer = new Thread(runnable, "Checkpoint Worker");
                answer.setDaemon(true);
                answer.setPriority(Thread.MAX_PRIORITY);
View Full Code Here

/* 1625 */       this.failoverMap = new ConcurrentHashMap();
/*      */
/* 1627 */       this.leftSet = new ConcurrentHashSet();
/*      */     }
/*      */
/* 1631 */     this.replyExecutor = new QueuedExecutor(new LinkedQueue());
/*      */
/* 1633 */     this.replicateResponseExecutor = new QueuedExecutor(new LinkedQueue());
/*      */   }
View Full Code Here

/* 140 */     if (transacted)
/*     */     {
/* 143 */       this.currentTxId = parent.getResourceManager().createLocalTx();
/*     */     }
/*     */
/* 146 */     this.executor = new ClearableQueuedExecutor(new LinkedQueue());
/*     */
/* 148 */     this.clientAckList = new ArrayList();
/*     */
/* 152 */     this.callbackHandlers = new HashMap();
/*     */   }
View Full Code Here

     */
    private void createDynamicThreadPool(
            final int threadPoolMinSize,
            final int threadPoolInitSize,
            final int keepAliveTime) {
        m_threadPool = new PooledExecutor(new LinkedQueue());
        m_threadPool.setKeepAliveTime(keepAliveTime);
        m_threadPool.createThreads(threadPoolInitSize);
        m_threadPool.setMinimumPoolSize(threadPoolMinSize);
    }
View Full Code Here

     */
    protected void createDynamicThreadPool(
            final int threadPoolMinSize,
            final int threadPoolInitSize,
            final int keepAliveTime) {
        m_threadPool = new PooledExecutor(new LinkedQueue());
        m_threadPool.setKeepAliveTime(keepAliveTime);
        m_threadPool.createThreads(threadPoolInitSize);
        m_threadPool.setMinimumPoolSize(threadPoolMinSize);
    }
View Full Code Here

     * one.
     *
     * @param maxSize Maximum size of the work executor pool.
     */
    public WorkExecutorPoolImpl(int maxSize) {
        pooledExecutor = new PooledExecutor(new LinkedQueue(), maxSize);
        pooledExecutor.setMinimumPoolSize(maxSize);
        pooledExecutor.waitWhenBlocked();
    }
View Full Code Here


      HashSet threads = new HashSet();

      // A chhanel of communication between workers and the test method
      LinkedQueue testChannel = new LinkedQueue();


      for (int i=0; i< NUMBER_OF_PRODUCERS; i++)
      {
         threads.add(new SeveralClientsStressTest.Producer(i, testChannel));
      }

      for (int i=0; i< NUMBER_OF_CONSUMERS; i++)
      {
         threads.add(new SeveralClientsStressTest.Consumer(i, testChannel));
      }


      for (Iterator iter = threads.iterator(); iter.hasNext();)
      {
         Worker worker = (Worker)iter.next();
         worker.start();
      }

      long timeToFinish = System.currentTimeMillis() + TEST_ALIVE_FOR;

      int numberOfProducers = NUMBER_OF_PRODUCERS;
      int numberOfConsumers = NUMBER_OF_CONSUMERS;

      while (threads.size()>0)
      {
         SeveralClientsStressTest.InternalMessage msg = (SeveralClientsStressTest.InternalMessage)testChannel.poll(2000);

         log.info("Produced:" + producedMessages.get() + " and Consumed:" + readMessages.get() + " messages");

         if (msg!=null)
         {
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.LinkedQueue

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.