Examples of AsyncCallback


Examples of com.google.gwt.user.client.rpc.AsyncCallback

   }

   /** Now lets actually go to the server, using a callback - its called Ajax for a reason ! */
   private void askServer(String text)
   {
      getService().askIt(text, new AsyncCallback()
      {
         public void onFailure(Throwable t)
         {
            Window.alert(t.getMessage());
         }
View Full Code Here

Examples of com.google.gwt.user.client.rpc.AsyncCallback

        keepAlive = true;

        alert("received callback for (" + topicName + "," + data + ")");

        if (callbacks.containsKey(topicName)) {
            AsyncCallback callback = (AsyncCallback) callbacks.get(topicName);

            try {
                Object dataToSend = data;

                if (data.startsWith("$JSONSTART$") && data.endsWith("$JSONEND$")) {
                    dataToSend = JSONParser.parse(data.substring("$JSONSTART$".length(), data.length() - "$JSONEND$".length()));
                }

                callback.onSuccess(dataToSend);
            } catch (JSONException e) {
                callback.onFailure(e);
            }
        } else {
            alert("received event for a not subscribed topic: '" + topicName + "'");
            alert("current topics are: " + callbacks.keySet());
        }
View Full Code Here

Examples of com.google.gwt.user.client.rpc.AsyncCallback

    // Set "loading" status
    status.setText(FrameworkLocale.messages().loading());
    setButtonsEnable(false);

    // Loading data row
    rowLoader.GetData(new AsyncCallback() {

      public void onFailure(Throwable caught) {
        if (!isHidden()) {
          status.setText(FrameworkLocale.messages().error());
          throw new AsyncCallbackFailureException(FrameworkLocale
View Full Code Here

Examples of com.google.gwt.user.client.rpc.AsyncCallback

      // Here we can add empty row for nice data loading visualisation.
    }
   
    showStatusPanel(FrameworkLocale.messages().loading());
   
    dataSource.selectCount(params, new AsyncCallback() {
      public void onFailure(Throwable caught) {
        if (!parentWindow.isHidden()) {
          pager.setErrorMessage(FrameworkLocale.messages().asyncerror_loadrowscount());
          throw new AsyncCallbackFailureException(FrameworkLocale.messages().asyncerror_loadrowscount(), caught);
        }
      }
      public void onSuccess(Object result) {
        if (!parentWindow.isHidden()) {
          pager.setTotalCount(((Integer)result).intValue());
          pager.refresh();
        }
      }
    });
   
    dataSource.select(params,  new AsyncCallback() {
      public void onFailure(Throwable caught) {
        if (!parentWindow.isHidden()) {
          showStatusPanel((FrameworkLocale.messages().asyncerror_loadrows()));
          throw new AsyncCallbackFailureException(FrameworkLocale.messages().asyncerror_loadrows(), caught);
        }
View Full Code Here

Examples of com.google.gwt.user.client.rpc.AsyncCallback

  public RemoteLogger() {
    service = (RemoteLoggerServiceAsync) GWT.create(RemoteLoggerService.class);
    final ServiceDefTarget target = (ServiceDefTarget) service;
    target.setServiceEntryPoint(GWT.getModuleBaseURL() + "gwt-log");

    callback = new AsyncCallback() {
      public void onFailure(Throwable ex) {
        if (failure == null) {
          failure = new RuntimeException(
              "Remote logging will be suspended due to communication failure with "
                  + GWT.getTypeName(service) + " at " + target.getServiceEntryPoint(), ex);
View Full Code Here

Examples of com.linkedin.helix.messaging.AsyncCallback

    int nMsgs = _startCMResultMap.get(hostSrc)._manager.getMessagingService().send(cr, msg);
    AssertJUnit.assertTrue(nMsgs == 1);

    msg.setMsgId(UUID.randomUUID().toString());
    AsyncCallback asyncCallback = new MockAsyncCallback();
    int messagesSent = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
        .sendAndWait(cr, msg, asyncCallback, 3000);
    Assert.assertTrue(messagesSent == 1);
    Assert.assertTrue(asyncCallback.isTimedOut());
    HelixDataAccessor accessor = _startCMResultMap.get(hostDest)._manager.getHelixDataAccessor();

    Assert.assertTrue(accessor.getChildNames(accessor.keyBuilder().messages(hostDest)).size() == 0);

    msg = new Message(factory.getMessageType(),msgId);
View Full Code Here

Examples of org.apache.camel.AsyncCallback

    }

    public boolean process(Exchange exchange, final AsyncCallback callback) {
        ObjectHelper.notNull(loadBalancer, "loadBalancer");
       
        return loadBalancer.process(exchange, new AsyncCallback() {
            public void done(boolean doneSynchronously) {
                // Only handle the async case...
                if (doneSynchronously) {
                    return;
                } else {
View Full Code Here

Examples of org.apache.camel.AsyncCallback

        if (LOG.isTraceEnabled()) {
            LOG.trace("Timer {} is firing #{} count", endpoint.getTimerName(), counter);
        }

        if (!endpoint.isSynchronous()) {
            getAsyncProcessor().process(exchange, new AsyncCallback() {
                @Override
                public void done(boolean doneSync) {
                    // handle any thrown exception
                    if (exchange.getException() != null) {
                        getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
View Full Code Here

Examples of org.apache.camel.AsyncCallback

            boolean sync;
            if (data.redeliverFromSync) {
                // this redelivery task was scheduled from synchronous, which we forced to be asynchronous from
                // this error handler, which means we have to invoke the callback with false, to have the callback
                // be notified when we are done
                sync = outputAsync.process(exchange, new AsyncCallback() {
                    public void done(boolean doneSync) {
                        log.trace("Redelivering exchangeId: {} done sync: {}", exchange.getExchangeId(), doneSync);

                        // mark we are in sync mode now
                        data.sync = false;

                        // only process if the exchange hasn't failed
                        // and it has not been handled by the error processor
                        if (isDone(exchange)) {
                            callback.done(false);
                            return;
                        }

                        // error occurred so loop back around which we do by invoking the processAsyncErrorHandler
                        processAsyncErrorHandler(exchange, callback, data);
                    }
                });
            } else {
                // this redelivery task was scheduled from asynchronous, which means we should only
                // handle when the asynchronous task was done
                sync = outputAsync.process(exchange, new AsyncCallback() {
                    public void done(boolean doneSync) {
                        log.trace("Redelivering exchangeId: {} done sync: {}", exchange.getExchangeId(), doneSync);

                        // this callback should only handle the async case
                        if (doneSync) {
View Full Code Here

Examples of org.apache.camel.AsyncCallback

                // emmit event we are doing redelivery
                EventHelper.notifyExchangeRedelivery(exchange.getContext(), exchange, data.redeliveryCounter);
            }

            // process the exchange (also redelivery)
            boolean sync = outputAsync.process(exchange, new AsyncCallback() {
                public void done(boolean sync) {
                    // this callback should only handle the async case
                    if (sync) {
                        return;
                    }
View Full Code Here
TOP
Copyright © 2015 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.