Package java.util.concurrent

Examples of java.util.concurrent.ScheduledExecutorService.shutdownNow()


      assertTrue(false);
    }
    assertEquals(0, latch.getCount());
    assertEquals(0, exceptionThrown[0]);
    ioLoop.shutdownNow();
    workerThreads.shutdownNow();
  }

}
View Full Code Here


                }, 2, 2, TimeUnit.MINUTES);
                try {
                    base.evaluate();
                } finally {
                    task.cancel(true);
                    ses.shutdownNow();
                }
            }
        };
    }
}
View Full Code Here

            @Override
            public Void call() throws Exception {
                if (!server.isStopped()) {
                    server.stop();
                }
                executor.shutdownNow();
                return null;
            }
        }, 5, TimeUnit.SECONDS);

View Full Code Here

        serverStopped.get();

        // cancel the cleanup future since everything succeeded
        cleanup.cancel(false);
        executor.shutdownNow();
    }

    @Path("/test")
    @Produces("text/plain")
    public static class TestResource {
View Full Code Here

            assertEquals("", 1D, inst.getSamplers().get("a").get("1").getValue(), 0.01D);
            assertEquals("", 2D, inst.getSamplers().get("a").get("2").getValue(), 0.02D);
            assertEquals("", 4D, inst.getSamplers().get("b").get("1").getValue(), 0.5D);

        } finally {
            scheduledExecutorService.shutdownNow();
        }
    }

    public void testAll() throws Exception {
        Instrumentation inst = new Instrumentation();
View Full Code Here

            assertEquals(1D, inst.getMetricRegistry().getHistograms().get("a.1.histogram").getSnapshot().getMean(), 0.01D);
            assertEquals(2D, inst.getMetricRegistry().getHistograms().get("a.2.histogram").getSnapshot().getMean(), 0.02D);
            assertEquals(4D, inst.getMetricRegistry().getHistograms().get("b.1.histogram").getSnapshot().getMean(), 0.5D);
        } finally {
            scheduledExecutorService.shutdownNow();
        }
    }

    public void testUnsupportedOpertation() {
        MetricsInstrumentation instr = new MetricsInstrumentation();
View Full Code Here

            assertEquals("Resource counter", PARALLEL_CLIENTS, resourceCounter.get());

            assertEquals("Received counter", PARALLEL_CLIENTS, receivedCounter.get());
        } finally {
            executor.shutdownNow();
            Assert.assertTrue("Executor termination", executor.awaitTermination(5, TimeUnit.SECONDS));
        }
    }
}
View Full Code Here

                }
            }

            assertThat("Failed to enumerate all contents of javax.ws.rs-api.", scannedEntryCount, equalTo(actualEntries));
        } finally {
            executor.shutdownNow();
        }
    }
}
View Full Code Here

        throw new IOException(e);
      } finally {
        handle.cancel(true);
        /* schedule a last update */
        scheduler.schedule(new BSStatusCollector(), 0, TimeUnit.SECONDS);
        scheduler.shutdownNow();
        try {
          scheduler.awaitTermination(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
          LOG.info("Interruped while waiting for scheduler");
        }
View Full Code Here

                    client.updateLastAccess();
                }
            };
            service.scheduleAtFixedRate(command, 10, 10, TimeUnit.MILLISECONDS);
            client.inTransaction().create().forPath("/foo", "data".getBytes()).and().commit();
            service.shutdownNow();
            Thread.sleep(2000);

            Assert.assertNull(client.getCleanup());
            Assert.assertNull(client.getClient());
        }
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.