Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1596#discussion_r145411963
--- Diff:
artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java
---
@@ -251,6 +251,9 @@ public synchronized boolean isStarted() {
// this will restart the scheduled component upon changes
private void restartIfNeeded() {
if (isStarted()) {
+ // it has already been through an initial delay,
+ // now we just use the next interval
+ this.initialDelay = period;
--- End diff --
I've built up this test:
```
@Test
public void testVerifyInitialDelayChanged() {
final long initialDelay = 10;
final long period = 100;
final ActiveMQScheduledComponent local = new
ActiveMQScheduledComponent(scheduledExecutorService, executorService,
initialDelay, period, TimeUnit.MILLISECONDS, false) {
@Override
public void run() {
}
};
local.start();
final long newInitialDelay = 1000;
//the parameters are valid?
assert initialDelay != newInitialDelay && newInitialDelay != period;
local.setInitialDelay(newInitialDelay);
local.stop();
Assert.assertEquals("the initial dalay can't change",
newInitialDelay, local.getInitialDelay());
}
```
And it fail: maybe is better to create a `start(long forceInitialDelay)`
method and call it into the restart, wdyt?
---