private Distributor(ByteArrayConsumer consumer, T root, Class<T> rootFacade) { addDefaultSerializers(); setConsumer(consumer); if (root == null) { rootClient = proxyFor(objectsId.getAndIncrement(), rootFacade); } else { serverFor(root); } }
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; }
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; }