Esempio n. 1
0
 public void run() {
   try {
     List<InterHubMessage> messages = new ArrayList<InterHubMessage>();
     try {
       while (true) {
         lock.lock();
         try {
           queue.take(messages);
         } finally {
           lock.unlock();
         }
         for (InterHubMessage message : messages) {
           connection.dispatch(message);
           if (message instanceof EndOfStream) {
             connection.flush();
             return;
           }
         }
         connection.flush();
         messages.clear();
       }
     } finally {
       lock.lock();
       try {
         connectionState.dispatchFinished();
       } finally {
         lock.unlock();
       }
     }
   } catch (Throwable t) {
     errorHandler.execute(t);
   }
 }
Esempio n. 2
0
 public void run() {
   try {
     try {
       while (true) {
         InterHubMessage message = connection.receive();
         if (message == null || message instanceof EndOfStream) {
           return;
         }
         lock.lock();
         try {
           incomingQueue.queue(message);
         } finally {
           lock.unlock();
         }
       }
     } finally {
       lock.lock();
       try {
         connectionState.receiveFinished();
       } finally {
         lock.unlock();
       }
     }
   } catch (Throwable e) {
     errorHandler.execute(e);
   }
 }
Esempio n. 3
0
 private ConnectionDispatch(ConnectionState connectionState) {
   this.connection = connectionState.getConnection();
   this.queue = connectionState.getDispatchQueue();
   this.connectionState = connectionState;
 }
Esempio n. 4
0
 public ConnectionReceive(ConnectionState connectionState) {
   this.connection = connectionState.getConnection();
   this.connectionState = connectionState;
 }