shutDown();
return;
}
validProtocol = true;
IDebugMessage message = DebugMessagesRegistry
.getMessage(messageType);
if (message != null) {
if (message instanceof OutputNotification) {
message.setTransferEncoding(outputEncoding);
} else {
message.setTransferEncoding(transferEncoding);
}
}
// handle the message
if (message instanceof IDebugNotificationMessage) {
message.deserialize(in);
// getCommunicationClient().handleNotification((Notification)message);
// PUT NOTIFICATION TO NOTIFICATION QUEUE
inputMessageHandler.queueIn(message);
} else if (message instanceof IDebugResponseMessage) {
message.deserialize(in);
int idd = ((IDebugResponseMessage) message).getID();
// responseQueue.queueIn(message);
// INSERT RESPONSE TO TABLE AND RELEASE THE THREAD
// WAITING FOR THE REQUEST
ResponseHandler handler = responseHandlers
.get(Integer.valueOf(idd)); // find the handler.
if (handler == null) {
responseTable.put(/* requestId */idd, message);
IDebugRequestMessage req = (IDebugRequestMessage) requestsTable
.remove(idd); // find the request.
if (req != null) {
synchronized (req) {
req.notifyAll(); // Notify the response
// is here.
}
} else {
// Remove this message.
responseTable.remove(idd);
}
} else {
inputMessageHandler.queueIn(message);
}
} else if (message instanceof IDebugRequestMessage) { // this
// is
// a
// request.
message.deserialize(in);
// Response response =
// getCommunicationClient().handleRequest((Request)message);
inputMessageHandler.queueIn(message);
}
} // end of synchronized part.