Skip to content

Commit 554ac80

Browse files
committed
+ housekeeping
1 parent 4e592ea commit 554ac80

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/java/conseq4j/summon/ExecutorServiceFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public interface ExecutorServiceFactory {
4545
* @param sequenceKey an {@link Object} instance whose hash code is used to summon the
4646
* corresponding executor.
4747
* @return the sequential executor of type {@link java.util.concurrent.ExecutorService} that
48-
* executes all tasks of this sequence key in the same order as they are submitted.
48+
* executes all tasks the same order as they are submitted.
4949
*/
5050
ExecutorService getExecutorService(Object sequenceKey);
5151
}

src/test/java/conseq4j/SpyingTask.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,18 @@
3030
import java.util.concurrent.Executors;
3131
import lombok.Getter;
3232
import lombok.ToString;
33+
import org.awaitility.core.ConditionFactory;
3334

3435
/** @author Qingtian Wang */
3536
@ToString
3637
@Getter
3738
public class SpyingTask implements Runnable {
38-
private static final long RUN_DURATION_MILLIS = 100;
39+
private static final Duration RUN_DURATION = Duration.ofMillis(50);
40+
private static final long RUN_DURATION_NANOS = RUN_DURATION.toNanos();
3941
private static final long UNSET_TIME_STAMP = Long.MIN_VALUE;
4042
private static final long UNSET_THREAD_ID = Long.MIN_VALUE;
41-
private static final Duration POLL_INTERVAL = Duration.ofMillis(10);
43+
private static final Duration POLL_INTERVAL = Duration.ofMillis(5);
44+
private static final ConditionFactory AWAIT = await().with().pollInterval(POLL_INTERVAL);
4245
private final Integer scheduledSequenceIndex;
4346
private String runThreadName;
4447
private long runThreadId;
@@ -67,10 +70,7 @@ public void run() {
6770
this.runTimeStartNanos = System.nanoTime();
6871
this.runThreadName = Thread.currentThread().getName();
6972
this.runThreadId = Thread.currentThread().threadId();
70-
await()
71-
.with()
72-
.pollInterval(POLL_INTERVAL)
73-
.until(() -> (System.nanoTime() - this.runTimeStartNanos) >= RUN_DURATION_MILLIS);
73+
AWAIT.until(() -> (System.nanoTime() - this.runTimeStartNanos) >= RUN_DURATION_NANOS);
7474
this.runTimeEndNanos = System.nanoTime();
7575
System.out.printf(
7676
"Task %s run by %s:%s completed in %s%n",

0 commit comments

Comments
 (0)