Esempio n. 1
0
  private Distributor(ByteArrayConsumer consumer, T root, Class<T> rootFacade) {
    addDefaultSerializers();
    setConsumer(consumer);

    if (root == null) {
      rootClient = proxyFor(objectsId.getAndIncrement(), rootFacade);
    } else {
      serverFor(root);
    }
  }
Esempio n. 2
0
  protected Request request(long objectId, Method method, Object[] args, boolean expectsResponse)
      throws IOException {
    Request r = new Request(this, method, args);
    long requestId = -1;

    if (expectsResponse) {
      requestId = nextRequest.getAndIncrement();
      requests.put(requestId, r);
    }

    sendRequest(objectId, requestId, r);

    return r;
  }
Esempio n. 3
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;
  }