コード例 #1
0
 public void enqueue(TextCommand response) {
   long requestId = response.getRequestId();
   if (requestId == -1) {
     connection.getWriteHandler().enqueueSocketWritable(response);
   } else {
     if (currentRequestId == requestId) {
       connection.getWriteHandler().enqueueSocketWritable(response);
       currentRequestId++;
       processWaitingResponses();
     } else {
       responses.put(requestId, response);
     }
   }
 }
コード例 #2
0
 private void processWaitingResponses() {
   TextCommand response = responses.remove(currentRequestId);
   while (response != null) {
     connection.getWriteHandler().enqueueSocketWritable(response);
     currentRequestId++;
     response = responses.remove(currentRequestId);
   }
 }