Object reply = messageObjectReceived((MessageCreateValue) obj);
conn.sendTCP(reply);
} else if (obj instanceof MessageSplitEnd) {
messageObjectEndReceived((MessageSplitEnd) obj);
} else if (obj instanceof RequestObject) {
Connection dest = null;
RequestObject request = (RequestObject) obj;
pendingRequest.put(request.getGuid(), conn);
int min = Integer.MAX_VALUE;
for (Connection connDest : server.getConnections()) {
if (conn.getID() != connDest.getID()
&& connDest.getReturnTripTime() < min) {
min = connDest.getReturnTripTime();
dest = connDest;
}
}
dest.sendTCP(obj);
}
} catch (Exception ex) {
Logger.getLogger(getClass()).error(
"Error occur when receiving message", ex);
}