Example #1
0
 public static Dispatcher asynchronousSafe(ErrorHandler errorHandler) {
   final ExecutorService executor =
       java.util.concurrent.Executors.newSingleThreadExecutor(
           new DefaultThreadFactory("AsynchronousSafe", "dispatcher", false));
   return new DefaultDispatcher(errorHandler, executor, Executors.immediate()) {
     @Override
     public void close() {
       executor.shutdown();
     }
   };
 }
Example #2
0
 public static Dispatcher asynchronousUnsafe(int corePoolSize, ErrorHandler errorHandler) {
   final ExecutorService executor =
       java.util.concurrent.Executors.newFixedThreadPool(
           corePoolSize, new DefaultThreadFactory("AsynchronousUnsafe", "dispatcher", false));
   return new DefaultDispatcher(errorHandler, executor, Executors.immediate()) {
     @Override
     public void close() {
       executor.shutdown();
     }
   };
 }
Example #3
0
 public static Dispatcher synchronousUnsafe(ErrorHandler errorHandler) {
   return new DefaultDispatcher(errorHandler, Executors.immediate(), Executors.immediate());
 }