avoid deadlock for EJB

M

M D

I have one ejb with the function sayhello. This functions print out "hello
world" in while( 1 == 1 ) loop. When the clients exits from the server by
plugging out the nextwork from the PC, this ejb still prints out "hello
world". Is there any event to catch when server exists by accidents so that
I can stop printing out "hello world"?
 
W

wesley.hall

M said:
I have one ejb with the function sayhello. This functions print out "hello
world" in while( 1 == 1 ) loop. When the clients exits from the server by
plugging out the nextwork from the PC, this ejb still prints out "hello
world". Is there any event to catch when server exists by accidents so that
I can stop printing out "hello world"?

Firstly, please don't multipost. You could have made the intentional
infinate loop clear in your original post without creating a new
thread.

Secondly, no. If you have passed flow control from your client to your
server, the server thread will continue to run within the EJB without
terminating when the client disconnects. This is not unreasonable as
EJB's are not designed to be long running in this fashion. You would
need to solve this problem another way.
 
S

sk

Firstly, please don't multipost. You could have made the intentional
infinate loop clear in your original post without creating a new
thread.

Secondly, no. If you have passed flow control from your client to your
server, the server thread will continue to run within the EJB without
terminating when the client disconnects. This is not unreasonable as
EJB's are not designed to be long running in this fashion. You would
need to solve this problem another way.
Sorry and thank you for your replay.
 
B

bjeremy

M said:
I have one ejb with the function sayhello. This functions print out "hello
world" in while( 1 == 1 ) loop. When the clients exits from the server by
plugging out the nextwork from the PC, this ejb still prints out "hello
world". Is there any event to catch when server exists by accidents so that
I can stop printing out "hello world"?

If the client terminates the connection ,you should get an execption
that you can catch i.e. IOException... this is a checked Exception
(extends Exception), so are you catching and ignoring exceptions? Or
are you not getting any exceptions from this scenario?
 
A

Alfred

M said:
I have one ejb with the function sayhello. This functions print out "hello
world" in while( 1 == 1 ) loop. When the clients exits from the server by
plugging out the nextwork from the PC, this ejb still prints out "hello
world". Is there any event to catch when server exists by accidents so that
I can stop printing out "hello world"?

Are you shure to know something about Enterprise Java Beans?
It seems that you are the first who implement a SessionBean
to print "hello world" to System.out.

Alfred
 
W

wesley.hall

Alfred said:
Are you shure to know something about Enterprise Java Beans?
It seems that you are the first who implement a SessionBean
to print "hello world" to System.out.

Sadder still.... 8 years ago he would have gotten $100mil in venture
capital to develop the idea! ;o)
 

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

Forum statistics

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

Latest Threads

Top