}
/** {@inheritDoc} */
@Override
public void run(IRequest request, IResponse response, IResponderCallback responderCallback) throws Exception {
SCMPMessage reqMessage = request.getMessage();
int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
String serviceName = reqMessage.getServiceName();
// check service is present
Service abstractService = this.getService(serviceName);
String sessionId = reqMessage.getSessionId();
switch (abstractService.getType()) {
case CASCADED_SESSION_SERVICE:
// clears message in cache if in loading state
AppContext.getCacheManager().clearLoading(sessionId);
CascadedSC cascadedSC = ((CascadedSessionService) abstractService).getCascadedSC();
CommandCascCallback callback = new CommandCascCallback(request, response, responderCallback);
cascadedSC.deleteSession(reqMessage, callback, oti);
return;
case CASCADED_FILE_SERVICE:
cascadedSC = ((CascadedFileService) abstractService).getCascadedSC();
callback = new CommandCascCallback(request, response, responderCallback);
cascadedSC.deleteSession(reqMessage, callback, oti);
return;
default:
// code for other types of services is below
break;
}
// lookup session and checks properness
Session session = this.getSessionById(sessionId);
synchronized (session) {
session.setPendingRequest(true); // IMPORTANT - set true because of parallel echo call
// delete entry from session registry
this.sessionRegistry.removeSession(session);
}
IServer abstractServer = session.getServer();
switch (abstractServer.getType()) {
case STATEFUL_SERVER:
// code for type session service is below switch statement
break;
case FILE_SERVER:
this.sessionRegistry.removeSession(session);
((FileServer) abstractServer).removeSession(session);
// reply to client
SCMPMessage reply = new SCMPMessage();
reply.setIsReply(true);
reply.setMessageType(getKey());
response.setSCMP(reply);
responderCallback.responseCallback(request, response);
return;
case CASCADED_SC:
case UNDEFINED: