示例#1
0
 /** Override of Thread.run(). */
 public void run() {
   boolean localEnd = false;
   while (!end && !localEnd) {
     try {
       Runnable runnable = (Runnable) queue.take(5000L);
       if (runnable == null) {
         detachCurrentThread();
         localEnd = true;
       } else {
         runnable.run();
       }
     } catch (RuntimeException e) {
       LOG.error("Error while delivering async message", e);
     } catch (InterruptedException e) {
       LOG.error("Error while delivering async message", e);
     }
   }
 }
示例#2
0
 public void send(Runnable runnable) {
   queue.offer(runnable);
   attachNewThreadIfNeccesary();
 }