You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2004/05/27 11:01:10 UTC
Re: cvs commit:
logging-log4j/src/java/org/apache/log4j/chainsaw/help
release-notes.html
Scott,
Thanks for cleaning up after me. In my defense, I was going to test the
changed
code this morning.
At 09:22 AM 5/27/2004, you wrote:
>sdeboy 2004/05/27 00:22:27
>
> Modified: src/java/org/apache/log4j/chainsaw LogPanel.java
> src/java/org/apache/log4j/net UDPReceiver.java
> src/java/org/apache/log4j/chainsaw/help release-notes.html
> Log:
> Modified shutdown of UDPReceiver - closing socket earlier and notifying
> threads in order to shut down gracefully.
>
> 1.7 +8
> -4 logging-log4j/src/java/org/apache/log4j/net/UDPReceiver.java
>
> Index: UDPReceiver.java
> ===================================================================
> RCS file:
> /home/cvs/logging-log4j/src/java/org/apache/log4j/net/UDPReceiver.java,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- UDPReceiver.java 26 May 2004 17:19:37 -0000 1.6
> +++ UDPReceiver.java 27 May 2004 07:22:27 -0000 1.7
> @@ -47,7 +47,7 @@
> private String decoder = "org.apache.log4j.xml.XMLDecoder";
> private Decoder decoderImpl;
> protected boolean paused;
> - private boolean closed = false;
> + private transient boolean closed = false;
> private int port;
> private DatagramSocket socket;
> UDPHandlerThread handlerThread;
> @@ -93,8 +93,11 @@
>
> public synchronized void shutdown() {
> closed = true;
> + socket.close();
> +
> try {
> if(handlerThread != null) {
> + handlerThread.close();
> handlerThread.join();
> }
> if(receiverThread != null) {
> @@ -102,7 +105,6 @@
> }
> } catch(InterruptedException ie) {
> }
> - socket.close();
> }
>
> /**
> @@ -156,7 +158,9 @@
> * Allow the UDPHandlerThread to wakeup and exit gracefully.
> */
> void close() {
> - list.notify();
> + synchronized(list) {
> + list.notify();
> + }
> }
>
> public void run() {
> @@ -165,7 +169,7 @@
> while (!UDPReceiver.this.closed) {
> synchronized (list) {
> try {
> - while (list.size() == 0) {
> + while (!UDPReceiver.this.closed && list.size() == 0) {
> list.wait();
> }
>
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org