Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPCompositeReceiver


            return;
          }
          NettyResponderRequestHandlerTask.compositeRegistry.removeSCMPLargeResponse(sessionId);
        }
        // gets the large request or creates a new one if necessary
        SCMPCompositeReceiver largeRequest = this.getSCMPLargeRequest(request, response);

        if (largeRequest != null && largeRequest.isComplete() == false) {
          // request is not complete yet
          response.write();
          return;
        }
        // removes largeResponse - request is complete don't need to know preceding messages any more
View Full Code Here


   *             the exception
   */
  private SCMPCompositeReceiver getSCMPLargeRequest(IRequest request, IResponse response) throws Exception {
    SCMPMessage scmpReq = request.getMessage();
    String sessionId = scmpReq.getSessionId();
    SCMPCompositeReceiver largeRequest = NettyResponderRequestHandlerTask.compositeRegistry.getSCMPLargeRequest(scmpReq
        .getSessionId());

    if (largeRequest == null) {
      // no compositeReceiver used before
      if (scmpReq.isPart() == false) {
        // request not chunk
        return null;
      }
      // first part of a large request received - create large request
      largeRequest = new SCMPCompositeReceiver(scmpReq, scmpReq);
      int oti = scmpReq.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
      // add largeResponse to the registry
      NettyResponderRequestHandlerTask.compositeRegistry.addSCMPLargeRequest(sessionId, largeRequest, oti);
    } else {
      // next part of a large request received - add to large request
      largeRequest.add(scmpReq);
    }

    SCMPMessageSequenceNr msgSequenceNr = NettyResponderRequestHandlerTask.compositeRegistry.getSCMPMsgSequenceNr(sessionId);

    if (scmpReq.isPart()) {
      // received message part - request not complete yet
      largeRequest.incomplete();
      // set up poll response - SCMP Version request
      SCMPMessage scmpReply = new SCMPPart(scmpReq.getSCMPVersion(), true);
      scmpReply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.incrementAndGetMsgSequenceNr());
      scmpReply.setIsReply(true);
      scmpReply.setMessageType(scmpReq.getMessageType());
      response.setSCMP(scmpReply);
    } else {
      // last message of a chunk message received - request complete now
      largeRequest.complete();
      largeRequest.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.incrementAndGetMsgSequenceNr());
      request.setMessage(largeRequest);
    }
    return largeRequest;
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPCompositeReceiver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.