I think you cannot use thread management like wait()within an EJB.
wait(long timeout, int nanos)
Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
Perhaps, if your EJBs involved in your process are in the same JVM, the process writing the file could notify the MDB through a listener after completion (Observable Pattern is a good candidate for this).
It's just an idea.
Thanks Philippe for your reply ...
And sorry for the 2 posts (a mistake on Edit/Preview screens !)
I have finally succeed in making my MDB wait until the end of the other process. I've done this by making
current thread retrieving my MDB's monitor with synchronized call (on "this") before wait().
(The other process is not a Java process ...)
I have now some other problems : transaction timeout while MDB is waiting (and the trans-attribute
NotSupported doesn't seems to be effective), confusion between topics
(MDBs received messages from topic they aren't listening to ...).
I'm trying to make a SB on JBoss on a first machine, publishing messages on topics on a second machine (using
the JMS ressource adaptor).
Hum ... it's time to dive back into this problems !
This has been discusses (and solved before - Hiram do you remember this?). Search on the dev list.
Stupid question here... where is the "dev" list. Thanks.
The fix is use a CMT with NotSupported or use a BMT.
In either case the Transaction Manager is not used since a 2 phase commit will not be required.
I'm not sure if this has been back ported to 2.4.4, but I know it is in 3.0.