repetative tasks


EJB programming & troubleshooting: repetative tasks

  1. repetative tasks (2 messages)

    I was looking for an effecient way to process a repetative task with different parameters, My task is time consuming and i want each of then to run in seperate thread i am planning to use JMX Mbean, can you suggest a pattern for implementing this sceniaro.

    Threaded Messages (2)

  2. repetative tasks[ Go to top ]

    I do not know of any pattern to do that. I also do not understand why u need to use MBean.
    One of the options is to create a message for each task (I mean to say a message each for what u described as different parameters). This way u do not have to do threaded programming as MDBs can consume the message and do the appropriate processing.
    JMS has its own implication and is not useful in all circumstances especially batch processes (adds the overhead of messages, queue, XA etc). Might involve use of XA which has its own performance implications. So you might have to evaluate the alternative based on ur project requirements and architecture.
  3. repetative tasks[ Go to top ]

    If you can afford a J2EE App Server, use JMS Queue and Message-Driven Bean. You need to create a class that store your parameters. For each task, create an instance of this class and enqueue it into your JMS Queue. Build a Message-Driven bean and configured it to be a consummer of this queue. The App Server will take care of threading naturally when operated under asynchronous mode

    If you don't use an App Server, you'd need to write your own threading framework. It's a little more work but still do-able