Пример #1
0
  public ServerObject serverFor(Object o) {

    ServerObject server = serving.get(o);

    if (server == null) {

      server = new ServerObject(objectsId.getAndIncrement(), o);

      serving.put(o, server);
      servingById.put(server.getId(), server);
    }

    return server;
  }
Пример #2
0
  private void processRequest(DataInputStream in) throws IOException {

    long serverId = in.readLong();

    ServerObject server = servingById.get(serverId);

    long requestId = in.readLong();
    Request r = new Request(this, server.getObject());
    r.deserialize(in);
    r.invoke();
    if (requestId != -1) {
      sendResponse(requestId, r.getResult(), r.getResultDeclaredType());
    }
  }