[EJB] Long lasting session bean - how to implement progress indicator?

P

pljosh.mail

Hello there,
I am beginning with EJB and I have question about implementing simple
progress indicator in client that is calling time consuming session
bean.

I have one stateful session bean that imports data from one database
into another. It takes very long time to copy everything and that is
happening in one transaction.

My client is a Swing application launched inside Application Client
Container (ACC).
When I press a button, it calls session bean's method and starts
importing data. The problem is that it can take long time and I would
like to show some progress, like number of imported entities or
something like this.

I tried implementing it in such a (wrong as I know now) way:
I added a field in that session bean called rowNo and getRowNo() method
and I was trying to call that method during importing data in another
thread to read progress. As you know, it is not working, because when I
call migrate() method and then getRowNo() from another thread - I get
javax.ejb.ConcurrentAccessException - one cannot execute multiple
methods of the same session bean (stateful in my case).

My question is how this can be done?

Thanks,
Witek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top