geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Łukasz Budnik" <lukasz.bud...@gmail.com>
Subject transactions within MDB
Date Tue, 25 Mar 2008 12:11:01 GMT
Hi All!

I have a problem with transactions within MDB.

The thing is my MDB executes quite large, time-consuming tasks which
can take up to few minutes.

My onMessage looks something like this:

// object message has a task (task has unique ID - known to the end-user)
onMessage(ObjectMessage message) {

// 1. update task status to 'running', set start time and some other
things (logs)
merge(task);

// 2. now time-consuming tasks, up to few minutes...
doIt();

// 3. finalize, change task status to finished/failed, set end time
//     and once again some more logs
merge(task);

}

The problem is that the merge operation from 1st step waits till merge
in 3rd step (to be precise - the return from the onMessage method).

This is a huge problem since my tasks take even up to few minutes.

The end-user knows the ID of the task and can check task status from
the web app.

When task takes 4-5 minutes to complete, user sees the task in 'new'
state for the whole time, and then out of the sudden task becomes
'finished' without entering the 'running' state.

Besides, if something goes wrong, application enters fatal error
during execution of the task there won't be any traces left (only
logs, but end-users don't read them ;) ).

The question is: how can I enforce DB update after each merge.

Note that em.flush() does not force updates in this case and causes
viewTaskState.jsp (select) to hang and wait for the completion of the
onMessage().

Anybody encountered such a problem?

thanks in advance for any hints

best regards
Łukasz
Mime
View raw message