コード例 #1
0
    @Override
    protected void readRequest(final DataInput input) throws IOException {
      int batchId = getHeader().getBatchId();
      ProtocolUtils.expectHeader(input, ModelControllerProtocol.PARAM_MESSAGE_SEVERITY);
      MessageSeverity severity = Enum.valueOf(MessageSeverity.class, input.readUTF());
      ProtocolUtils.expectHeader(input, ModelControllerProtocol.PARAM_MESSAGE);
      String message = input.readUTF();

      ExecuteRequestContext requestContext = activeRequests.get(batchId);
      if (requestContext == null) {
        throw new IOException("No active request found for " + batchId);
      }
      if (requestContext.getMessageHandler() != null) {
        requestContext.getMessageHandler().handleReport(severity, message);
      }
    }
コード例 #2
0
    @Override
    protected void readRequest(final DataInput input) throws IOException {
      int batchId = getHeader().getBatchId();
      log.tracef("Client got inputstream request %d", batchId);
      ProtocolUtils.expectHeader(input, ModelControllerProtocol.PARAM_INPUTSTREAM_INDEX);
      int index = input.readInt();

      ExecuteRequestContext requestContext = activeRequests.get(batchId);
      if (requestContext == null) {
        throw new IOException("No active request found for " + batchId);
      }
      InputStream in = requestContext.getAttachments().getInputStreams().get(index);
      attachmentInput = in != null ? new BufferedInputStream(in) : null;
    }