* 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;
}