Exemplo n.º 1
0
 private void sendRequest(long objectId, long requestId, Request r) throws IOException {
   DataOutputStream out = newFlusher();
   out.writeByte(REQUEST);
   out.writeLong(objectId);
   out.writeLong(requestId);
   r.serialize(out);
   out.writeBoolean(false);
   out.flush();
 }
Exemplo n.º 2
0
 private void sendResponse(long requestId, Object value, Class<?> declaredType)
     throws IOException {
   DataOutputStream out = newFlusher();
   out.writeByte(RESPONSE);
   out.writeLong(requestId);
   if (value == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     Class<?> clazz = value.getClass();
     out.writeUTF(clazz.getName());
     Serializer<Object> s = serializerFor(clazz, declaredType);
     s.serialize(out, value);
   }
   out.writeBoolean(false);
   out.flush();
 }