if (cscSubscription == null) {
// cascaded SC not subscribed yet
callback = new SubscribeCommandCallback(request, response, responderCallback, tmpCascSCSubscription);
} else {
// subscribe is made by an active cascaded SC
callback = new CscChangeSubscriptionCallbackForCasc(request, response, responderCallback, cscSubscription,
cscSCMaskString);
}
cascadedSC.cascadedSCSubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
return;
default:
// code for other types of services is below
break;
}
// modify message only if it goes to server
reqMessage.removeHeader(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
reqMessage.removeHeader(SCMPHeaderAttributeKey.CASCADED_MASK);
reqMessage.removeHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID);
// check service is present
PublishService service = this.validatePublishService(abstractService);
int otiOnSCMillis = (int) (oti * basicConf.getOperationTimeoutMultiplier());
int tries = (otiOnSCMillis / Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
int i = 0;
// Following loop implements the wait mechanism in case of a busy connection pool
do {
// reset ipList&msgType, might have been modified in below operation try
reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
reqMessage.setMessageType(this.getKey());
try {
if (cscSubscription != null) {
// cascaded subscribe made by an active cascaded SC
CscChangeSubscriptionCallbackForCasc cascCallback = new CscChangeSubscriptionCallbackForCasc(request, response,
responderCallback, cscSubscription, cscSCMaskString);
((StatefulServer) cscSubscription.getServer()).subscribe(reqMessage, cascCallback, otiOnSCMillis);
break;
}
// cascaded subscribe made by an inactive cascaded SC - forward client subscribe to server