enragedginger / akka-quartz-scheduler

Quartz Extension and utilities for cron-style scheduling in Akka
Other
559 stars 114 forks source link

default-scheduler-1 threads not getting closed #99

Closed saint7007 closed 4 years ago

saint7007 commented 4 years ago

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.

https://github.com/saint7007/jvm-profiler/blob/saint7007-patch-1/Screenshot%202020-08-28%20at%202.45.55%20PM.png

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?

saint7007 commented 4 years ago

sorry nothing related to quartz. Something to do with my code itself.