@@ -282,18 +282,6 @@ import java.util.concurrent.{ Executors, TimeUnit, ThreadFactory }
282
282
trait Ultimately extends PatienceConfiguration {
283
283
284
284
285
- private [this ] lazy val scheduler = {
286
- val threadFactory = new ThreadFactory {
287
- val inner = Executors .defaultThreadFactory()
288
- def newThread (runnable : Runnable ) = {
289
- val thread = inner.newThread(runnable)
290
- thread.setDaemon(true )
291
- thread
292
- }
293
- }
294
-
295
- Executors .newSingleThreadScheduledExecutor(threadFactory)
296
- }
297
285
298
286
/**
299
287
* Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
@@ -452,7 +440,7 @@ trait Ultimately extends PatienceConfiguration {
452
440
}
453
441
}
454
442
455
- scheduler.schedule(task, chillTime, TimeUnit .MILLISECONDS )
443
+ Ultimately . scheduler.schedule(task, chillTime, TimeUnit .MILLISECONDS )
456
444
promise.future
457
445
}
458
446
else { // Timed out so return a failed Future
@@ -515,4 +503,17 @@ trait Ultimately extends PatienceConfiguration {
515
503
* ...
516
504
* </pre>
517
505
*/
518
- object Ultimately extends Ultimately
506
+ object Ultimately extends Ultimately {
507
+ private lazy val scheduler = {
508
+ val threadFactory = new ThreadFactory {
509
+ val inner = Executors .defaultThreadFactory()
510
+ def newThread (runnable : Runnable ) = {
511
+ val thread = inner.newThread(runnable)
512
+ thread.setDaemon(true )
513
+ thread
514
+ }
515
+ }
516
+
517
+ Executors .newSingleThreadScheduledExecutor(threadFactory)
518
+ }
519
+ }
0 commit comments