case UNDEFINED:
default:
throw new SCMPCommandException(SCMPError.SC_ERROR, "delete session not allowed for service "
+ abstractService.getName());
}
StatefulServer statefulServer = (StatefulServer) abstractServer;
DeleteSessionCommandCallback callback;
// free server from session
statefulServer.removeSession(session);
int otiOnSCMillis = (int) (oti * basicConf.getOperationTimeoutMultiplier());
int tries = (otiOnSCMillis / Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
// Following loop implements the wait mechanism in case of a busy connection pool
int i = 0;
do {
// reset msgType, might have been modified in below delete session try
reqMessage.setMessageType(this.getKey());
callback = new DeleteSessionCommandCallback(request, response, responderCallback, session, statefulServer);
try {
statefulServer.deleteSession(reqMessage, callback, otiOnSCMillis
- (i * Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS));
// no exception has been thrown - get out of wait loop
break;
} catch (ConnectionPoolBusyException ex) {
LOGGER.debug("ConnectionPoolBusyException caught in wait mec of delete session, tries left=" + tries);
if (i >= (tries - 1)) {
// only one loop outstanding - don't continue throw current exception
statefulServer.abortSession(session, "deleting session failed, connection pool to server busy");
LOGGER.debug(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + reqMessage.getServiceName()));
SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION, "service="
+ reqMessage.getServiceName());
scmpCommandException.setMessageType(this.getKey());
throw scmpCommandException;