List of usage examples for java.util.concurrent ForkJoinPool commonPool
public static ForkJoinPool commonPool()
From source file:io.kamax.mxisd.invitation.InvitationManager.java
@PreDestroy private void preDestroy() { refreshTimer.cancel(); ForkJoinPool.commonPool().awaitQuiescence(1, TimeUnit.MINUTES); }
From source file:co.runrightfast.vertx.core.application.RunRightFastVertxApplicationLauncherTest.java
@Test public void testRunApp() throws Exception { ForkJoinPool.commonPool().execute(() -> RunRightFastVertxApplicationLauncher.run(() -> app)); final RunRightFastVerticleId verticleManagerId = RunRightFastVerticleManager.VERTICLE_ID; final CompletableFuture future = new CompletableFuture(); final String address = EventBusAddress.eventBusAddress(verticleManagerId, "get-verticle-deployments"); final Vertx vertx = app.vertxService().getVertx(); vertx.eventBus().send(address, GetVerticleDeployments.Request.newBuilder().build(), new DeliveryOptions().setSendTimeout(2000L), getVerticleDeploymentsResponseHandler(future)); final Object result = future.get(2000L, TimeUnit.MILLISECONDS); final ApplicationMXBean appMXBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(), applicationMBeanObjectName(JmxUtils.RUNRIGHTFAST_JMX_DOMAIN, ApplicationMXBean.class), ApplicationMXBean.class); assertThat(appMXBean.getApplicationGroup(), is("co.runrightfast")); assertThat(appMXBean.getApplicationName(), is("test-app")); assertThat(appMXBean.getApplicationVersion(), is("1.0.0")); log.logp(INFO, getClass().getName(), "testRunApp", "{0}:\n{1}", new Object[] { "configAsHConf", appMXBean.configAsHConf() }); log.logp(INFO, getClass().getName(), "testRunApp", "{0}:\n{1}", new Object[] { "configAsHJson", appMXBean.configAsJson() }); log.logp(INFO, getClass().getName(), "testRunApp", "{0}:\n{1}", new Object[] { "configWithCommentsAndSourceInfo", appMXBean.configWithCommentsAndSourceInfo() }); appMXBean.shutdown();/* w ww . ja v a 2s.com*/ app.vertxService().awaitTerminated(); }
From source file:io.kamax.mxisd.invitation.InvitationManager.java
public void lookupMappingsForInvites() { if (!invitations.isEmpty()) { log.info("Checking for existing mapping for pending invites"); for (IThreePidInviteReply reply : invitations.values()) { log.info("Processing invite {}", getIdForLog(reply)); ForkJoinPool.commonPool().submit(new MappingChecker(reply)); }//from ww w . j av a 2s .c om } }
From source file:org.apache.hadoop.hbase.client.AbstractTestAsyncTableRegionReplicasRead.java
private static AsyncTable<?> getTable() { return ASYNC_CONN.getTable(TABLE_NAME, ForkJoinPool.commonPool()); }
From source file:org.apache.hadoop.hbase.client.TestAsyncAdminBase.java
private static AsyncAdmin getAsyncAdmin() { return ASYNC_CONN.getAdmin(ForkJoinPool.commonPool()); }
From source file:org.apache.hadoop.hbase.client.TestAsyncAdminBase.java
@After public void tearDown() throws Exception { admin.listTableNames(Pattern.compile(tableName.getNameAsString() + ".*"), false) .whenCompleteAsync((tables, err) -> { if (tables != null) { tables.forEach(table -> { try { admin.disableTable(table).join(); } catch (Exception e) { LOG.debug("Table: " + tableName + " already disabled, so just deleting it."); }/* ww w .j av a 2 s . c o m*/ admin.deleteTable(table).join(); }); } }, ForkJoinPool.commonPool()).join(); if (!admin.isBalancerEnabled().join()) { admin.balancerSwitch(true, true); } }
From source file:org.apache.hadoop.hbase.client.TestAsyncAdminBuilder.java
private static AsyncAdminBuilder getAsyncAdminBuilder() { return ASYNC_CONN.getAdminBuilder(ForkJoinPool.commonPool()); }
From source file:org.apache.hadoop.hbase.client.TestAsyncTable.java
private static AsyncTable getTable() { return ASYNC_CONN.getTable(TABLE_NAME, ForkJoinPool.commonPool()); }
From source file:org.apache.hadoop.hbase.client.TestAsyncTableScanMetrics.java
private static Pair<List<Result>, ScanMetrics> doScanWithAsyncTableScan(Scan scan) throws Exception { SimpleScanResultConsumer consumer = new SimpleScanResultConsumer(); CONN.getTable(TABLE_NAME, ForkJoinPool.commonPool()).scan(scan, consumer); return Pair.newPair(consumer.getAll(), consumer.getScanMetrics()); }
From source file:org.apache.hadoop.hbase.client.TestAsyncTableScanMetrics.java
private static Pair<List<Result>, ScanMetrics> doScanWithAsyncTableScanner(Scan scan) throws IOException { try (ResultScanner scanner = CONN.getTable(TABLE_NAME, ForkJoinPool.commonPool()).getScanner(scan)) { List<Result> results = new ArrayList<>(); for (Result result; (result = scanner.next()) != null;) { results.add(result);//w w w .j a va2 s . c o m } return Pair.newPair(results, scanner.getScanMetrics()); } }