Package org.hornetq.utils

Examples of org.hornetq.utils.TokenBucketLimiter


         message.getBodyBuffer().writeBytes(payload);

         final int modulo = 2000;

         TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

         boolean committed = false;

         for (int i = 1; i <= numberOfMessages; i++)
         {
            producer.send(message);

            if (transacted)
            {
               if (i % txBatchSize == 0)
               {
                  session.commit();
                  committed = true;
               }
               else
               {
                  committed = false;
               }
            }
            if (display && i % modulo == 0)
            {
               double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
               PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
            }

            // log.info("sent message " + i);

            if (tbl != null)
            {
               tbl.limit();
            }
         }

         if (transacted && !committed)
         {
View Full Code Here


         message.getBodyBuffer().writeBytes(payload);

         final int modulo = 2000;

         TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

         boolean committed = false;

         for (int i = 1; i <= numberOfMessages; i++)
         {
            producer.send(message);

            if (transacted)
            {
               if (i % txBatchSize == 0)
               {
                  session.commit();
                  committed = true;
               }
               else
               {
                  committed = false;
               }
            }
            if (display && i % modulo == 0)
            {
               double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
               PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
            }

            // log.info("sent message " + i);

            if (tbl != null)
            {
               tbl.limit();
            }
         }

         if (transacted && !committed)
         {
View Full Code Here

      message.writeBytes(payload);

      final int modulo = 2000;

      TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

      boolean committed = false;
      for (int i = 1; i <= numberOfMessages; i++)
      {
         producer.send(message);

         if (transacted)
         {
            if (i % txBatchSize == 0)
            {
               session.commit();
               committed = true;
            }
            else
            {
               committed = false;
            }
         }

         if (display && i % modulo == 0)
         {
            double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
            PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
         }

         if (tbl != null)
         {
            tbl.limit();
         }
      }
      if (transacted && !committed)
      {
         session.commit();
View Full Code Here

      message.writeBytes(payload);

      final int modulo = 10000;

      TokenBucketLimiter tbl = perfParams.getThrottleRate() != -1 ? new TokenBucketLimiterImpl(perfParams.getThrottleRate(),
                                                                                               false)
                                                                 : null;

      boolean transacted = perfParams.isSessionTransacted();
      int txBatchSize = perfParams.getBatchSize();
      boolean display = true;

      long start = System.currentTimeMillis();
      long moduleStart = start;
      AtomicLong count = new AtomicLong(0);
      while (true)
      {
         try
         {
            producer.send(message);
            count.incrementAndGet();

            if (transacted)
            {
               if (count.longValue() % txBatchSize == 0)
               {
                  session.commit();
               }
            }

            long totalDuration = System.currentTimeMillis() - start;

            if (display && count.longValue() % modulo == 0)
            {
               double duration = (1.0 * System.currentTimeMillis() - moduleStart) / 1000;
               moduleStart = System.currentTimeMillis();
               SoakSender.log.info(String.format("sent %s messages in %2.2fs (time: %.0fs)",
                                                 modulo,
                                                 duration,
                                                 totalDuration / 1000.0));
            }

            if (tbl != null)
            {
               tbl.limit();
            }

            if (!runInfinitely && totalDuration > perfParams.getDurationInMinutes() * SoakBase.TO_MILLIS)
            {
               break;
View Full Code Here

         message.getBodyBuffer().writeBytes(payload);

         final int modulo = 2000;

         TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

         boolean committed = false;

         for (int i = 1; i <= numberOfMessages; i++)
         {
            producer.send(message);

            if (transacted)
            {
               if (i % txBatchSize == 0)
               {
                  session.commit();
                  committed = true;
               }
               else
               {
                  committed = false;
               }
            }
            if (display && i % modulo == 0)
            {
               double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
               PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
            }

            // log.info("sent message " + i);

            if (tbl != null)
            {
               tbl.limit();
            }
         }

         if (transacted && !committed)
         {
View Full Code Here

      message.writeBytes(payload);

      final int modulo = 2000;

      TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

      boolean committed = false;
      for (int i = 1; i <= numberOfMessages; i++)
      {
         producer.send(message);

         if (transacted)
         {
            if (i % txBatchSize == 0)
            {
               session.commit();
               committed = true;
            }
            else
            {
               committed = false;
            }
         }

         if (display && i % modulo == 0)
         {
            double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
            PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
         }

         if (tbl != null)
         {
            tbl.limit();
         }
      }
      if (transacted && !committed)
      {
         session.commit();
View Full Code Here

         message.getBodyBuffer().writeBytes(payload);

         final int modulo = 2000;

         TokenBucketLimiter tbl = throttleRate != -1 ? new TokenBucketLimiterImpl(throttleRate, false) : null;

         boolean committed = false;

         for (int i = 1; i <= numberOfMessages; i++)
         {
            producer.send(message);

            if (transacted)
            {
               if (i % txBatchSize == 0)
               {
                  session.commit();
                  committed = true;
               }
               else
               {
                  committed = false;
               }
            }
            if (display && i % modulo == 0)
            {
               double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
               PerfBase.log.info(String.format("sent %6d messages in %2.2fs", i, duration));
            }

            // log.info("sent message " + i);

            if (tbl != null)
            {
               tbl.limit();
            }
         }

         if (transacted && !committed)
         {
View Full Code Here

TOP

Related Classes of org.hornetq.utils.TokenBucketLimiter

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.