Example #1
0
 public void invoke(IManagerCommand command) {
   if (isManagerThread()) {
     myThread.processCommand(command);
   } else {
     schedule(command);
   }
 }
Example #2
0
 public void invokeAndWait(final IManagerCommand command) {
   if (isManagerThread()) {
     myThread.processCommand(command);
   } else {
     final CountDownLatch countDown = new CountDownLatch(1);
     schedule(
         Commands.fromClosure(
             new _FunctionTypes._void_P0_E0() {
               public void invoke() {
                 try {
                   command.invoke();
                 } finally {
                   countDown.countDown();
                 }
               }
             },
             new _FunctionTypes._void_P0_E0() {
               public void invoke() {
                 try {
                   command.cancel();
                 } finally {
                   countDown.countDown();
                 }
               }
             }));
     try {
       countDown.await();
     } catch (InterruptedException ignore) {
     }
   }
 }
Example #3
0
 public ManagerThread() {
   myThread.start();
 }