users@glassfish.java.net

Concurrent acess to stateful sb from rich client/design question

From: <glassfish_at_javadesktop.org>
Date: Fri, 12 Oct 2007 12:22:44 PDT

Hi,

this is more generic JEE (portable) question however Glassfish is my server and the community always seemed friendly and responsive, so here I go with very stupid question.

I am working on an app that has rich (Swing) client, therefore unlike in web app there are quite a few threads running simultaneously.

We are using one stateful session bean as facade for a client to do anything on server. The client uses singleton that holds ref to remote interface.

The reasons for that are just one JNDI lookup at app start (client runs as stand alone client, not in client app container) and more importantly storing session values on the server, mostly user id and rights, allowing to filter queries on server side only, without transferring the same (current user related) data back and forth every time

Naturally we are now facing ConcurrentAccessException :(

My questions are:
a) is that bad design from the very beginning?
b) how do you get around this situation?
c) one solution would be to avoid session bean and transfer user id with every call to (stateless) session bean, however this has disadvantage that app proprietary user rights and filters would need to be reconstructed with every call and that would certainly result in performance
d) other solution is to check for concurrent exception and possibly wait and try again. is that the way to go?


Thanks in advance for any comments,
Dale

P.S. And congrats to glassfish team for v2 FCS, well done!
[Message sent by forum member 'dalecooper82' (dalecooper82)]

http://forums.java.net/jive/thread.jspa?messageID=239891