List of usage examples for java.util.concurrent Executors newFixedThreadPool
public static ExecutorService newFixedThreadPool(int nThreads)
From source file:com.okmich.twitanalysis.gui.ApplicationFrame.java
public ApplicationFrame() { initComponents(); this.executorService = Executors.newFixedThreadPool(1); }
From source file:org.zalando.stups.boot.eventbus.EventBusAutoConfiguration.java
@Bean public AsyncEventBus asyncEventBus() { AsyncEventBus asyncEventBus = new AsyncEventBus("asyncDefault", Executors.newFixedThreadPool(2)); return asyncEventBus; }
From source file:com.github.ukase.config.BulkConfig.java
@Bean public ExecutorService provideExecutor() { return Executors.newFixedThreadPool(threads); }
From source file:cn.edu.zjnu.acm.judge.service.LoginlogServiceTest.java
@Before public void setUp() { executorService = Executors.newFixedThreadPool(100); }
From source file:org.ppollack.symphony.faqbot.RequestExecutor.java
@Autowired public RequestExecutor(IConfigurationProvider configProvider, RequestHandler requestHandler) { this.requestHandler = requestHandler; executorService = Executors.newFixedThreadPool(configProvider.getNumWorkerThreads()); }
From source file:de.slackspace.wfail2ban.logfile.impl.ContinuousLogfileReader.java
@Override protected void doParsing(Filter filter, FilterResultHandler callback) { TailerListener listener = new ContinuousTailerListener(filter, callback); Tailer tailer = new Tailer(new File(filter.getLogfilePath()), listener); ExecutorService executor = Executors.newFixedThreadPool(1); executor.submit(tailer);//from w w w . j a va 2 s .co m }
From source file:com.engine.biomine.indexing.tasks.IndexDocsTask.java
public IndexDocsTask(IndexManager indexManager, File[] fileList, boolean deleteFile, String collection, IndexerStatus stats) {//from ww w . j a va 2 s . c o m this.fileList = fileList; this.collection = collection; this.indexManager = indexManager; this.monitor = stats; this.deleteFile = deleteFile; exec = Executors.newFixedThreadPool(nbThreads); }
From source file:com.swavdev.tc.DrawableManager.java
public DrawableManager() { drawableMap = new WeakHashMap<String, Drawable>(); executorService = Executors.newFixedThreadPool(5); }
From source file:com.google.cloud.bigtable.hbase.ManyThreadDriver.java
private static void runTest(String projectId, String instanceId, final String tableName) throws Exception { Configuration configuration = new Configuration(); configuration.set("hbase.client.connection.impl", "com.google.cloud.bigtable.hbase1_0.BigtableConnection"); configuration.set("google.bigtable.project.id", projectId); configuration.set("google.bigtable.instance.id", instanceId); try (Connection connection = ConnectionFactory.createConnection(configuration)) { Admin admin = connection.getAdmin(); HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(tableName)); descriptor.addFamily(new HColumnDescriptor("cf")); try {/*www . j ava2 s . co m*/ admin.createTable(descriptor); } catch (IOException ignore) { // Soldier on, maybe the table already exists. } final byte[] value = Bytes.toBytes(RandomStringUtils .randomAlphanumeric(Integer.parseInt(System.getProperty("valueSize", "1024")))); int numThreads = Integer.parseInt(System.getProperty("numThreads", "1000")); ExecutorService executor = Executors.newFixedThreadPool(numThreads); for (int i = 0; i < numThreads; i++) { Runnable r = new Runnable() { @Override public void run() { try { final Table table = connection.getTable(TableName.valueOf(tableName)); while (true) { // Workload: two reads and a write. table.get(new Get(Bytes.toBytes(key()))); table.get(new Get(Bytes.toBytes(key()))); Put p = new Put(Bytes.toBytes(key())); p.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("col"), value); table.put(p); } } catch (Exception e) { System.out.println(e.getMessage()); } } }; executor.execute(r); } // TODO Make a parameter executor.awaitTermination(48, TimeUnit.HOURS); } }
From source file:com.fileanalyzer.FileAnalyzer.java
public FileAnalyzer(final Configuration conf) { this.conf = conf; pattern = Pattern.compile(/* w w w . j av a2s . c o m*/ conf.getFileMask() != null && conf.getFileMask().trim().length() > 0 ? conf.getFileMask() : ".*"); this.pool = Executors.newFixedThreadPool(Integer.valueOf(this.conf.getNumPoolThread())); }