Alessio Punturo Alessio Punturo - 1 year ago 91
Java Question

How to run an algorithm every x minutes on a Server?

I've created a clustering algorithm in Java that reads from a collection in a Mongo database, makes its computations and then writes to a new collection in the same database. Now, I need this algorithm to run every 30 minutes in the server. What could I use to do so?

Answer Source

If you're using JavaEE, you could use the @Schedule annotation.

Take a look at the API here. It saves you from using a dependency in your project.


If you're using JavaSE, maybe a Timer can help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download