Package org.jboss.errai.demo.busstress.client.shared

Examples of org.jboss.errai.demo.busstress.client.shared.Stats


    if (!validateSettings()) {
      return;
    }
    stopIfRunning();

    final Stats stats = new Stats();
    final StatsPanel statsPanel = new StatsPanel();
    resultsPanel.insert(statsPanel, 0);

    // create the message payload
    Integer messageSizeInt = messageSize.getValue();
    StringBuilder sb = new StringBuilder(messageSizeInt);
    for (int i = 0; i < messageSizeInt; i++) {
      sb.append("!");
    }
    messageValue = sb.toString();

    if (messageMultiplier.getValue() == null || messageMultiplier.getValue() < 1) {
      messageMultiplier.setValue(1);
    }

    final int multipler = messageMultiplier.getValue();

    sendTimer = new Timer() {
      private boolean hasStarted;

      @Override
      public void run() {
        hasStarted = true;

        for (int i = 0; i < multipler; i++) {
          MessageBuildSendable sendable = MessageBuilder.createMessage()
                  .toSubject("StressTestService")
                  .withValue(messageValue)
                  .done()
                  .repliesTo(new MessageCallback() {
                    @Override
                    public void callback(Message message) {
                      stats.registerReceivedMessage(message);
                      statsPanel.updateStatsLabels(stats);
                    }
                  });
          sendable.sendNowWith(bus);

          stats.registerSentMessage(sendable.getMessage());
        }

        statsPanel.updateStatsLabels(stats);
      }

      @Override
      public void cancel() {
        super.cancel();
        if (hasStarted) {
          stats.registerTestFinishing();
          statsPanel.onRunFinished(stats);
        }
      }
    };
    sendTimer.scheduleRepeating(messageInterval.getValue());

    stats.registerTestStarting();
    statsPanel.onRunStarted(stats);
  }
View Full Code Here


    if (!validateSettings()) {
      return;
    }
    stopIfRunning();

    final Stats stats = new Stats();
    final StatsPanel statsPanel = new StatsPanel();
    resultsPanel.insert(statsPanel, 0);

    // create the message payload
    Integer messageSizeInt = messageSize.getValue();
    StringBuilder sb = new StringBuilder(messageSizeInt);
    for (int i = 0; i < messageSizeInt; i++) {
      sb.append("!");
    }
    messageValue = sb.toString();

    if (messageMultiplier.getValue() == null || messageMultiplier.getValue() < 1) {
      messageMultiplier.setValue(1);
    }

    final int multipler = messageMultiplier.getValue();

    sendTimer = new Timer() {
      private boolean hasStarted;

      @Override
      public void run() {
        hasStarted = true;

        for (int i = 0; i < multipler; i++) {
          MessageBuildSendable sendable = MessageBuilder.createMessage()
                  .toSubject("StressTestService")
                  .withValue(messageValue)
                  .done()
                  .repliesTo(new MessageCallback() {
                    @Override
                    public void callback(Message message) {
                      stats.registerReceivedMessage(message);
                      statsPanel.updateStatsLabels(stats);
                    }
                  });
          sendable.sendNowWith(bus);

          stats.registerSentMessage(sendable.getMessage());
        }

        statsPanel.updateStatsLabels(stats);
      }

      @Override
      public void cancel() {
        super.cancel();
        if (hasStarted) {
          stats.registerTestFinishing();
          statsPanel.onRunFinished(stats);
        }
      }
    };
    sendTimer.scheduleRepeating(messageInterval.getValue());

    stats.registerTestStarting();
    statsPanel.onRunStarted(stats);
  }
View Full Code Here

        if (!validateSettings()) {
            return;
        }
        stopIfRunning();

        final Stats stats = new Stats();
        final StatsPanel statsPanel = new StatsPanel();
        resultsPanel.insert(statsPanel, 0);

        // create the message payload
        Integer messageSizeInt = messageSize.getValue();
        StringBuilder sb = new StringBuilder(messageSizeInt);
        for (int i = 0; i < messageSizeInt; i++) {
            sb.append("!");
        }
        messageValue = sb.toString();

        if (messageMultiplier.getValue() == null || messageMultiplier.getValue() < 1) {
            messageMultiplier.setValue(1);
        }

        final int multipler = messageMultiplier.getValue();

        sendTimer = new Timer() {
            private boolean hasStarted;

            @Override
            public void run() {
                hasStarted = true;

                for (int i = 0; i < multipler; i++) {
                    MessageBuildSendable sendable = MessageBuilder.createMessage()
                        .toSubject("StressTestService")
                        .withValue(messageValue)
                        .done()
                        .repliesTo(new MessageCallback() {
                            @Override
                            public void callback(Message message) {
                                stats.registerReceivedMessage(message);
                                statsPanel.updateStatsLabels(stats);
                            }
                        });
                    sendable.sendNowWith(bus);

                    stats.registerSentMessage(sendable.getMessage());
                }

                statsPanel.updateStatsLabels(stats);
            }

            @Override
            public void cancel() {
                super.cancel();
                if (hasStarted) {
                    stats.registerTestFinishing();
                    statsPanel.onRunFinished(stats);
                }
            }
        };
        sendTimer.scheduleRepeating(messageInterval.getValue());

        stats.registerTestStarting();
        statsPanel.onRunStarted(stats);
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.demo.busstress.client.shared.Stats

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.