简体   繁体   中英

How to distribute Java long running process to remote servers

My php web server receive requests and needs to launch a java program that runs between 30 sec and 5 minutes or even more. That long process needs to be distributed on the available servers in my LAN.

What i need:

  • a job queue ( that's done in a db)

  • A DB watch. Get notified of new or completed job (to start another job in the queue)

  • Start a java process on a remote and available computer.

It seems that it needs to be a DB watch since I need to evaluate which remote computer is available and a DB stored procedure wouldn't accomplish that easily.

What is the best or at least a good way to achieve this in a OS independant way using JAVA.

I guess I could use a FileWatch and manage the queue in a folder but it seems prehistoric.

Thanks

I would use a JMS queue. You add tasks/messages to a queue and the next available process takes a task, performs it and sends back any result on another queue or topic. This supports transparent load balancing and you can restart tasks if a process fails. No polling is required.

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