Package org.serviceconnector.cmd

Examples of org.serviceconnector.cmd.SCMPCommandException


      responderCallback.responseCallback(request, response);
      return;
    case CASCADED_SC:
    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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here


    String serviceName = reqMessage.getServiceName();

    // check service is present and enabled
    Service abstractService = this.getService(serviceName);
    if (abstractService.isEnabled() == false) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVICE_DISABLED, "service="
          + abstractService.getName() + " is disabled");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }

    // enhance ipAddressList
    String ipAddressList = reqMessage.getHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST);
    ipAddressList = ipAddressList + Constants.SLASH + request.getRemoteSocketAddress().getAddress().getHostAddress();
    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    String mask = reqMessage.getHeader(SCMPHeaderAttributeKey.MASK);
    SubscriptionMask subscriptionMask = new SubscriptionMask(mask);
    String sessionInfo = reqMessage.getHeader(SCMPHeaderAttributeKey.SESSION_INFO);
    int noiInSecs = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
    int noiInMillis = noiInSecs * Constants.SEC_TO_MILLISEC_FACTOR;
    // create temporary subscription
    Subscription tmpSubscription = new Subscription(subscriptionMask, sessionInfo, ipAddressList, noiInMillis, AppContext
        .getBasicConfiguration().getSubscriptionTimeoutMillis(), false);
    tmpSubscription.setService(abstractService);
    reqMessage.setSessionId(tmpSubscription.getId());

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
    case CASCADED_CACHE_GUARDIAN:
      // publish service is cascaded
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      // add server to subscription
      tmpSubscription.setServer(cascadedSC);
      // service is cascaded - subscribe is made by a normal client
      SubscribeCommandCallback callback = new SubscribeCommandCallback(request, response, responderCallback, tmpSubscription);
      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);
    // check service is present
    PublishService service = this.validatePublishService(abstractService);
    SubscribeCommandCallback callback = null;
    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 subscribe try
      reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
      reqMessage.setMessageType(this.getKey());
      // service is local - normal client is subscribing
      callback = new SubscribeCommandCallback(request, response, responderCallback, tmpSubscription);
      try {
        service.allocateServerAndSubscribe(reqMessage, callback, tmpSubscription, 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);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          throw ex;
        }
      } catch (ConnectionPoolBusyException ex) {
        LOGGER.debug("ConnectionPoolBusyException caught in wait mec of subscribe, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          LOGGER.warn(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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

   */
  public StatefulServer getStatefulServerByName(String key) throws SCMPCommandException {
    Server server = this.serverRegistry.getServer(key);
    if (server == null) {
      // server not found in registry
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVER_NOT_FOUND, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    if (server.getType().equals(ServerType.STATEFUL_SERVER) == false) {
      // server is wrong type
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVER_TYPE, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return (StatefulServer) server;
  }
View Full Code Here

      FileServer fileServer = session.getFileServer();
      reply = fileServer.serverDownloadFile(session, message, remoteFileName, oti);
    } catch (Exception e) {
      // SCMP Version request
      reply = new SCMPMessage(message.getSCMPVersion());
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.FILE_DOWNLOAD_FAILED,
          "Error occured in file server on SC.");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    reply.setIsReply(true);
    reply.setMessageType(getKey());
    response.setSCMP(reply);
View Full Code Here

    SCMPMessage reqMessage = request.getMessage();
    String serviceName = reqMessage.getServiceName();
    // check service is present and enabled
    Service abstractService = this.getService(serviceName);
    if (abstractService.isEnabled() == false) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVICE_DISABLED, "service="
          + abstractService.getName() + " is disabled");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }

    // enhance ipAddressList
    String ipAddressList = reqMessage.getHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST);
    ipAddressList = ipAddressList + Constants.SLASH + request.getRemoteSocketAddress().getAddress().getHostAddress();
    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);

    String sessionInfo = reqMessage.getHeader(SCMPHeaderAttributeKey.SESSION_INFO);
    int eciInSeconds = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.ECHO_INTERVAL);
    int eciInMillis = eciInSeconds * Constants.SEC_TO_MILLISEC_FACTOR;
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    switch (abstractService.getType()) {
    case CASCADED_SESSION_SERVICE:
      CascadedSC cascadedSC = ((CascadedSessionService) abstractService).getCascadedSC();
      CommandCascCallback callback = new CommandCascCallback(request, response, responderCallback);
      cascadedSC.createSession(reqMessage, callback, oti);
      return;
    case CASCADED_FILE_SERVICE:
      cascadedSC = ((CascadedFileService) abstractService).getCascadedSC();
      callback = new CommandCascCallback(request, response, responderCallback);
      cascadedSC.createSession(reqMessage, callback, oti);
      return;
    case SESSION_SERVICE:
      // code for type session service is below switch statement
      break;
    case FILE_SERVICE:
      FileService fileService = (FileService) abstractService;
      // create file session
      FileSession fileSession = new FileSession(sessionInfo, ipAddressList, fileService.getPath(),
          fileService.getUploadFileScriptName(), fileService.getGetFileListScriptName());
      fileSession.setService(fileService);
      FileServer fileServer = fileService.allocateFileServerAndCreateSession(fileSession);
      // add server to session
      fileSession.setServer(fileServer);
      fileSession.setSessionTimeoutMillis(eciInMillis * basicConf.getEchoIntervalMultiplier());
      // finally add file session to the registry
      this.sessionRegistry.addSession(fileSession.getId(), fileSession);
      // reply to client - SCMP Version request
      SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
      reply.setIsReply(true);
      reply.setMessageType(getKey());
      reply.setSessionId(fileSession.getId());
      response.setSCMP(reply);
      responderCallback.responseCallback(request, response);
      return;
    default:
      // code for other types of services is below
      break;
    }

    // create session
    Session session = new Session(sessionInfo, ipAddressList);
    session.setService(abstractService);
    session.setSessionTimeoutMillis(eciInMillis * basicConf.getEchoIntervalMultiplier());
    reqMessage.setSessionId(session.getId());
    // no need to forward echo attributes
    reqMessage.removeHeader(SCMPHeaderAttributeKey.ECHO_INTERVAL);

    // tries allocating a server for this session
    CreateSessionCommandCallback callback = null;
    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 ipList&msgType, might have been modified in below creates session try
      reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
      reqMessage.setMessageType(this.getKey());
      callback = new CreateSessionCommandCallback(request, response, responderCallback, session);
      try {
        ((SessionService) abstractService).allocateServerAndCreateSession(reqMessage, callback, session, 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 create session, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          throw ex;
        }
      } catch (ConnectionPoolBusyException ex) {
        LOGGER.debug("ConnectionPoolBusyException caught in wait mec of create session, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          LOGGER.warn(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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

    int otiOnSCMillis = (int) (oti * basicConf.getOperationTimeoutMultiplier());
    String sessionId = reqMessage.getSessionId();
    Session session = this.getSessionById(sessionId);
    if (session.hasPendingRequest() == true) {
      LOGGER.warn("session " + sessionId + " has pending request");
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.PARALLEL_REQUEST, "service="
          + reqMessage.getServiceName() + " sid=" + sessionId);
      scmpCommandException.setMessageType(this.getKey());
      throw scmpCommandException;
    }
    // sets the time of last execution
    session.resetExecuteTime();
    synchronized (session) {
      session.setPendingRequest(true); // IMPORTANT - set true before reset timeout - because of parallel echo call
      // reset session timeout to OTI+ECI - during wait for server reply
      this.sessionRegistry.resetSessionTimeout(session, (otiOnSCMillis + session.getSessionTimeoutMillis()));
    }

    if (cache.isCacheEnabled()) {
      try {
        // try to load response from cache
        SCMPMessage message = cache.tryGetMessageFromCacheOrLoad(reqMessage);
        if (message != null) {
          synchronized (session) {
            // reset session timeout to ECI
            this.sessionRegistry.resetSessionTimeout(session, session.getSessionTimeoutMillis());
            session.setPendingRequest(false); // IMPORTANT - set false after reset timeout - parallel echo call
          }
          // message found in cache - hand it to the client
          response.setSCMP(message);
          responderCallback.responseCallback(request, response);
          return;
        }
      } catch (Exception e) {
        synchronized (session) {
          // reset session timeout to ECI
          this.sessionRegistry.resetSessionTimeout(session, session.getSessionTimeoutMillis());
          session.setPendingRequest(false); // IMPORTANT - set false after reset timeout - because of parallel echo call
        }
        throw e;
      }
    }
    ExecuteCommandCallback callback = null;
    StatefulServer server = session.getStatefulServer();
    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 execute try
      reqMessage.setMessageType(this.getKey());
      callback = new ExecuteCommandCallback(request, response, responderCallback, sessionId);
      try {
        server.execute(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 execute, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          synchronized (session) {
            // reset session timeout to ECI
            this.sessionRegistry.resetSessionTimeout(session, session.getSessionTimeoutMillis());
            session.setPendingRequest(false); // IMPORTANT - set false after timeout - because of parallel echo call
          }
          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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

    // Check the presence of the server
    Server server = this.serverRegistry.getServer(serverKey);
    if (server == null) {
      // server does not exist =>
      SCMPCommandException cmdExc = new SCMPCommandException(SCMPError.NO_SERVER, "server=" + serverKey);
      cmdExc.setMessageType(getKey());
      throw cmdExc;
    }
    // reset server timeout
    LOGGER.debug("refresh server timeout in CRG server=" + server.getServerKey() + " timeout(ms)=" + server.getServerTimeoutMillis());
    serverRegistry.resetServerTimeout(server, server.getServerTimeoutMillis());
View Full Code Here

            // unsubscribe by cascSC on behalf of his last client, abort subscriptions in relation if there are left
            this.abortCascSubscriptions(cascSubscription, reqMessage);
          }
          // only one loop outstanding - don't continue throw current exception
          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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

   */
  private String getCacheInspectString(final String serviceName, final String cacheKey) throws SCMPCommandException,
      UnsupportedEncodingException {
    SCCache cache = AppContext.getSCCache();
    if (cache == null) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.CACHE_ERROR, "no cache (null)");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    @SuppressWarnings("unchecked")
    ISCCacheModule<SCCacheMetaEntry> scCacheModule = (ISCCacheModule<SCCacheMetaEntry>) AppContext.getCacheModuleRegistry()
        .getCache(SC_CACHE_MODULE_TYPE.META_DATA_CACHE_MODULE.name());
    if (scCacheModule == null) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.CACHE_ERROR, serviceName);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    SCCacheMetaEntry metaEntry = (SCCacheMetaEntry) scCacheModule.get(cacheKey);
    if (metaEntry == null) {
      return URLString.toURLResponseString(Constants.CACHE_ID, cacheKey, "return", "notfound");
View Full Code Here

    String serviceName = reqMessage.getServiceName();

    // check service is present and enabled
    Service abstractService = this.getService(serviceName);
    if (abstractService.isEnabled() == false) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVICE_DISABLED, "service="
          + abstractService.getName() + " is disabled");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }

    // enhance ipAddressList
    String ipAddressList = reqMessage.getHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST);
    ipAddressList = ipAddressList + Constants.SLASH + request.getRemoteSocketAddress().getAddress().getHostAddress();
    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);

    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
    // create temporary Subscription for cascaded SC
    String sessionInfo = reqMessage.getHeader(SCMPHeaderAttributeKey.SESSION_INFO);
    int noiSecs = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
    int noiInMillis = noiSecs * Constants.SEC_TO_MILLISEC_FACTOR;
    String cscSCMaskString = reqMessage.getHeader(SCMPHeaderAttributeKey.CASCADED_MASK);
    String cascSubscriptionId = reqMessage.getHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID);
    Subscription cscSubscription = this.subscriptionRegistry.getSubscription(cascSubscriptionId);
    SubscriptionMask cscMask = new SubscriptionMask(cscSCMaskString);
    Subscription tmpCascSCSubscription = new Subscription(cscMask, sessionInfo, ipAddressList, noiInMillis, AppContext
        .getBasicConfiguration().getSubscriptionTimeoutMillis(), true);
    tmpCascSCSubscription.setService(abstractService);

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
    case CASCADED_CACHE_GUARDIAN:
      // publish service is cascaded
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      // add server to subscription
      tmpCascSCSubscription.setServer(cascadedSC);

      ISubscriptionCallback callback = null;
      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
        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);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          throw ex;
        }
      } catch (ConnectionPoolBusyException ex) {
        LOGGER.debug("ConnectionPoolBusyException caught in wait mec of subscribe, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          LOGGER.warn(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;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

TOP

Related Classes of org.serviceconnector.cmd.SCMPCommandException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.