示例#1
0
 public void schedule(JSObject aJsTask, long aTimeout) {
   Scripts.LocalContext context = Scripts.getContext();
   bio.submit(
       () -> {
         try {
           Thread.sleep(aTimeout);
           Scripts.setContext(context);
           try {
             process(
                 () -> {
                   aJsTask.call(null, new Object[] {});
                 });
           } finally {
             Scripts.setContext(null);
           }
         } catch (InterruptedException ex) {
           Logger.getLogger(Scripts.class.getName()).log(Level.SEVERE, null, ex);
         }
       });
 }
示例#2
0
 public void enqueue(JSObject aJsTask) {
   process(
       () -> {
         aJsTask.call(null, new Object[] {});
       });
 }