Pavan Kumar
Pavan Kumar

Reputation: 463

Scheduler in Java

I need some assistance in implementing a scheduler which runs parallel with the other processing. I found quartz scheduler for many of my searches on the web. But, I need something which is inbuilt and can run concurrently with other processes and not any external libraries

I checked with scheduleAtFixedRate. But, this has not option for parallel execution.

Can anyone please suggest in this regard?? My requirement is that, a java function has to run at every fixed intervals soon after the server starts. This will be known by the servlet start and I will have to initiate the scheduler in the init().

Upvotes: 1

Views: 583

Answers (2)

Ankur Shanbhag
Ankur Shanbhag

Reputation: 7804

My requirement is that, a java function has to run at every fixed intervals soon after the server starts

Upvotes: 4

ssssteffff
ssssteffff

Reputation: 974

I suggest you to define a ServletContextListener, and to start a Quartz scheduler from its contextInitialized method.

contextInitialized is called on application deployment/reload on your application server, thus your scheduler can be initialized soon after the server starts.

Upvotes: 0

Related Questions