コード例 #1
0
 private void waitForRequestSent() {
   log.trace("waitForRequestSent()");
   try {
     httpSenderGate.await();
   } catch (InterruptedException e) {
     log.error("waitForRequestSent interrupted", e);
     Thread.currentThread().interrupt();
   }
 }
コード例 #2
0
 private void waitForSoapMessage() {
   log.trace("waitForSoapMessage()");
   try {
     if (!requestHandlerGate.await(WAIT_FOR_SOAP_TIMEOUT, TimeUnit.SECONDS)) {
       throw new CodedException(X_INTERNAL_ERROR, "Reading SOAP from request timed out");
     }
   } catch (InterruptedException e) {
     log.error("waitForSoapMessage interrupted", e);
     Thread.currentThread().interrupt();
   }
 }
コード例 #3
0
  @Override
  public void process() throws Exception {
    log.trace("process()");

    HandlerThread handlerThread = new HandlerThread();
    handlerThread.setName(Thread.currentThread().getName() + "-soap");

    handlerThread.start();
    try {
      // Wait for the request SOAP message to be parsed before we can
      // start sending stuff.
      waitForSoapMessage();

      // If the handler thread excepted, do not continue.
      checkError();

      // Verify that the client is registered
      verifyClientStatus();

      // Check client authentication mode
      verifyClientAuthentication();

      // If the message is synchronous, start sending proxy message
      if (!isAsync) {
        processRequest();
      }

      if (response != null) {
        sendResponse();
      }
    } catch (Exception e) {
      if (reqIns != null) {
        reqIns.close();
      }

      // Let's interrupt the handler thread so that it won't
      // block forever waiting for us to do something.
      handlerThread.interrupt();
      throw e;
    } finally {
      handlerThread.join();

      if (response != null) {
        response.consume();
      }
    }
  }