The class that is being used is java.io.ObjectInputStream.  You can look it
up in the jdk javadoc, but I don't see any kind of timeout.  But the
ObjectInputStream is wrapping the InputStream from the Socket.  You can set
a timeout on the socket (setSoTimeout()), and that is probably what you are
looking for.  If you have access to the socket before calling the SocketNode
constructor, just set the timeout on the socket and then call the SocketNode
constructor.  Then, no code modification is required for SocketNode.
However, SocketNode could be modifed to catch a
java.io.InterruptedIOException (the exception thrown when the timeout
expires) and do something with it (like check a boolean that indicates it
should exit or reenter the read).

Try it out, and if you come up with some useful modification, submit the
changes back.

-mark

-----Original Message-----
From: peter riegersperger [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 11:45 AM
To: Log4J Users List
Subject: RE: stopping a socketnode-thread?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

thanks mark!

hmm. how do i send an EOF over the network ???
i found that SocketAppender.close() closes the ObjectOutputStream,
which in turn probably closes the connection (which would probably
lead to a java.net.SocketException on the server side).
can't try this at home (far to dangerous [you should never try
anything you see at tv at home]  ;), i'll try this tomorrow.

one other thing, though: if closing the appender on the remote end
ends the thread on the server, this is fine. but what if the remote
process dies? does the connection time out? (and if so, any way to
specify the time-out?)
and apart from clients being nice and closing their connections, it
would be very nice to be able to do a forced shutdown of my server
tool that severs the connections and closes all SocketNode-threads
without terminating the process.

greetings,

rick


|-
| peter riegersperger  <[EMAIL PROTECTED]>
|-
| subnet
| platform for media art and experimental technologies
|-
| http://www.subnet.at/
|-
| muehlbacherhofweg 5 // 5020 salzburg // austria
|-
| fon/fax +43/662/842 897
|-
 

> -----Original Message-----
> From: Mark Womack [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 26, 2002 8:29 PM
> To: 'Log4J Users List'
> Subject: RE: stopping a socketnode-thread?
> 
> 
> From looking at the SocketNode code, the run() method will exit if
> an EOFException occurs.  So, can you send an end-of-file across the
> connection?
> Other than that, the code will keep running until any exception
> occurs.  
> 
> ?
> -Mark

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
Comment: public key available at http://home.subnet.at/rick/pgp/

iQA/AwUBPHvXlSDD9/SWDsvSEQK40ACggCmrOEUU84wBuys5pYKz4EWae9AAn2a4
cHR2Pokv7GwJE59X4ebEJIEN
=efvQ
-----END PGP SIGNATURE-----


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to