default-scheduler-1 threads not getting closed
saint7007 opened this issue · 1 comments
Hi,
`object Main extends App{
val _system: ActorSystem = ActorSystem.create("SchedulerSystem")
implicit val executionContext: ExecutionContextExecutor = _system.dispatcher
val scheduler = QuartzSchedulerExtension
val schedulerActor = _system.actorOf(Props(classOf[ScheduleJobActor]),
"Schedule")
QuartzSchedulerExtension.get(_system).createSchedule("oneMinuteScheduler", None,
"0 0/1 * * * ?", None, TimeZone.getTimeZone("UTC"))
QuartzSchedulerExtension.get(_system).schedule("oneMinuteScheduler", schedulerActor,
MessageRequireFireTime(ExecuteTask))
}`
`class ScheduleJobActor extends Actor with ActorLogging {
val dbActor: ActorRef = context.actorOf(DBActor.props)
def receive: PartialFunction[Any, Unit] = {
case ExecuteTask => println("i am going to execute every one minute")
case MessageWithFireTime(msg: AnyRef, scheduledFireTime:Date)=>
log.info("i am going to execute every one minute = "+ scheduledFireTime.toInstant().toString().substring(0, scheduledFireTime.toInstant().toString().length - 4).replace("T"," "))
dbActor ! GetMobileId
case _ => log.info("invalid message")
}
}
object ScheduleJobActor {
case class ExecuteTask()
}`
here is JVM profiler, after 9 hours of every minute tick, there are 1000 threads in live but in sleeping state.
Also the thread started from first tick is still running.
If you see this Thread profiling
https://github.com/saint7007/jvm-profiler/blob/saint7007-patch-1/Screenshot%202020-08-28%20at%207.20.32%20AM.png
there are nearly 1000 threads with name default-scheduler-1 and those are alive forever it seems.
Need help, m I missing something?
sorry nothing related to quartz. Something to do with my code itself.