Examples of CommandCallback


Examples of org.geomajas.puregwt.client.command.CommandCallback

    request.setScale(viewPort.getScale());
    Command command = new Command(GetRasterTilesRequest.COMMAND);
    command.setCommandRequest(request);

    // Execute the fetch, and render on success:
    deferred = commandService.execute(command, new CommandCallback() {

      public void onSuccess(CommandResponse response) {
        if (response instanceof GetRasterTilesResponse) {
          addTiles(((GetRasterTilesResponse) response).getRasterData(), zooming);
        }
View Full Code Here

Examples of org.geomajas.puregwt.client.command.CommandCallback

    request.setScale(viewPort.getScale());
    Command command = new Command(GetRasterTilesRequest.COMMAND);
    command.setCommandRequest(request);

    // Execute the fetch, and render on success:
    deferred = commandService.execute(command, new CommandCallback() {

      public void onSuccess(CommandResponse response) {
        if (response instanceof GetRasterTilesResponse) {
          addTiles(((GetRasterTilesResponse) response).getRasterData());
        }
View Full Code Here

Examples of org.geomajas.puregwt.client.command.CommandCallback

  // Private methods:
  // -------------------------------------------------------------------------

  private void render(final boolean renderSiblings) {
    Command command = createCommand();
    deferred = service.execute(command, new CommandCallback() {

      public void onSuccess(CommandResponse response) {
        if (!(deferred != null && deferred.isCancelled()) && response instanceof GetVectorTileResponse) {
          GetVectorTileResponse tileResponse = (GetVectorTileResponse) response;
          VectorTile tile = tileResponse.getTile();
View Full Code Here

Examples of org.jboss.arquillian.container.test.spi.command.CommandCallback

   {
      final ContextSnapshot state = executorService.get().createSnapshotContext();
     
      ContainerMethodExecutor executor = ((Protocol)protocol.getProtocol()).getExecutor(
            protocolConfiguration,
            protocolMetadata.get(), new CommandCallback()
            {
               @Override
               public void fired(Command<?> event)
               {
                  state.activate();
View Full Code Here

Examples of org.jboss.arquillian.container.test.spi.command.CommandCallback

      final TestContext testContext = testContextInst.get();
      final Object testContextId = testContext.getActiveId();
     
      ContainerMethodExecutor executor = ((Protocol)protocol.getProtocol()).getExecutor(
            protocolConfiguration,
            protocolMetadata.get(), new CommandCallback()
            {
               @Override
               public void fired(Command<?> event)
               {
                  applicationContext.activate();
View Full Code Here

Examples of org.serviceconnector.cmd.sc.CommandCallback

      message.setHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID, cascClient.getSubscriptionId());
      message.setServiceName(cascClient.getServiceName());
      long msgSeqNr = cascClient.getMsgSequenceNr().incrementAndGetMsgSequenceNr();
      message.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSeqNr);
      SCMPCscUnsubscribeCall unsubscribeCall = new SCMPCscUnsubscribeCall(this.requester, message);
      unsubscribeCall.invoke(new CommandCallback(false), AppContext.getBasicConfiguration().getSrvAbortOTIMillis());
    } catch (Exception e) {
      LOGGER.warn("unsubscribing cascaded client failed service=" + cascClient.getServiceName() + " " + e.toString());
    }
  }
View Full Code Here

Examples of org.serviceconnector.cmd.sc.CommandCallback

      // server got already destroyed - no need to continue.
      return;
    }
    int tries = (int) ((oti * AppContext.getBasicConfiguration().getOperationTimeoutMultiplier()) / Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
    int i = 0;
    CommandCallback callback = null;
    int otiOnServerMillis = 0;
    try {
      // Following loop implements the wait mechanism in case of a busy connection pool
      do {
        callback = new CommandCallback(true);
        try {
          otiOnServerMillis = oti - (i * Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
          if (abortSubscription == true) {
            this.serverAbortSubscription(abortMessage, callback, otiOnServerMillis);
          } else {
            this.serverAbortSession(abortMessage, callback, otiOnServerMillis);
          }
          // no exception has been thrown - get out of wait loop
          break;
        } catch (ConnectionPoolBusyException ex) {
          LOGGER.warn("ConnectionPoolBusyException caught in wait mec of session abort");
          if (i >= (tries - 1)) {
            // only one loop outstanding - don't continue throw current exception
            LOGGER.warn(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + abortMessage.getServiceName()));
            SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION,
                "service=" + abortMessage.getServiceName());
            throw scmpCommandException;
          }
        }
        // sleep for a while and then try again
        Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
      } while (++i < tries);

      // validate reply of server
      SCMPMessage reply = callback.getMessageSync(oti);
      if (reply.isFault()) {
        // error in server abort session - destroy server
        this.abortSessionsAndDestroy("Session abort failed, abort reason: " + reason);
      }
    } catch (SCMPCommandException scmpCommandException) {
      LOGGER.warn("ConnectionPoolBusyException in aborting session wait mec " + scmpCommandException.toString());
      // ConnectionPoolBusyException after wait mec - try opening a new connection

      // RemoteNodeConfiguration remoteNodeConfiguration = this.requester.getRemoteNodeConfiguration();
      // set up a new requester to make the SAS - only 1 connection is allowed
      Requester sasRequester = new Requester(this.sasRemoteNodeConfiguration);
      try {
        this.serverAbortSessionWithExtraRequester(sasRequester, abortMessage, callback, oti);
      } catch (ConnectionPoolBusyException e) {
        sasRequester.destroy();
        LOGGER.warn("ConnectionPoolBusyException in aborting session wait mec over special connection. " + e.toString());
        if (this.service.getType() == ServiceType.SESSION_SERVICE) {
          this.abortSessionsAndDestroy("Session abort over a new connection failed");
        }
        return;
      }
      sasRequester.destroy();
      // validate reply of server
      SCMPMessage reply = callback.getMessageSync(oti);
      if (reply.isFault()) {
        LOGGER.warn("Fault in aborting session wait mec over special connection");
        // error in server abort session - destroy server
        this.abortSessionsAndDestroy("Session abort over a new connection failed");
      }
View Full Code Here

Examples of org.serviceconnector.cmd.sc.CommandCallback

          Set<String> subscriptionIds = subscription.getCscSubscriptionIds().keySet();

          for (String id : subscriptionIds) {
            abortMessage.setSessionId(id);
            try {
              this.serverAbortSubscription(abortMessage, new CommandCallback(false), AppContext
                  .getBasicConfiguration().getSrvAbortOTIMillis());
            } catch (ConnectionPoolBusyException e) {
              LOGGER.warn("aborting subscription failed because of busy connection pool. " + e.toString());
            } catch (Exception e) {
              LOGGER.warn("aborting subscription failed. " + e.toString());
            }
          }
          subscription.getCscSubscriptionIds().clear();
          // subscription is of type cascaded - do not forward to server
          continue;
        }
        try {
          this.serverAbortSubscription(abortMessage, new CommandCallback(false), AppContext.getBasicConfiguration()
              .getSrvAbortOTIMillis());
        } catch (ConnectionPoolBusyException e) {
          LOGGER.warn("aborting subscription failed because of busy connection pool. " + e.toString());
        } catch (Exception e) {
          LOGGER.warn("aborting subscription failed. " + e.toString());
        }
      } else {
        SessionLogger.logAbortSession((Session) session, reason);
        try {
          this.serverAbortSession(abortMessage, new CommandCallback(false), AppContext.getBasicConfiguration()
              .getSrvAbortOTIMillis());
        } catch (ConnectionPoolBusyException e) {
          LOGGER.warn("aborting session failed because of busy connection pool. " + e.toString());
        } catch (Exception e) {
          LOGGER.warn("aborting session failed. " + e.toString());
View Full Code Here

Examples of org.serviceconnector.cmd.sc.CommandCallback

      message.setHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID, cascClient.getSubscriptionId());
      message.setServiceName(cascClient.getServiceName());
      long msgSeqNr = cascClient.getMsgSequenceNr().incrementAndGetMsgSequenceNr();
      message.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSeqNr);
      SCMPCscUnsubscribeCall unsubscribeCall = new SCMPCscUnsubscribeCall(this.requester, message);
      unsubscribeCall.invoke(new CommandCallback(false), AppContext.getBasicConfiguration().getSrvAbortOTIMillis());
    } catch (Exception e) {
      LOGGER.warn("unsubscribing cascaded client failed service=" + cascClient.getServiceName() + " " + e.toString());
    }
  }
View Full Code Here

Examples of org.serviceconnector.cmd.sc.CommandCallback

      // server got already destroyed - no need to continue.
      return;
    }
    int tries = (int) ((oti * AppContext.getBasicConfiguration().getOperationTimeoutMultiplier()) / Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
    int i = 0;
    CommandCallback callback = null;
    int otiOnServerMillis = 0;
    try {
      // Following loop implements the wait mechanism in case of a busy connection pool
      do {
        callback = new CommandCallback(true);
        try {
          otiOnServerMillis = oti - (i * Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
          if (abortSubscription == true) {
            this.serverAbortSubscription(abortMessage, callback, otiOnServerMillis);
          } else {
            this.serverAbortSession(abortMessage, callback, otiOnServerMillis);
          }
          // no exception has been thrown - get out of wait loop
          break;
        } catch (ConnectionPoolBusyException ex) {
          LOGGER.warn("ConnectionPoolBusyException caught in wait mec of session abort");
          if (i >= (tries - 1)) {
            // only one loop outstanding - don't continue throw current exception
            LOGGER.warn(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + abortMessage.getServiceName()));
            SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION,
                "service=" + abortMessage.getServiceName());
            throw scmpCommandException;
          }
        }
        // sleep for a while and then try again
        Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
      } while (++i < tries);

      // validate reply of server
      SCMPMessage reply = callback.getMessageSync(oti);
      if (reply.isFault()) {
        // error in server abort session - destroy server
        this.abortSessionsAndDestroy("Session abort failed, abort reason: " + reason);
      }
    } catch (SCMPCommandException scmpCommandException) {
      LOGGER.warn("ConnectionPoolBusyException in aborting session wait mec " + scmpCommandException.toString());
      // ConnectionPoolBusyException after wait mec - try opening a new connection

      // RemoteNodeConfiguration remoteNodeConfiguration = this.requester.getRemoteNodeConfiguration();
      // set up a new requester to make the SAS - only 1 connection is allowed
      Requester sasRequester = new Requester(this.sasRemoteNodeConfiguration);
      try {
        this.serverAbortSessionWithExtraRequester(sasRequester, abortMessage, callback, oti);
      } catch (ConnectionPoolBusyException e) {
        sasRequester.destroy();
        LOGGER.warn("ConnectionPoolBusyException in aborting session wait mec over special connection. " + e.toString());
        if (this.service.getType() == ServiceType.SESSION_SERVICE) {
          this.abortSessionsAndDestroy("Session abort over a new connection failed");
        }
        return;
      }
      sasRequester.destroy();
      // validate reply of server
      SCMPMessage reply = callback.getMessageSync(oti);
      if (reply.isFault()) {
        LOGGER.warn("Fault in aborting session wait mec over special connection");
        // error in server abort session - destroy server
        this.abortSessionsAndDestroy("Session abort over a new connection failed");
      }
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.