Skip to content

Commit 8e74e41

Browse files
authored
Make service pluggable so developers can plug-in custom executor-service (#1993)
1 parent bb8fb65 commit 8e74e41

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/util/src/main/scala/net/liftweb/util/Schedule.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ sealed trait Schedule extends Loggable {
7272

7373

7474
/** The underlying <code>java.util.concurrent.ScheduledExecutor</code> */
75-
private var service: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor(TF)
75+
@volatile var buildService: () => ScheduledExecutorService = () => Executors.newSingleThreadScheduledExecutor(TF)
7676

77+
private var service: ScheduledExecutorService = buildService()
7778
private var pool = buildExecutor()
7879

7980
/**
8081
* Re-create the underlying <code>SingleThreadScheduledExecutor</code>
8182
*/
8283
def restart: Unit = synchronized
8384
{ if ((service eq null) || service.isShutdown)
84-
service = Executors.newSingleThreadScheduledExecutor(TF)
85+
service = buildService()
8586
if ((pool eq null) || pool.isShutdown)
8687
pool = buildExecutor()
8788
}

0 commit comments

Comments
 (0)