@@ -24,7 +24,7 @@ import scala.concurrent.duration._
2424import scala .util .{Random , Try }
2525import scala .util .control .NonFatal
2626
27- import java .util .{Base64 , Comparator }
27+ import java .util .{Base64 , Comparator , Collections }
2828import java .util .concurrent .ConcurrentSkipListSet
2929import java .util .concurrent .atomic .{AtomicLong , AtomicReference }
3030
@@ -60,11 +60,11 @@ import java.util.concurrent.atomic.{AtomicLong, AtomicReference}
6060 * }}}
6161 */
6262final class TestContext private (_seed : Long ) extends ExecutionContext { self =>
63- import TestContext .{ConcurrentState , Encoder , State , Task }
63+ import TestContext .{InternalState , Encoder , State , Task }
6464
6565 private [this ] val random = new Random (_seed)
6666
67- private [this ] val stateRef = new ConcurrentState ()
67+ private [this ] val stateRef = new InternalState ()
6868
6969 def execute (runnable : Runnable ): Unit = {
7070 val current = stateRef
@@ -280,13 +280,21 @@ object TestContext {
280280 def apply (seed : String ): TestContext =
281281 new TestContext (new String (Decoder .decode(seed)).toLong)
282282
283+ @ deprecated(" Not intended to be public" , " 3.7.1" )
283284 final class ConcurrentState (
284285 val currentID : AtomicLong = new AtomicLong (),
285286 val currentNanos : AtomicLong = new AtomicLong (),
286287 val tasks : ConcurrentSkipListSet [Task ] = new ConcurrentSkipListSet (Task .comparator),
287288 val lastReportedFailure : AtomicReference [Throwable ] = new AtomicReference ()
288289 )
289290
291+ private final class InternalState (
292+ val currentID : AtomicLong = new AtomicLong (),
293+ val currentNanos : AtomicLong = new AtomicLong (),
294+ val tasks : java.util.SortedSet [Task ] = Collections .synchronizedSortedSet(new ConcurrentSkipListSet (Task .comparator)),
295+ val lastReportedFailure : AtomicReference [Throwable ] = new AtomicReference ()
296+ )
297+
290298 /**
291299 * Used internally by [[TestContext ]], represents the internal state used for task scheduling
292300 * and execution.
0 commit comments