Exemplo n.º 1
0
 @Test
 public void shouldWireUpAtExitHook() {
   factory.registerExitHook();
   try {
     Runtime.getRuntime().addShutdownHook(factory.exitHook());
   } catch (Exception e) {
     assertThat(e.getMessage(), is("Hook previously registered"));
   }
 }
Exemplo n.º 2
0
 /**
  * Parallelism available to a Scheduler.
  *
  * <p>This defaults to {@code Runtime.getRuntime().availableProcessors()} but can be overridden
  * for use cases such as scheduling work on a computer cluster.
  *
  * @return the scheduler's available degree of parallelism.
  */
 public int degreeOfParallelism() {
   return Runtime.getRuntime().availableProcessors();
 }