@Test
 public void shouldWireUpAtExitHook() {
   factory.registerExitHook();
   try {
     Runtime.getRuntime().addShutdownHook(factory.exitHook());
   } catch (Exception e) {
     assertThat(e.getMessage(), is("Hook previously registered"));
   }
 }
Exemple #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();
 }