[ 
https://issues.apache.org/jira/browse/ARTEMIS-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16203733#comment-16203733
 ] 

ASF GitHub Bot commented on ARTEMIS-1462:
-----------------------------------------

Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1586#discussion_r144591374
  
    --- Diff: 
artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ActiveMQScheduledComponentTest.java
 ---
    @@ -165,4 +165,37 @@ public void run() {
           }
        }
     
    +   @Test
    +   public void testUsingCustomInitialDelay() throws InterruptedException {
    +      final CountDownLatch latch = new CountDownLatch(1);
    +      final long initialDelayMillis = 100;
    +      final long checkPeriodMillis = 100 * initialDelayMillis;
    +      final ActiveMQScheduledComponent local = new 
ActiveMQScheduledComponent(scheduledExecutorService, executorService, 
initialDelayMillis, checkPeriodMillis, TimeUnit.MILLISECONDS, false) {
    +         @Override
    +         public void run() {
    +            latch.countDown();
    +         }
    +      };
    +      final long start = System.nanoTime();
    +      local.start();
    +      try {
    +         final boolean triggeredBeforePeriod = 
latch.await(local.getPeriod(), local.getTimeUnit());
    +         final long timeToFirstTrigger = 
TimeUnit.NANOSECONDS.convert(System.nanoTime() - start, local.getTimeUnit());
    --- End diff --
    
    Depends on the case but there are parts where I've used it: It is immune to 
ntpd/clock changes...


> Allow ActiveMQScheduledComponent initial delay configuration
> ------------------------------------------------------------
>
>                 Key: ARTEMIS-1462
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1462
>             Project: ActiveMQ Artemis
>          Issue Type: Task
>          Components: Broker
>    Affects Versions: 2.3.0
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>             Fix For: 2.4.0
>
>
> ActiveMQScheduledComponent currently support scheduling with a fixed period 
> using the period as the initial delay too: using different values could be 
> helpful to support different scenarios. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to