Here is what I do:

1. Write a simple service that just performs the action you want
2. If you need real time processing just call it.
3. Create a page that just calls the service and schedule accessing that
page with Hudson/curl


On Sat, Sep 21, 2013 at 2:41 PM, Martin Kersten <martin.kersten...@gmail.com
> wrote:

> Hi there,
>
>
>    I need to implement a service that reads tasks (descriptions) from the
> database, does some tasks and sleeps again. The thread must be able to woke
> up if an other service demands just in time processing.
>
> Requirements:
> 1. Need a Hibernate Session inside the main loop.
> 2. Needs to be able to woke up (just use Object.notify and Object.wait).
> 3. Needs to sleep for a couple of minutes, check db for work and sleep
> again.
> 4. On shut down it needs to suspend and decompose gracefully.
>     What is the best way to do so?
>
> So first I looked at periodic job etc. Nothing to use. So it ends up doing
> some kind of a
> service that spawns a thread and the thread does all the progressing.
>
> The thread itself uses a runnable to guard against failures and those
> failures are logged
> within each task during which the failure occures.
>
> So here comes the big question:
>
> What should I do.
>
> The naive answer is using a SessionSource and create a session each time
> the thread's
> runnable starts the processing.
>
> Another idea would be set up the worker part as a service that is created
> every time and
> let the IOC do all the session creation and handling. But I fear that this
> is way more
> complicated then the SessionSource idea.
>
> The decomposition on the teardown of the tapestry application requires to
> deal with
> certain kind of listeners. What is the best service to add the listener
> too?
>
>
> Thanks in advance,
>
> Martin (Kersten)
>

Reply via email to