private void processData() throws IOException, InterruptedException { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data.array())); int id = dis.readInt(); // try to read an id if (LOG.isDebugEnabled()) LOG.debug(" got #" + id); Writable param = ReflectionUtils.newInstance(paramClass, conf); // read param param.readFields(dis); Call call = new Call(id, param, this); callQueue.put(call); // queue the call; maybe blocked here }
private void processData() throws IOException, InterruptedException { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data.array())); int id = dis.readInt(); // try to read an id if (LOG.isDebugEnabled()) LOG.debug(" got #" + id); Writable param = ReflectionUtils.newInstance(paramClass, conf); // read param param.readFields(dis); Call call = new Call(id, param, this, responder); callQueue.put(call); // queue the call; maybe blocked here }
private void doSaslReply(Message message) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Sending sasl message "+message); } final Call saslCall = new Call(AuthProtocol.SASL.callId, RpcConstants.INVALID_RETRY_COUNT, null, this); final ByteArrayOutputStream saslResponse = new ByteArrayOutputStream(); setupResponse(saslResponse, saslCall, RpcStatusProto.SUCCESS, null, new RpcResponseWrapper(message), null, null); saslCall.sendResponse(); }
Call call = new Call(header.getCallId(), header.getRetryCount(), rpcRequest, this, ProtoUtil.convert(header.getRpcKind()), header.getClientId().toByteArray(), traceSpan);
final Call call = new Call(callId, retry, null, this); setupResponse(authFailedResponse, call, RpcStatusProto.FATAL, wrse.getRpcErrorCodeProto(), null,
Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); setupResponse(buffer, fakeCall, fakeCall.sendResponse(); } else if (clientVersion >= 3) { Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); DataOutputStream out = new DataOutputStream(buffer);
Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); setupResponse(buffer, fakeCall, fakeCall.sendResponse(); } else if (clientVersion >= 3) { Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); DataOutputStream out = new DataOutputStream(buffer);
Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); setupResponse(buffer, fakeCall, responder.doRespond(fakeCall); } else if (clientVersion >= 3) { Call fakeCall = new Call(-1, RpcConstants.INVALID_RETRY_COUNT, null, this); Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); DataOutputStream out = new DataOutputStream(buffer);
final Call call = new Call(callId, retry, null, this); setupResponse(authFailedResponse, call, RpcStatusProto.FATAL, wrse.getRpcErrorCodeProto(), null,
final Call call = new Call(callId, retry, null, this); setupResponse(authFailedResponse, call, RpcStatusProto.FATAL, wrse.getRpcErrorCodeProto(), null,
@InterfaceStability.Unstable @InterfaceAudience.LimitedPrivate({"HDFS"}) public void abortResponse(Throwable t) throws IOException { // don't send response if the call was already sent or aborted. if (responseWaitCount.getAndSet(-1) > 0) { // clone the call to prevent a race with the other thread stomping // on the response while being sent. the original call is // effectively discarded since the wait count won't hit zero Call call = new Call(this); setupResponse(new ByteArrayOutputStream(), call, RpcStatusProto.FATAL, RpcErrorCodeProto.ERROR_RPC_SERVER, null, t.getClass().getName(), StringUtils.stringifyException(t)); call.sendResponse(); } }
@InterfaceStability.Unstable @InterfaceAudience.LimitedPrivate({"HDFS"}) public void abortResponse(Throwable t) throws IOException { // don't send response if the call was already sent or aborted. if (responseWaitCount.getAndSet(-1) > 0) { // clone the call to prevent a race with the other thread stomping // on the response while being sent. the original call is // effectively discarded since the wait count won't hit zero Call call = new Call(this); setupResponse(new ByteArrayOutputStream(), call, RpcStatusProto.FATAL, RpcErrorCodeProto.ERROR_RPC_SERVER, null, t.getClass().getName(), StringUtils.stringifyException(t)); call.sendResponse(); } }
public static Server.Call newCall() { return new Server.Call(++callId, 1, null, null, RpcKind.RPC_PROTOCOL_BUFFER, CLIENT_ID); }
public static void resetCall() { Server.Call call = new Server.Call(RpcConstants.INVALID_CALL_ID, 1, null, null, RpcKind.RPC_PROTOCOL_BUFFER, RpcConstants.DUMMY_CLIENT_ID); Server.getCurCall().set(call); }
private void setupHttpRequestOnIpcPortResponse() throws IOException { Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); fakeCall.setResponse(ByteBuffer.wrap( RECEIVED_HTTP_REQ_RESPONSE.getBytes(Charsets.UTF_8))); fakeCall.sendResponse(); }
private void setupHttpRequestOnIpcPortResponse() throws IOException { Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); fakeCall.setResponse(ByteBuffer.wrap( RECEIVED_HTTP_REQ_RESPONSE.getBytes(Charsets.UTF_8))); fakeCall.sendResponse(); }
private void doSaslReply(Message message) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Sending sasl message "+message); } final Call saslCall = new Call(AuthProtocol.SASL.callId, RpcConstants.INVALID_RETRY_COUNT, null, this); final ByteArrayOutputStream saslResponse = new ByteArrayOutputStream(); setupResponse(saslResponse, saslCall, RpcStatusProto.SUCCESS, null, new RpcResponseWrapper(message), null, null); saslCall.sendResponse(); }
private void setupHttpRequestOnIpcPortResponse() throws IOException { Call fakeCall = new Call(0, RpcConstants.INVALID_RETRY_COUNT, null, this); fakeCall.setResponse(ByteBuffer.wrap( RECEIVED_HTTP_REQ_RESPONSE.getBytes(Charsets.UTF_8))); responder.doRespond(fakeCall); }
/** Set the current Server RPC call */ public static void newCall() { Server.Call call = new Server.Call(++callId, 1, null, null, RpcKind.RPC_PROTOCOL_BUFFER, CLIENT_ID); Server.getCurCall().set(call); }
public static Server.Call newCall() { return new Server.Call(++callId, 1, null, null, RpcKind.RPC_PROTOCOL_BUFFER, CLIENT_ID); }