Package org.serviceconnector.service

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


      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

      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

    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

Related Classes of org.serviceconnector.service.StatefulService

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.