diff --git a/memberships/src/main/java/com/salesforce/apollo/ring/SliceIterator.java b/memberships/src/main/java/com/salesforce/apollo/ring/SliceIterator.java index f4ebf020b..fce9086a6 100644 --- a/memberships/src/main/java/com/salesforce/apollo/ring/SliceIterator.java +++ b/memberships/src/main/java/com/salesforce/apollo/ring/SliceIterator.java @@ -31,24 +31,29 @@ * @author hal.hildebrand */ public class SliceIterator { - private static final Logger log = LoggerFactory.getLogger(SliceIterator.class); - private final CommonCommunications comm; - private final String label; - private final SigningMember member; - private final List slice; - private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, - Thread.ofVirtual() - .factory()); - private Member current; - private Iterator currentIteration; + private static final Logger log = LoggerFactory.getLogger(SliceIterator.class); + + private final CommonCommunications comm; + private final String label; + private final SigningMember member; + private final List slice; + private final ScheduledExecutorService scheduler; + private Member current; + private Iterator currentIteration; public SliceIterator(String label, SigningMember member, List slice, CommonCommunications comm) { + this(label, member, slice, comm, Executors.newScheduledThreadPool(1, Thread.ofVirtual().factory())); + } + + public SliceIterator(String label, SigningMember member, List slice, + CommonCommunications comm, ScheduledExecutorService scheduler) { assert member != null && slice != null && comm != null; this.label = label; this.member = member; this.slice = slice; this.comm = comm; + this.scheduler = scheduler; Entropy.secureShuffle(slice); this.currentIteration = slice.iterator(); log.debug("Slice for: <{}> is: {} on: {}", label, slice.stream().map(m -> m.getId()).toList(), member.getId());