What is the best practice for implementing a pause in a business process
executed by an ejb? I know sleeping a thread violates the j2ee spec.
I'm not able to use a timerservice as can't use the current j2ee version
as deploying on weblogic 8.1. Any thoughts would be great.
Thanks in advance.
Tim
Andreas Wollschlaeger - 14 Feb 2006 21:29 GMT
> What is the best practice for implementing a pause in a business process
> executed by an ejb? I know sleeping a thread violates the j2ee spec.
[quoted text clipped - 4 lines]
>
> Tim
Possible answer: Not at all?
Why on earth would you want a EJB business method to wait for something?
Apart from the well known fact, that business methods always take too
long to execute, there is no sensible thing to wait for without
violating the EJB principles.
Maybe tell us *what* you plan to do....
Greetings
Andreas
John Maline - 14 Feb 2006 21:57 GMT
Try a google search on "j2ee scheduler". Many implementations appear at
the top. The J2EE 1.4 timer service is a standardized spec for this
concept that is built-in as of that version. But they exist as separate
products compatible with earlier versions.
John
> What is the best practice for implementing a pause in a business process
> executed by an ejb? I know sleeping a thread violates the j2ee spec.
[quoted text clipped - 4 lines]
>
> Tim
Dag Sunde - 15 Feb 2006 00:16 GMT
>> What is the best practice for implementing a pause in a business process
>> executed by an ejb? I know sleeping a thread violates the j2ee spec. I'm
[quoted text clipped - 5 lines]
> concept that is built-in as of that version. But they exist as separate
> products compatible with earlier versions.
<top_posting_fixed/>
Quartz is a good open source implementation.
http://www.opensymphony.com/quartz/

Signature
Dag.
James McGill - 15 Feb 2006 18:36 GMT
> What is the best practice for implementing a pause in a business process
> executed by an ejb? I know sleeping a thread violates the j2ee spec.
[quoted text clipped - 4 lines]
>
> Tim\
We've used Quartz with weblogic, with success.
But I'd be looking for a message driven approach, so that instead of the
business object doing the timing, have the timing be handled some way
other than just a delay in the EJB. JMS has possibilities for doing
synchronous messages.
That said, you can of course do it by brute force, spec or no spec.
Thread.sleep, or blocking IO, aren't *proper* in an EJB, but they do
actually *work* for the most part. But when you go down that road,
you're making assumptions about the object's lifecycle, doing things
that will be even more of a pain when your shop finally migrates to
JBoss, and who knows what will happen in production, or if you want to
introduce clustering, or if you end up looking for bugs that are related
to synchronous behavior?