Ejemplo n.º 1
0
 /** helper: implement the main background loop. */
 protected void react() throws IOException {
   while (true) {
     ArrayList<ReplyLine> lst = readReply();
     if (lst.isEmpty()) {
       // connection has been closed remotely! end the loop!
       return;
     }
     if ((lst.get(0)).status.startsWith("6")) handleEvent(lst);
     else {
       synchronized (waiters) {
         if (!waiters.isEmpty()) {
           Waiter w;
           w = waiters.removeFirst();
           w.setResponse(lst);
         }
       }
     }
   }
 }