简体   繁体   中英

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?

你可以使用石英调度程序每30分钟安排一次算法,你可以在这里找到一个很好的石英调度程序教程。

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.


Update:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM