コード例 #1
0
ファイル: MessageHub.java プロジェクト: Cazen/gradle
 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);
   }
 }
コード例 #2
0
ファイル: MessageHub.java プロジェクト: Cazen/gradle
 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);
   }
 }
コード例 #3
0
ファイル: MessageHub.java プロジェクト: Cazen/gradle
 private ConnectionDispatch(ConnectionState connectionState) {
   this.connection = connectionState.getConnection();
   this.queue = connectionState.getDispatchQueue();
   this.connectionState = connectionState;
 }
コード例 #4
0
ファイル: MessageHub.java プロジェクト: Cazen/gradle
 public ConnectionReceive(ConnectionState connectionState) {
   this.connection = connectionState.getConnection();
   this.connectionState = connectionState;
 }