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"?
wesley.hall@gmail.com - 21 Dec 2006 15:57 GMT
> 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.
sk - 21 Dec 2006 18:43 GMT
>> I have one ejb with the function sayhello. This functions print out
>> "hello
[quoted text clipped - 13 lines]
> 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.
bjeremy - 22 Dec 2006 01:28 GMT
> 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?
Alfred - 22 Dec 2006 16:27 GMT
> 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
wesley.hall@gmail.com - 22 Dec 2006 16:33 GMT
> > 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
[quoted text clipped - 5 lines]
> 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)