Examples of StatefulService


Examples of org.apache.camel.StatefulService

         * @param policy the policy
         * @return <tt>true</tt> to run
         */
        protected boolean isRoutePolicyRunAllowed(RoutePolicy policy) {
            if (policy instanceof StatefulService) {
                StatefulService ss = (StatefulService) policy;
                return ss.isRunAllowed();
            }
            return true;
        }
View Full Code Here

Examples of org.apache.camel.StatefulService

            }
        }

        private static boolean isCamelStopping(CamelContext context) {
            if (context instanceof StatefulService) {
                StatefulService ss = (StatefulService) context;
                return ss.isStopping() || ss.isStopped();
            }
            return false;
        }
View Full Code Here

Examples of org.apache.camel.StatefulService

        // log the merged route at info level to make it easier to end users to spot any mistakes they may have made
        log.info("AdviceWith route after: " + merged);

        // If the camel context is started then we start the route
        if (camelContext instanceof StatefulService) {
            StatefulService service = (StatefulService) camelContext;
            if (service.isStarted()) {
                camelContext.startRoute(merged);
            }
        }
        return merged;
    }
View Full Code Here

Examples of org.serviceconnector.service.StatefulService

    InetSocketAddress socketAddress = request.getRemoteSocketAddress();

    SCMPMessage message = request.getMessage();
    String serviceName = message.getServiceName();
    // lookup service and checks properness
    StatefulService service = this.getStatefulService(serviceName);

    String serverKey = serviceName + "_" + socketAddress.getHostName() + Constants.SLASH + socketAddress.getPort();
    // controls that server not has been registered before for specific service
    this.getServerByKeyAndValidateNotRegistered(serverKey);

    int maxSessions = message.getHeaderInt(SCMPHeaderAttributeKey.MAX_SESSIONS);
    int maxConnections = message.getHeaderInt(SCMPHeaderAttributeKey.MAX_CONNECTIONS);
    int portNr = message.getHeaderInt(SCMPHeaderAttributeKey.PORT_NR);
    boolean immediateConnect = message.getHeaderFlag(SCMPHeaderAttributeKey.IMMEDIATE_CONNECT);
    int keepAliveIntervalSeconds = message.getHeaderInt(SCMPHeaderAttributeKey.KEEP_ALIVE_INTERVAL);
    int checkRegistrationIntervalSeconds = message.getHeaderInt(SCMPHeaderAttributeKey.CHECK_REGISTRATION_INTERVAL);
    String httpUrlFileQualifier = message.getHeader(SCMPHeaderAttributeKey.URL_PATH);

    if (httpUrlFileQualifier == null) {
      // httpUrlFileQualifier is an optional attribute
      httpUrlFileQualifier = Constants.SLASH;
    }

    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    IResponder responder = responderRegistry.getCurrentResponder();
    ListenerConfiguration listenerConfig = responder.getListenerConfig();
    String connectionType = listenerConfig.getConnectionType();

    RemoteNodeConfiguration remoteNodeConfiguration = new RemoteNodeConfiguration(ServerType.STATEFUL_SERVER, serverKey,
        socketAddress.getHostName(), portNr, connectionType, keepAliveIntervalSeconds, checkRegistrationIntervalSeconds,
        maxConnections, maxSessions, httpUrlFileQualifier);
    // create new server
    StatefulServer server = new StatefulServer(remoteNodeConfiguration, serviceName, socketAddress);
    try {
      if (immediateConnect) {
        // server connections get connected immediately
        server.immediateConnect();
      }
    } catch (Exception ex) {
      LOGGER.error("immediate connect", ex);
      HasFaultResponseException communicationException = new SCMPCommunicationException(SCMPError.CONNECTION_EXCEPTION,
          "immediate connect to server=" + serverKey);
      communicationException.setMessageType(getKey());
      throw communicationException;
    }
    // add server to service
    service.addServer(server);
    // add service to server
    server.setService(service);
    // add server to server registry
    this.serverRegistry.addServer(serverKey, server);
View Full Code Here

Examples of org.serviceconnector.service.StatefulService

      case PUBLISH_SERVICE:
        if (counter != 0) {
          sb.append(Constants.AMPERSAND_SIGN);
        }
        counter++;
        StatefulService statefulService = (StatefulService) service;
        sb.append(statefulService.getName());
        sb.append(Constants.EQUAL_SIGN);
        sb.append(statefulService.getCountAllocatedSessions());
        sb.append(Constants.SLASH);
        sb.append(statefulService.getCountAvailableSessions());
        found = true;
        break;
      case FILE_SERVICE:
      case CASCADED_FILE_SERVICE:
      case CASCADED_PUBLISH_SERVICE:
      case CASCADED_SESSION_SERVICE:
        if (counter != 0) {
          sb.append(Constants.AMPERSAND_SIGN);
        }
        counter++;
        statefulService = (StatefulService) service;
        sb.append(statefulService.getName());
        sb.append(Constants.EQUAL_SIGN);
        sb.append("-/-");
        found = true;
        break;
      default:
View Full Code Here

Examples of org.serviceconnector.service.StatefulService

      case CACHE_GUARDIAN:
        if (counter != 0) {
          sb.append(Constants.AMPERSAND_SIGN);
        }
        counter++;
        StatefulService statefulService = (StatefulService) service;
        sb.append(statefulService.getName());
        sb.append(Constants.EQUAL_SIGN);
        sb.append(statefulService.getCountAllocatedSessions());
        sb.append(Constants.SLASH);
        sb.append(statefulService.getCountAvailableSessions());
        found = true;
        break;
      case FILE_SERVICE:
      case CASCADED_FILE_SERVICE:
      case CASCADED_PUBLISH_SERVICE:
      case CASCADED_SESSION_SERVICE:
      case CASCADED_CACHE_GUARDIAN:
        if (counter != 0) {
          sb.append(Constants.AMPERSAND_SIGN);
        }
        counter++;
        statefulService = (StatefulService) service;
        sb.append(statefulService.getName());
        sb.append(Constants.EQUAL_SIGN);
        sb.append("-/-");
        found = true;
        break;
      default:
View Full Code Here

Examples of org.serviceconnector.service.StatefulService

    InetSocketAddress socketAddress = request.getRemoteSocketAddress();

    SCMPMessage message = request.getMessage();
    String serviceName = message.getServiceName();
    // lookup service and checks properness
    StatefulService service = this.getStatefulService(serviceName);

    String serverKey = serviceName + "_" + socketAddress.getHostName() + Constants.SLASH + socketAddress.getPort();
    // controls that server not has been registered before for specific service
    this.getServerByKeyAndValidateNotRegistered(serverKey);

    int maxSessions = message.getHeaderInt(SCMPHeaderAttributeKey.MAX_SESSIONS);
    int maxConnections = message.getHeaderInt(SCMPHeaderAttributeKey.MAX_CONNECTIONS);
    int portNr = message.getHeaderInt(SCMPHeaderAttributeKey.PORT_NR);
    boolean immediateConnect = message.getHeaderFlag(SCMPHeaderAttributeKey.IMMEDIATE_CONNECT);
    int keepAliveIntervalSeconds = message.getHeaderInt(SCMPHeaderAttributeKey.KEEP_ALIVE_INTERVAL);
    int checkRegistrationIntervalSeconds = message.getHeaderInt(SCMPHeaderAttributeKey.CHECK_REGISTRATION_INTERVAL);
    String httpUrlFileQualifier = message.getHeader(SCMPHeaderAttributeKey.URL_PATH);

    if (httpUrlFileQualifier == null) {
      // httpUrlFileQualifier is an optional attribute
      httpUrlFileQualifier = Constants.SLASH;
    }

    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    IResponder responder = responderRegistry.getCurrentResponder();
    ListenerConfiguration listenerConfig = responder.getListenerConfig();
    String connectionType = listenerConfig.getConnectionType();

    RemoteNodeConfiguration remoteNodeConfiguration = new RemoteNodeConfiguration(ServerType.STATEFUL_SERVER, serverKey,
        socketAddress.getHostName(), portNr, connectionType, keepAliveIntervalSeconds, checkRegistrationIntervalSeconds,
        maxConnections, maxSessions, httpUrlFileQualifier);
    // create new server
    StatefulServer server = new StatefulServer(remoteNodeConfiguration, serviceName, socketAddress);
    try {
      if (immediateConnect) {
        // server connections get connected immediately
        server.immediateConnect();
      }
    } catch (Exception ex) {
      LOGGER.error("immediate connect", ex);
      HasFaultResponseException communicationException = new SCMPCommunicationException(SCMPError.CONNECTION_EXCEPTION,
          "immediate connect to server=" + serverKey);
      communicationException.setMessageType(getKey());
      throw communicationException;
    }
    // add server to service
    service.addServer(server);
    // add service to server
    server.setService(service);
    // add server to server registry
    this.serverRegistry.addServer(serverKey, server);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.