Forums Register Login

server polling to know when a huge file is ready

+Pie Number of slices to send: Send
Ciao all,

i'm new in this forum. I've some years of experience in java but i'm not expert in j2ee.

I developed a @Stateless EJB that creates a huge file in file system. After that, when the file is ready, i have to send it via mail.
The EJB has transaction management as BEAN, with explicit begin/commit transaction to avoid server timeout.

But if i call this EJB from the client, the client remains freezed until the file is complete

I would like to start file generation and make the client free immediately. Then, i would like to ask server (polling) to know when the file is ready, then send it via mail.

Could you tell me the best way to resolve this problem?

Thanks a lot.
+Pie Number of slices to send: Send
Welcome to the Ranch

The client waits until the method it calls is ready, so you have to make sure that method finishes early. One easy way to do this is by calling an @Asynchronous method and let that method do the hard work in some other thread.

Note that if you call a method of the same class, that will ignore any annotations. You'd either have to use another helper bean, or use SessionContext and its getBusinessObject method to get a reference to the same object but with all the JEE annotation-based additions enabled.
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 528 times.
Similar Threads
My SCEA Part 1Study Notes
Transaction Timeout Issue - Weblogic
please answer this 128 questions for WLS. Urgently!
Cannot loop without freeze on socket networking
Is the CMT of a SS EJB passed on to the DAO?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:15:30.