Examples of PublishService


Examples of org.serviceconnector.service.PublishService

  @Override
  public void run(IRequest request, IResponse response, IResponderCallback responderCallback) throws Exception {
    SCMPMessage message = request.getMessage();
    String serviceName = message.getServiceName();
    // lookup service and checks properness
    PublishService service = this.validatePublishService(serviceName);

    // reset server timeout
    this.resetServerTimeout(serviceName, request.getRemoteSocketAddress());

    PublishMessageQueue<SCMPMessage> queue = service.getMessageQueue();
    // throws an exception if failed
    queue.insert(message);

    // reply to server
    SCMPMessage reply = null;
View Full Code Here

Examples of org.serviceconnector.service.PublishService

    // 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);
View Full Code Here

Examples of org.serviceconnector.service.PublishService

      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);
View Full Code Here

Examples of org.serviceconnector.service.PublishService

      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);
View Full Code Here

Examples of org.serviceconnector.service.PublishService

  @Override
  public void run(IRequest request, IResponse response, IResponderCallback responderCallback) throws Exception {
    SCMPMessage message = request.getMessage();
    String serviceName = message.getServiceName();
    // lookup service and checks properness
    PublishService service = this.validatePublishService(serviceName);

    // Managed data arrived over cache guardian - handle caching
    if (service.getType() == ServiceType.CACHE_GUARDIAN) {
      if (service.getCountAllocatedSessions() > 0) {
        // existing subscriptions on cache guardian - cache managed data
        message.setSessionId("SPUnoSid"); // setting a dummy sid, is needed for the cache!
        AppContext.getSCCache().cacheManagedData(message);
      }
    } else if (service.getType() == ServiceType.CASCADED_CACHE_GUARDIAN) {
      // always cache managed data for cascaded cache guardian
      message.setSessionId("SPUnoSid"); // setting a dummy sid, is needed for the cache!
      AppContext.getSCCache().cacheManagedData(message);
    }

    // reset server timeout
    this.resetServerTimeout(serviceName, request.getRemoteSocketAddress());

    PublishMessageQueue<SCMPMessage> queue = service.getMessageQueue();
    // throws an exception if failed
    queue.insert(message);

    // reply to server
    SCMPMessage reply = null;
View Full Code Here

Examples of org.serviceconnector.service.PublishService

    // 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);
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.