// 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
SubscribeCommandCallback callback = new SubscribeCommandCallback(request, response, responderCallback,
tmpCascSCSubscription);
service.allocateServerAndSubscribe(reqMessage, callback, tmpCascSCSubscription, otiOnSCMillis
- (i * Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS));
// no exception has been thrown - get out of wait loop
break;
} catch (NoFreeServerException ex) {
LOGGER.debug("NoFreeServerException caught in wait mec of subscribe, tries left=" + tries);