PR: Enable configuring custom executor-service backing LAPinger

20 views
Skip to first unread message

Andreas Joseph Krogh

unread,
Jun 14, 2022, 12:49:34 PM6/14/22
to lif...@googlegroups.com

https://github.com/lift/framework/pull/2002

 

This takes care of the last executor-service used in Lift.

 

This way all executor-services used by Lift are configurable in Boot, we use it like this (relevant code only):

 

   Schedule.buildService = () => {
Executors.unconfigurableScheduledExecutorService(
new DataSourceContextAwareScheduledExecutor(1, scheduleServiceThreadFactory)
)
}

Schedule.buildExecutor = () => new DataSourceContextAwareScheduledExecutor(Schedule.threadPoolSize, scheduleExecutorThreadFactory)
Schedule.shutdown()

LAPinger.shutdown
LAPinger.buildService = () => {
Executors.unconfigurableScheduledExecutorService(new DataSourceContextAwareScheduledExecutor(1, actorPingerThreadFactory))
}
LAPinger.restart

LAScheduler.createExecutor = () => {
new ILAExecute with VisenaLoggable {
def execute(f: () => Unit): Unit = {
liftSchedulerExecutor.execute(() => {
try {
f()
} catch {
case t: Throwable => try {
OrigoExceptionHandlerDelegate.handleException(myLogger, t, logApplicationException = true)
} catch {
case t: Throwable =>
myLogger.error(s"liftSchedulerExecutor: Failed handling the Exception in run(): $t", t)
}
}
})
}

def shutdown(): Unit = {}
}
}
LAScheduler.shutdown()
}

liftSchedulerExecutor is wired up using Spring and injected into Boot.scala, but one can use any executor-service.

 

--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
Reply all
Reply to author
Forward
0 new messages