public static RPCResponse createResponse() { int xid = XID.next(); RPCResponse response = new RPCResponse(xid, RPC_VERSION); response.setReplyState(RPC_REPLY_STATE_ACCEPT); response.setAcceptState(RPC_ACCEPT_STATE_ACCEPT); response.setAuthState(0); response.setVerifier(new VerifierNone()); assertEquals(xid, response.getXid()); assertEquals(RPC_MESSAGE_TYPE_REPLY, response.getMessageType()); assertEquals(RPC_REPLY_STATE_ACCEPT, response.getReplyState()); assertEquals(RPC_ACCEPT_STATE_ACCEPT, response.getAcceptState()); assertEquals(0, response.getAuthState()); return response; }
/** * Processes an incoming RPC response. * * @param rpcResponse the RPC response to be processed */ void processIncomingRPCResponse(final RPCResponse rpcResponse) { final Integer messageID = Integer.valueOf(rpcResponse.getMessageID()); final RPCRequestMonitor requestMonitor = this.pendingRequests.get(messageID); // The caller has already timed out or received an earlier response if (requestMonitor == null) return; synchronized (requestMonitor) { requestMonitor.rpcResponse = rpcResponse; requestMonitor.notify(); } }