Package org.apache.accumulo.core.util

Examples of org.apache.accumulo.core.util.SimpleThreadPool


    private Map<String,TabletLocator> locators;
   
    public MutationWriter(int numSendThreads) {
      serversMutations = new HashMap<String,TabletServerMutations>();
      queued = new HashSet<String>();
      sendThreadPool = new SimpleThreadPool(numSendThreads, this.getClass().getName());
      locators = new HashMap<String,TabletLocator>();
    }
View Full Code Here


    options.maxReadBufferBytes = maxMessageSize;
    options.stopTimeoutVal(5);
    /*
     * Create our own very special thread pool.
     */
    final ThreadPoolExecutor pool = new SimpleThreadPool(numThreads, "ClientPool");
    // periodically adjust the number of threads we need by checking how busy our threads are
    SimpleTimer.getInstance().schedule(new Runnable() {
      @Override
      public void run() {
        if (pool.getCorePoolSize() <= pool.getActiveCount()) {
          int larger = pool.getCorePoolSize() + Math.min(pool.getQueue().size(), 2);
          log.info("Increasing server thread pool size on " + serverName + " to " + larger);
          pool.setMaximumPoolSize(larger);
          pool.setCorePoolSize(larger);
        } else {
          if (pool.getCorePoolSize() > pool.getActiveCount() + 3) {
            int smaller = Math.max(numThreads, pool.getCorePoolSize() - 1);
            if (smaller != pool.getCorePoolSize()) {
              // ACCUMULO-2997 there is a race condition here... the active count could be higher by the time
              // we decrease the core pool size... so the active count could end up higher than
              // the core pool size, in which case everything will be queued... the increase case
              // should handle this and prevent deadlock
              log.info("Decreasing server thread pool size on " + serverName + " to " + smaller);
              pool.setCorePoolSize(smaller);
            }
          }
        }
      }
    }, timeBetweenThreadChecks, timeBetweenThreadChecks);
View Full Code Here

  }

  private static synchronized ExecutorService getThreadPool(Master master) {
    if (threadPool == null) {
      int threadPoolSize = master.getSystemConfiguration().getCount(Property.MASTER_BULK_THREADPOOL_SIZE);
      ThreadPoolExecutor pool = new SimpleThreadPool(threadPoolSize, "bulk import");
      pool.allowCoreThreadTimeOut(true);
      threadPool = new TraceExecutorService(pool);
    }
    return threadPool;
  }
View Full Code Here

      throw new RuntimeException("Failed to start the tablet client service");
    }
    clientAddress = new InetSocketAddress(clientAddress.getAddress(), clientPort);
    announceExistence();
   
    ThreadPoolExecutor distWorkQThreadPool = new SimpleThreadPool(getSystemConfiguration().getCount(Property.TSERV_WORKQ_THREADS), "distributed work queue");
   
    bulkFailedCopyQ = new DistributedWorkQueue(ZooUtil.getRoot(instance) + Constants.ZBULK_FAILED_COPYQ);
    try {
      bulkFailedCopyQ.startProcessing(new BulkFailedCopyProcessor(), distWorkQThreadPool);
    } catch (Exception e1) {
View Full Code Here

      splits.add(new Text(new byte[]{0, 0, i}));
    }

    List<Future<?>> results = new ArrayList<Future<?>>();
    List<Runnable> tasks = new ArrayList<Runnable>();
    SimpleThreadPool es = new SimpleThreadPool(tableNames.length, "concurrent-api-requests");
    for (String tableName : tableNames) {
      final String finalName = tableName;
      tasks.add(new Runnable() {
        @Override
        public void run() {
          try {
            getConnector().tableOperations().addSplits(finalName, splits);
          } catch (TableNotFoundException ex) {
          } catch (Exception ex) {
            throw new RuntimeException(finalName, ex);
          }
        }
      });
      tasks.add(new Runnable() {
        @Override
        public void run() {
          try {
            UtilWaitThread.sleep(500);
            getConnector().tableOperations().delete(finalName);
          } catch (Exception ex) {
            throw new RuntimeException(ex);
          }
        }
      });
    }
    for (Runnable r : tasks)
      results.add(es.submit(r));
    for (Future<?> f : results) {
      f.get();
    }
    for (String tableName : tableNames) {
      assertFalse(getConnector().tableOperations().exists(tableName));
View Full Code Here

  public LogSorter(Instance instance, FileSystem fs, AccumuloConfiguration conf) {
    this.instance = instance;
    this.fs = fs;
    this.conf = conf;
    int threadPoolSize = conf.getCount(Property.TSERV_RECOVERY_MAX_CONCURRENT);
    this.threadPool = new SimpleThreadPool(threadPoolSize, this.getClass().getName());
  }
View Full Code Here

      throw new RuntimeException("Failed to start the tablet client service");
    }
    clientAddress = new InetSocketAddress(clientAddress.getAddress(), clientPort);
    announceExistence();
   
    ThreadPoolExecutor distWorkQThreadPool = new SimpleThreadPool(getSystemConfiguration().getCount(Property.TSERV_WORKQ_THREADS), "distributed work queue");
   
    bulkFailedCopyQ = new DistributedWorkQueue(ZooUtil.getRoot(instance) + Constants.ZBULK_FAILED_COPYQ);
    try {
      bulkFailedCopyQ.startProcessing(new BulkFailedCopyProcessor(), distWorkQThreadPool);
    } catch (Exception e1) {
View Full Code Here

    options.transportFactory(ThriftUtil.transportFactory(maxMessageSize));
    options.stopTimeoutVal(5);
    /*
     * Create our own very special thread pool.
     */
    final ThreadPoolExecutor pool = new SimpleThreadPool(numThreads, "ClientPool");
    // periodically adjust the number of threads we need by checking how busy our threads are
    SimpleTimer.getInstance().schedule(new Runnable() {
      @Override
      public void run() {
        if (pool.getCorePoolSize() <= pool.getActiveCount()) {
          int larger = pool.getCorePoolSize() + Math.min(pool.getQueue().size(), 2);
          log.info("Increasing server thread pool size on " + serverName + " to " + larger);
          pool.setMaximumPoolSize(larger);
          pool.setCorePoolSize(larger);
        } else {
          if (pool.getCorePoolSize() > pool.getActiveCount() + 3) {
            int smaller = Math.max(numThreads, pool.getCorePoolSize() - 1);
            if (smaller != pool.getCorePoolSize()) {
              // there is a race condition here... the active count could be higher by the time
              // we decrease the core pool size... so the active count could end up higher than
              // the core pool size, in which case everything will be queued... the increase case
              // should handle this and prevent deadlock
              log.info("Decreasing server thread pool size on " + serverName + " to " + smaller);
              pool.setCorePoolSize(smaller);
            }
          }
        }
      }
    }, timeBetweenThreadChecks, timeBetweenThreadChecks);
View Full Code Here

  }
 
  synchronized void initializeThreadPool(Master master) {
    if (threadPool == null) {
      int threadPoolSize = master.getSystemConfiguration().getCount(Property.MASTER_BULK_THREADPOOL_SIZE);
      ThreadPoolExecutor pool = new SimpleThreadPool(threadPoolSize, "bulk import");
      pool.allowCoreThreadTimeOut(true);
      threadPool = new TraceExecutorService(pool);
    }
  }
View Full Code Here

    state.set("rand", rand);
    state.set("fs", FileSystem.get(CachedConfiguration.getInstance()));
    state.set("bulkImportSuccess", "true");
    BulkPlusOne.counter.set(0l);
   
    ThreadPoolExecutor e = new SimpleThreadPool(MAX_POOL_SIZE, "bulkImportPool");
    state.set("pool", e);
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.util.SimpleThreadPool

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.