Package org.jboss.errai.bus.client.framework

Examples of org.jboss.errai.bus.client.framework.ClientMessageBusImpl$LongPollRequestCallback


   * Debugging functions.
   */
  private void displayStatus() {
    displayDebuggerUtilityTitle("ErraiBus Transport Status");

    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final boolean federatedApp = BusToolsCli.isRemoteCommunicationEnabled();

    nativeLog("Bus State               : " + (bus.getState()));
    nativeLog("Wire Protocol           : V3.JSON");
    nativeLog("Active Channel          : " + (!federatedApp ? "None" : (bus.getTransportHandler())));

    displaySeparator();
    final TransportStatistics stats = bus.getTransportHandler().getStatistics();

    nativeLog("Channel Details:");
    if (federatedApp) {
      nativeLog("  Channel Description   : " + (stats.getTransportDescription()));
      if (stats.isFullDuplex()) {
        nativeLog("  Endpoint (RX/TX)      : " + (stats.getRxEndpoint()));
      }
      else {
        nativeLog("  Endpoint (RX)         : " + (stats.getRxEndpoint()));
        nativeLog("  Endpoint (TX)         : " + (stats.getTxEndpoint()));
      }
      nativeLog("  Pending Transmissions : " + (stats.getPendingMessages()));
      nativeLog("");
      nativeLog("  TX Count              : " + (stats.getMessagesSent()));
      nativeLog("  RX Count              : " + (stats.getMessagesReceived()));
      final long connectedTime = stats.getConnectedTime();
      if (connectedTime == -1) {
        nativeLog("  Time Connected        : Not Connected.");
      }
      else {
        nativeLog("  Time Connected        : " + ((System.currentTimeMillis() - connectedTime) / 1000) + " secs.");
      }
      nativeLog("  Last Activity (TX/RX) : " + ((System.currentTimeMillis() - stats.getLastTransmissionTime()) / 1000) + " secs ago.");
      final int measuredLatency = stats.getMeasuredLatency();
      nativeLog("  Measured Latency      : " + (measuredLatency == -1 ? "N/A" : measuredLatency + "ms"));
    }
    else {
      nativeLog("  <No transport configured>");
    }

    displaySeparator();

    nativeLog("Available Handlers:");
    final Collection<TransportHandler> allAvailableHandlers = bus.getAllAvailableHandlers();

    if (allAvailableHandlers.isEmpty()) {
      nativeLog(" [none]");
    }
    for (final TransportHandler handler : allAvailableHandlers) {
      if (handler.isUsable()) {
        nativeLog("  > " + handler.getStatistics().getTransportDescription() + " " + (handler == bus.getTransportHandler() ? "**" : ""));
      }
    }
    nativeLog("Unavailable Handlers");
    for (final TransportHandler handler : allAvailableHandlers) {
      if (!handler.isUsable()) {
View Full Code Here


/**
* The GWT entry point
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    // conversation interceptor
    bus.addInterceptor(CDI.CONVERSATION_INTERCEPTOR);

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        MessageBuilder.createMessage().toSubject("cdi.event:Dispatcher").command(CDICommands.AttachRemote).done()
                .sendNowWith(bus);

        CDI.fireEvent(new BusReadyEvent());
      }
    };


    bus.subscribe("cdi.event:ClientDispatcher", new MessageCallback() {
      public void callback(Message message) {
        switch (BusCommands.valueOf(message.getCommandType())) {
          case RemoteSubscribe:
            CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));

            bus.addPostInitTask(new Runnable() {
              @Override
              public void run() {
                CDI.activate();
              }
            });
            break;

        }
      }
    });

    /**
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initalization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addInitializationListener(new InitializationListener() {
          public void onInitilization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });

    bus.addPostInitTask(busReadyEvent);

  }
View Full Code Here

   * Debugging functions.
   */
  private void displayStatus() {
    displayDebuggerUtilityTitle("ErraiBus Transport Status");

    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final boolean federatedApp = BusToolsCli.isRemoteCommunicationEnabled();

    nativeLog("Bus State               : " + (bus.getState()));
    nativeLog("Wire Protocol           : V3.JSON");
    nativeLog("Active Channel          : " + (!federatedApp ? "None" : (bus.getTransportHandler())));

    displaySeparator();
    final TransportStatistics stats = bus.getTransportHandler().getStatistics();

    nativeLog("Channel Details:");
    if (federatedApp) {
      nativeLog("  Channel Description   : " + (stats.getTransportDescription()));
      if (stats.isFullDuplex()) {
        nativeLog("  Endpoint (RX/TX)      : " + (stats.getRxEndpoint()));
      }
      else {
        nativeLog("  Endpoint (RX)         : " + (stats.getRxEndpoint()));
        nativeLog("  Endpoint (TX)         : " + (stats.getTxEndpoint()));
      }
      nativeLog("  Pending Transmissions : " + (stats.getPendingMessages()));
      nativeLog("");
      nativeLog("  TX Count              : " + (stats.getMessagesSent()));
      nativeLog("  RX Count              : " + (stats.getMessagesReceived()));
      final long connectedTime = stats.getConnectedTime();
      if (connectedTime == -1) {
        nativeLog("  Time Connected        : Not Connected.");
      }
      else {
        nativeLog("  Time Connected        : " + ((System.currentTimeMillis() - connectedTime) / 1000) + " secs.");
      }
      nativeLog("  Last Activity (TX/RX) : " + ((System.currentTimeMillis() - stats.getLastTransmissionTime()) / 1000) + " secs ago.");
      final int measuredLatency = stats.getMeasuredLatency();
      nativeLog("  Measured Latency      : " + (measuredLatency == -1 ? "N/A" : measuredLatency + "ms"));
    }
    else {
      nativeLog("  <No transport configured>");
    }

    displaySeparator();

    nativeLog("Available Handlers:");
    final Collection<TransportHandler> allAvailableHandlers = bus.getAllAvailableHandlers();

    if (allAvailableHandlers.isEmpty()) {
      nativeLog(" [none]");
    }
    for (final TransportHandler handler : allAvailableHandlers) {
      if (handler.isUsable()) {
        nativeLog("  > " + handler.getStatistics().getTransportDescription() + " " + (handler == bus.getTransportHandler() ? "**" : ""));
      }
    }
    nativeLog("Unavailable Handlers");
    for (final TransportHandler handler : allAvailableHandlers) {
      if (!handler.isUsable()) {
View Full Code Here

   * Debugging functions.
   */
  private void displayStatus() {
    displayDebuggerUtilityTitle("ErraiBus Transport Status");

    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final boolean federatedApp = BusToolsCli.isRemoteCommunicationEnabled();

    nativeLog("Bus State               : " + (bus.getState()));
    nativeLog("Wire Protocol           : V3.JSON");
    nativeLog("Active Channel          : " + (!federatedApp ? "None" : (bus.getTransportHandler())));

    displaySeparator();
    final TransportStatistics stats = bus.getTransportHandler().getStatistics();

    nativeLog("Channel Details:");
    if (federatedApp) {
      nativeLog("  Channel Description   : " + (stats.getTransportDescription()));
      if (stats.isFullDuplex()) {
        nativeLog("  Endpoint (RX/TX)      : " + (stats.getRxEndpoint()));
      }
      else {
        nativeLog("  Endpoint (RX)         : " + (stats.getRxEndpoint()));
        nativeLog("  Endpoint (TX)         : " + (stats.getTxEndpoint()));
      }
      nativeLog("  Pending Transmissions : " + (stats.getPendingMessages()));
      nativeLog("");
      nativeLog("  TX Count              : " + (stats.getMessagesSent()));
      nativeLog("  RX Count              : " + (stats.getMessagesReceived()));
      final long connectedTime = stats.getConnectedTime();
      if (connectedTime == -1) {
        nativeLog("  Time Connected        : Not Connected.");
      }
      else {
        nativeLog("  Time Connected        : " + ((System.currentTimeMillis() - connectedTime) / 1000) + " secs.");
      }
      nativeLog("  Last Activity (TX/RX) : " + ((System.currentTimeMillis() - stats.getLastTransmissionTime()) / 1000) + " secs ago.");
      final int measuredLatency = stats.getMeasuredLatency();
      nativeLog("  Measured Latency      : " + (measuredLatency == -1 ? "N/A" : measuredLatency + "ms"));
    }
    else {
      nativeLog("  <No transport configured>");
    }

    displaySeparator();

    nativeLog("Available Handlers:");
    final Collection<TransportHandler> allAvailableHandlers = bus.getAllAvailableHandlers();

    if (allAvailableHandlers.isEmpty()) {
      nativeLog(" [none]");
    }
    for (final TransportHandler handler : allAvailableHandlers) {
      if (handler.isUsable()) {
        nativeLog("  > " + handler.getStatistics().getTransportDescription() + " " + (handler == bus.getTransportHandler() ? "**" : ""));
      }
    }
    nativeLog("Unavailable Handlers");
    for (final TransportHandler handler : allAvailableHandlers) {
      if (!handler.isUsable()) {
View Full Code Here

* @author Christian Sadilek <csadilek@redhat.com>
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    InitVotes.waitFor(CDIClientBootstrap.class);
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        if (bus.isRemoteCommunicationEnabled()) {
          MessageBuilder.createMessage().toSubject(CDI.SERVER_DISPATCHER_SUBJECT)
                  .command(CDICommands.AttachRemote)
                  .done()
                  .sendNowWith(bus);
        }
        else {
          InitVotes.waitFor(CDI.class);
          CDI.activate();
        }

        CDI.fireEvent(new BusReadyEvent());
      }

      public String toString() {
        return "BusReadyEvent";
      }
    };

    bus.addPostInitTask(busReadyEvent);

    if (!bus.isSubscribed(CDI.CLIENT_DISPATCHER_SUBJECT)) {
      bus.subscribe(CDI.CLIENT_DISPATCHER_SUBJECT, new MessageCallback() {
        public void callback(Message message) {
          switch (CDICommands.valueOf(message.getCommandType())) {
            case RemoteSubscribe:
              CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));
              bus.addPostInitTask(new Runnable() {
                @Override
                public void run() {
                  CDI.activate();
                }

                public String toString() {
                  return "CDI service activate";
                }
              });
              break;
            case CDIEvent:
              CDI.consumeEventFromMessage(message);
              break;
          }
        }
      });
    }

    /*
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initialization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addPreInitializationListener(new PreInitializationListener() {
          public void beforeInitialization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });
    InitVotes.voteFor(CDIClientBootstrap.class);
View Full Code Here

   * Debugging functions.
   */
  private void displayStatus() {
    displayUtilityTitle("ErraiBus Transport Status");

    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final boolean federatedApp = BusToolsCli.isRemoteCommunicationEnabled();

    logger.info("Bus State               : " + (bus.getState()));
    logger.info("Wire Protocol           : V3.JSON");
    logger.info("Active Channel          : " + (!federatedApp ? "None" : (bus.getTransportHandler())));

    logger.info(SEP);
    final TransportStatistics stats = bus.getTransportHandler().getStatistics();

    logger.info("Channel Details:");
    if (federatedApp) {
      logger.info("  Channel Description   : " + (stats.getTransportDescription()));
      if (stats.isFullDuplex()) {
        logger.info("  Endpoint (RX/TX)      : " + (stats.getRxEndpoint()));
      }
      else {
        logger.info("  Endpoint (RX)         : " + (stats.getRxEndpoint()));
        logger.info("  Endpoint (TX)         : " + (stats.getTxEndpoint()));
      }
      logger.info("  Pending Transmissions : " + (stats.getPendingMessages()));
      logger.info("");
      logger.info("  TX Count              : " + (stats.getMessagesSent()));
      logger.info("  RX Count              : " + (stats.getMessagesReceived()));
      final long connectedTime = stats.getConnectedTime();
      if (connectedTime == -1) {
        logger.info("  Time Connected        : Not Connected.");
      }
      else {
        logger.info("  Time Connected        : " + ((System.currentTimeMillis() - connectedTime) / 1000) + " secs.");
      }
      logger.info("  Last Activity (TX/RX) : " + ((System.currentTimeMillis() - stats.getLastTransmissionTime()) / 1000) + " secs ago.");
      final int measuredLatency = stats.getMeasuredLatency();
      logger.info("  Measured Latency      : " + (measuredLatency == -1 ? "N/A" : measuredLatency + "ms"));
    }
    else {
      logger.info("  <No transport configured>");
    }

    logger.info(SEP);

    logger.info("Available Handlers:");
    final Collection<TransportHandler> allAvailableHandlers = bus.getAllAvailableHandlers();

    if (allAvailableHandlers.isEmpty()) {
      logger.info(" [none]");
    }
    for (final TransportHandler handler : allAvailableHandlers) {
      if (handler.isUsable()) {
        logger.info("  > " + handler.getStatistics().getTransportDescription() + " " + (handler == bus.getTransportHandler() ? "**" : ""));
      }
    }
    logger.info("Unavailable Handlers");
    for (final TransportHandler handler : allAvailableHandlers) {
      if (!handler.isUsable()) {
View Full Code Here

* @author Christian Sadilek <csadilek@redhat.com>
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    InitVotes.waitFor(CDIClientBootstrap.class);
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        if (bus.isRemoteCommunicationEnabled()) {
          MessageBuilder.createMessage().toSubject(CDI.SERVER_DISPATCHER_SUBJECT)
                  .command(CDICommands.AttachRemote)
                  .done()
                  .sendNowWith(bus);
          InitVotes.waitFor(CDI.class);
        }
        else {
          InitVotes.waitFor(CDI.class);
          CDI.activate();
        }

        CDI.fireEvent(new BusReadyEvent());
      }
    };

    bus.addPostInitTask(busReadyEvent);

    if (!bus.isSubscribed(CDI.CLIENT_DISPATCHER_SUBJECT)) {
      bus.subscribe(CDI.CLIENT_DISPATCHER_SUBJECT, new MessageCallback() {
        public void callback(Message message) {
          switch (CDICommands.valueOf(message.getCommandType())) {
            case RemoteSubscribe:
              CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));
              bus.addPostInitTask(new Runnable() {
                @Override
                public void run() {
                  CDI.activate();
                }
              });
              break;
            case CDIEvent:
              CDI.consumeEventFromMessage(message);
              break;
          }
        }
      });
    }
    /*
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initialization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addPreInitializationListener(new PreInitializationListener() {
          public void beforeInitialization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });
    InitVotes.voteFor(CDIClientBootstrap.class);
View Full Code Here

* @author Mike Brock <cbrock@redhat.com>
* @author Christian Sadilek <csadilek@redhat.com>
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        MessageBuilder.createMessage().toSubject("cdi.event:Dispatcher").command(CDICommands.AttachRemote).done()
                .sendNowWith(bus);

        CDI.fireEvent(new BusReadyEvent());
      }
    };

    bus.addPostInitTask(busReadyEvent);

    bus.subscribe("cdi.event:ClientDispatcher", new MessageCallback() {
      public void callback(Message message) {
        switch (BusCommands.valueOf(message.getCommandType())) {
          case RemoteSubscribe:
            CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));

            bus.addPostInitTask(new Runnable() {
              @Override
              public void run() {
                CDI.activate();
              }
            });
            break;
        }
      }
    });

    /*
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initialization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addPreInitializationListener(new PreInitializationListener() {
          public void beforeInitialization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });
  }
View Full Code Here

* @author Christian Sadilek <csadilek@redhat.com>
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    InitVotes.waitFor(CDIClientBootstrap.class);
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        MessageBuilder.createMessage().toSubject(CDI.SERVER_DISPATCHER_SUBJECT).command(CDICommands.AttachRemote).done()
                .sendNowWith(bus);

        InitVotes.waitFor(CDI.class);
        CDI.fireEvent(new BusReadyEvent());
      }
    };

    bus.addPostInitTask(busReadyEvent);

    bus.subscribe(CDI.CLIENT_DISPATCHER_SUBJECT, new MessageCallback() {
      public void callback(Message message) {
        switch (BusCommands.valueOf(message.getCommandType())) {
          case RemoteSubscribe:
            CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));

            bus.addPostInitTask(new Runnable() {
              @Override
              public void run() {
                CDI.activate();
              }
            });
            break;
        }
      }
    });

    /*
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initialization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addPreInitializationListener(new PreInitializationListener() {
          public void beforeInitialization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });
    InitVotes.voteFor(CDIClientBootstrap.class);
View Full Code Here

* @author Christian Sadilek <csadilek@redhat.com>
*/
public class CDIClientBootstrap implements EntryPoint {
  public void onModuleLoad() {
    InitVotes.waitFor(CDIClientBootstrap.class);
    final ClientMessageBusImpl bus = (ClientMessageBusImpl) ErraiBus.get();

    final Runnable busReadyEvent = new Runnable() {
      public void run() {
        MessageBuilder.createMessage().toSubject(CDI.SERVER_DISPATCHER_SUBJECT).command(CDICommands.AttachRemote).done()
                .sendNowWith(bus);

        CDI.fireEvent(new BusReadyEvent());
      }
    };

    bus.addPostInitTask(busReadyEvent);

    bus.subscribe(CDI.CLIENT_DISPATCHER_SUBJECT, new MessageCallback() {
      public void callback(Message message) {
        switch (BusCommands.valueOf(message.getCommandType())) {
          case RemoteSubscribe:
            CDI.addRemoteEventTypes(message.get(String[].class, MessageParts.Value));

            bus.addPostInitTask(new Runnable() {
              @Override
              public void run() {
                CDI.activate();
              }
            });
            break;
        }
      }
    });

    /*
     * Register an initialization lister to run the bus ready event.  This will be added
     * post-initialization, so it is designed to fire on bus reconnection events.
     */
    bus.addPostInitTask(new Runnable() {
      public void run() {
        bus.addPreInitializationListener(new PreInitializationListener() {
          public void beforeInitialization() {
            bus.addPostInitTask(busReadyEvent);
          }
        });
      }
    });
    InitVotes.voteFor(CDIClientBootstrap.class);
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.framework.ClientMessageBusImpl$LongPollRequestCallback

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.