-
1. Re: Calling EJB Method Affects ServerSocket on Client
ipozeng Dec 17, 2001 7:46 PM (in response to dkmarley)I think you need to put ServerSocker accept on another thread.Because EJB call defaults to synchronous which means the call will not reture until EJB finish its running !
Best Regards! -
2. Re: Calling EJB Method Affects ServerSocket on Client
dkmarley Dec 18, 2001 7:28 AM (in response to dkmarley)JBoss 2.4.3 (WindowsNT & RedHat 6.2)
ServerSocket.accept() is running in a separate thread according to the usual implementation of multi-threaded server applications in Java.
A new thread is being created to process each socket returned from ServerSocket.accept(). The socket is then
read and closed before the call to the EJB method. -
3. Re: Calling EJB Method Affects ServerSocket on Client
adrian.brock Dec 18, 2001 9:23 AM (in response to dkmarley)Hi,
Have you tried replacing the EJB call with
Thread.currentThread().sleep(1000);
this should make sure it is not your code. :-)
Regards,
Adrian -
4. Re: Calling EJB Method Affects ServerSocket on Client
dkmarley Dec 18, 2001 10:27 AM (in response to dkmarley)Hi Adrian
Yes, I've done precisely that and various other tests. When testing, I can accept and process multiple concurrent connections without any problems.
As soon as I call any EJB method from one of the spawned threads, however, ServerSocket.accept() refuses to accept any further connections for the duration of the method call.
David Marley -
5. Re: Calling EJB Method Affects ServerSocket on Client
adrian.brock Dec 18, 2001 12:11 PM (in response to dkmarley)Hi,
I don't know what's wrong then.
Can you post your code? Or a small test program with
the same problem?
Alternatively, have a look at the Tomcat/Jetty contributions to JBoss. They are doing the same you
(except perhaps local EJB calls) without this problem.
Regards,
Adrian -
6. Re: Calling EJB Method Affects ServerSocket on Client
dkmarley Dec 27, 2001 2:55 PM (in response to dkmarley)Hi Adrian
Sorry I've taken so long to reply. I have discovered what the problem is and I have rectified it.
The problem was with my EJBs on the server. I have a session bean that generates unique IDs for entity beans and this was(every 200 invocations) obtaining a Connection from the pool and calling Connection.setTransaction(TRANSACTION_SERIALIZABLE). before obtaining a new starting ID. The failure to reset the transaction level before returning the Connection to the pool was resulting in a pool with, eventually, every Connection set to TRANSACTION_SERIALIZABLE.
My apparently limited knowledge of transations prevents me from understanding why this should affect code running in a different thread on the client.
Any ideas?
David