publishMessageQueue.unsubscribe(cascSubscription.getId());
cascSubscription.getServer().removeSession(cascSubscription);
SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());
} else {
// unsubscribe made by cascaded SC on behalf of his clients
SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
publishMessageQueue.changeSubscription(cascSubscription.getId(), cascSCMask);
cascSubscription.setMask(cascSCMask);
SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
}
CscUnsubscribeCallbackForCasc callback = new CscUnsubscribeCallbackForCasc(request, response, responderCallback,
cascSubscription);
cascadedSC.cascadedSCUnsubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
// delete unreferenced nodes in queue
publishMessageQueue.removeNonreferencedNodes();
return;
default:
// code for other types of services is below
break;
}
if (cascadedSCMask == null) {
// unsubscribe made by cascaded SC on behalf of his last client
this.subscriptionRegistry.removeSubscription(cascSubscription.getId());
publishMessageQueue.unsubscribe(cascSubscription.getId());
cascSubscription.getServer().removeSession(cascSubscription);
SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());
if (reqMessage.getSessionId() == null) {
// no session id set, cascadedSC unsubscribe on his own because of an error
SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
reply.setIsReply(true);
reply.setServiceName(serviceName);
reply.setMessageType(getKey());
// no need to forward to server
response.setSCMP(reply);
responderCallback.responseCallback(request, response);
// delete unreferenced nodes in queue
publishMessageQueue.removeNonreferencedNodes();
this.abortCascSubscriptions(cascSubscription, reqMessage);
return;
}
} else {
// unsubscribe made by cascaded SC on behalf of his clients
SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
publishMessageQueue.changeSubscription(cascSubscription.getId(), cascSCMask);
cascSubscription.setMask(cascSCMask);
SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
}
// use server of cascaded client to unsubscribe