Package java.util.concurrent

Examples of java.util.concurrent.ThreadPoolExecutor.execute()


    final ExecutorService threadPool = new ThreadPoolExecutor(3, 3,
                                  0L, TimeUnit.MILLISECONDS,
                                  new LinkedBlockingQueue<Runnable>(),
                                  new TestThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
    for (int i = 0; i < 20; i++)
    threadPool.execute(new Runnable () {
      public void run()
      {
        try
        {
          runSingleGoldReport("Prd-3931.prpt", ReportProcessingMode.current);
View Full Code Here


        }
        if (p == null) {
            throw new IllegalStateException("ThreadPool has been stopped");
        }
        Runnable task = new ContextClassLoaderRunnable(command, classLoader);
        p.execute(task);
    }

    private synchronized void startWork(String consumerName) {
        Integer test = clients.get(consumerName);
        if (test == null) {
View Full Code Here

            objectsLimit, errorHandler, idFetchSize
        ));
    //execIdentifiersLoader has size 1 and is not configurable: ensures the list is consistent as produced by one transaction
    final ThreadPoolExecutor execIdentifiersLoader = Executors.newFixedThreadPool( 1, "identifierloader" );
    try {
      execIdentifiersLoader.execute( primaryKeyOutputter );
    }
    finally {
      execIdentifiersLoader.shutdown();
    }
  }
View Full Code Here

            idNameOfIndexedType, backend, errorHandler
        ));
    final ThreadPoolExecutor execFirstLoader = Executors.newFixedThreadPool( documentBuilderThreads, "entityloader" );
    try {
      for ( int i = 0; i < documentBuilderThreads; i++ ) {
        execFirstLoader.execute( documentOutputter );
      }
    }
    finally {
      execFirstLoader.shutdown();
    }
View Full Code Here

      if (priority != Store.NO_PRIORITY) {
        cr.setPriority(priority);
      }
      ThreadPoolExecutor pool = s.throttleCompaction(cr.getSize())
          ? largeCompactions : smallCompactions;
      pool.execute(cr);
      if (LOG.isDebugEnabled()) {
        String type = (pool == smallCompactions) ? "Small " : "Large ";
        LOG.debug(type + "Compaction requested: " + cr
            + (why != null && !why.isEmpty() ? "; Because: " + why : "")
            + "; " + this);
View Full Code Here

        //only uses the queue if we've reached the maximum number
        //of threads.   Thus, we'll set the core size to the max,
        //add the runnable, and set back.  That will cause the
        //threads to be created as needed.
        ThreadPoolExecutor ex = getExecutor();
        ex.execute(r);
        if (!ex.getQueue().isEmpty() && this.getPoolSize() < highWaterMark) {
            mainLock.lock();
            try {
                int ps = this.getPoolSize();
                int sz = executor.getQueue().size();
View Full Code Here

        while (iterator.hasNext()) {
            ids.add(iterator.next());

            if (ids.size() > getBatchCount()) {
                count += ids.size();
                executorService.execute(new Sweeper(ids, exceptionQueue));
                ids = Lists.newArrayList();
            }
        }
        if (!ids.isEmpty()) {
            count += ids.size();
View Full Code Here

                ids = Lists.newArrayList();
            }
        }
        if (!ids.isEmpty()) {
            count += ids.size();
            executorService.execute(new Sweeper(ids, exceptionQueue));
        }

        try {
            executorService.shutdown();
            executorService.awaitTermination(100, TimeUnit.MINUTES);
View Full Code Here

            objectsLimit, errorHandler, idFetchSize
        ));
    //execIdentifiersLoader has size 1 and is not configurable: ensures the list is consistent as produced by one transaction
    final ThreadPoolExecutor execIdentifiersLoader = Executors.newFixedThreadPool( 1, "identifierloader" );
    try {
      execIdentifiersLoader.execute( primaryKeyOutputter );
    }
    finally {
      execIdentifiersLoader.shutdown();
    }
  }
View Full Code Here

            idNameOfIndexedType, backend, errorHandler
        ));
    final ThreadPoolExecutor execFirstLoader = Executors.newFixedThreadPool( documentBuilderThreads, "entityloader" );
    try {
      for ( int i = 0; i < documentBuilderThreads; i++ ) {
        execFirstLoader.execute( documentOutputter );
      }
    }
    finally {
      execFirstLoader.shutdown();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.