简体   繁体   中英

Java implemented algorithm for scheduling

我想使用java中实现的算法(如果存在),这允许我在公司中安排工作,员工可以离开公司为客户服务,客户请求每天都来公司,算法也可以接受旧的客户请求。

Quartz Job Scheduler should do you just fine. You can configure jobs using CRON expressions. This product is used by enterprises everywhere.

Quartz Scheduler Home Page

Is this algorithm you need for a school project or for work? Why re-invent the wheel when you don't have to?

Drools Planner is a tool for optimized automated planning. Is this what you're after?

If you really wanted algorithm, try JGap or Jaga

Solver ofers some shedule apps.

You tagged your question with java-ee, so here's an answer that leverages the technologies and APIs available in the Java Enterprise Edition platform:

  1. Configure queue in an JMS server. Depending on your setup, you can either use the JMS server provided with the application server, or use an external message server.
  2. Implement an enterprise application with a Timer bean and a stateless Session bean.
    • The Timer bean will be set to fire every day/hour/other appropriate interval. When it wakes up, it calls the stateless Session bean.
    • The stateless Session bean has a single business method which reads all messages off the JMS queue and performs actions according to each message.
  3. Deploy the two beans in an enterprise application on the application server.
  4. Provide information to customers about how to connect to the queue and the message format, or implement client applications that submit messages to the queue on behalf of customers.

If you connect to a JMS queue that supports transactions , then any failure while handling a message in the stateless Session bean will cause the message to be put back into the queue and re-send.

This design does not use an Message-Driven Bean to consume the messages from the queue because then you would have to worry about persisting the messages through other means until the timer service fires.

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