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:
Fixed 'scroll to bottom' no longer scrolling if log panel's events were cleared.
Thanks to Steven Kearns for finding this.
Modified shutdown of UDPReceiver - closing socket earlier and notifying threads in
order to shut down gracefully.
Revision Changes Path
1.74 +13 -7 logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
Index: LogPanel.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- LogPanel.java 22 May 2004 05:26:12 -0000 1.73
+++ LogPanel.java 27 May 2004 07:22:26 -0000 1.74
@@ -223,7 +223,7 @@
static final String TABLE_COLUMN_WIDTHS = "table.columns.widths";
static final String COLUMNS_EXTENSION = ".columns";
static final String COLORS_EXTENSION = ".colors";
- private int previousSelectedIndex = -1;
+ private int previousLastIndex = -1;
/**
* Creates a new LogPanel object. If a LogPanel with this identifier has
@@ -705,12 +705,18 @@
&& (evt.getFirstIndex() > 0)) || (evt.getValueIsAdjusting())) {
return;
}
- if (previousSelectedIndex > -1) {
- bypassScrollSelection = (!bypassScrollSelection &&
(evt.getLastIndex() == (table.getRowCount() - 1))
- &&
- (!((previousSelectedIndex == evt.getFirstIndex()) &&
(evt.getLastIndex() == (table.getRowCount() - 1)))));
- }
- previousSelectedIndex = evt.getLastIndex();
+ boolean lastIndexOnLastRow = (evt.getLastIndex() == (table.getRowCount()
- 1));
+ boolean firstIndexOnLastRow = (evt.getFirstIndex() ==
(table.getRowCount() - 1));
+ boolean lastIndexSame = (previousLastIndex == evt.getLastIndex());
+
+ /*
+ to bypass the scroll-to-bottom feature when the user selects a row other
than the bottom row,
+ one of two conditions must be met:
+ 1: neither the 'firstindex' nor the 'lastindex' are on the last row, or
+ 2: the last index value didn't change and the 'lastindex' is on the last
row
+ */
+ bypassScrollSelection = (!(lastIndexOnLastRow || firstIndexOnLastRow)) ||
(lastIndexSame && lastIndexOnLastRow);
+ previousLastIndex = evt.getLastIndex();
final ListSelectionModel lsm = (ListSelectionModel) evt.getSource();
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();
}
1.16 +5 -0
logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- release-notes.html 25 May 2004 22:37:38 -0000 1.15
+++ release-notes.html 27 May 2004 07:22:27 -0000 1.16
@@ -7,6 +7,11 @@
<BODY>
<h2>Release Notes</h2>
+<h2>1.99.99 (27th May 2004 08:00 GMT+10)</h2>
+<ul>
+ <li>Fixed 'scroll to bottom' no longer scrolling if log panel's events were
cleared. Thanks to Steven Kearns for finding this.</li>
+ <li>Modified shutdown of UDPReceiver - closing socket earlier and notifying
threads in order to shut down gracefully.</li>
+</ul>
<h2>1.99.99 (26th May 2004 08:00 GMT+10)</h2>
<ul>
<li>Added the JMSReceiver to the bundled distribution of 'known' receivers. This
will require you to have it's
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]