You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@logging.apache.org by sd...@apache.org on 2010/03/27 07:31:00 UTC

svn commit: r928161 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java

Author: sdeboy
Date: Sat Mar 27 06:31:00 2010
New Revision: 928161

URL: http://svn.apache.org/viewvc?rev=928161&view=rev
Log:
Removing id hashset from cyclic tablemodel

The set was being used to prevent duplicate rows from being added to the table (duplicate rows defined as two events which have the same ID property value).  

However, it is possible to define a 'custom expression logpanel' (a dynamic logpanel which combines events from multiple tabs into a new tab) which would need to include events from separate tabs which have the same ID

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?rev=928161&r1=928160&r2=928161&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java Sat Mar 27 06:31:00 2010
@@ -64,7 +64,6 @@ class ChainsawCyclicBufferTableModel ext
   private int cyclicBufferSize = DEFAULT_CAPACITY;
   List unfilteredList;
   List filteredList;
-  Set idSet = new HashSet(cyclicBufferSize);
   private boolean currentSortAscending;
   private int currentSortColumn;
   private final EventListenerList eventListenerList = new EventListenerList();
@@ -91,7 +90,6 @@ class ChainsawCyclicBufferTableModel ext
 
     unfilteredList = new CyclicBufferList(cyclicBufferSize);
     filteredList = new CyclicBufferList(cyclicBufferSize);
-    idSet = new HashSet(cyclicBufferSize);
   }
 
   /* (non-Javadoc)
@@ -293,7 +291,6 @@ class ChainsawCyclicBufferTableModel ext
     synchronized (unfilteredList) {
       unfilteredList.clear();
       filteredList.clear();
-      idSet.clear();
       uniqueRow = 0;
     }
 
@@ -474,13 +471,6 @@ class ChainsawCyclicBufferTableModel ext
       e.setProperty(Constants.LOG4J_ID_KEY, id.toString());
     }
 
-    //prevent duplicate rows
-    if (idSet.contains(id)) {
-      return false;
-    }
-
-    idSet.add(id);
-    
     /**
          * If we're in cyclic mode and over budget on the size, the addition of a new event will
          * cause the oldest event to fall off the cliff. We need to remove that events ID from the
@@ -491,7 +481,6 @@ class ChainsawCyclicBufferTableModel ext
             CyclicBufferList bufferList = (CyclicBufferList) unfilteredList;
             if (bufferList.size() == bufferList.getMaxSize()) {
                 LoggingEvent aboutToBeDropped = (LoggingEvent) unfilteredList.get(0);
-                idSet.remove(Integer.valueOf(aboutToBeDropped.getProperty(Constants.LOG4J_ID_KEY)));
                 reachedCapacity = true;
             }
     }
@@ -703,9 +692,6 @@ class ChainsawCyclicBufferTableModel ext
 
                   List newUnfilteredList = null;
                   List newFilteredList = null;
-                  HashSet newIDSet = null;
-
-                  newIDSet = new HashSet(cyclicBufferSize);
 
                   if (isCyclic()) {
                     newUnfilteredList = new CyclicBufferList(cyclicBufferSize);
@@ -726,18 +712,11 @@ class ChainsawCyclicBufferTableModel ext
                       e.getProperty(
                         e.getProperty(Constants.LOG4J_ID_KEY));
 
-                    if (o != null) {
-                      newIDSet.add(o);
-                    } else {
-                      newIDSet.add(new Integer(increment++));
-                    }
-
                     monitor.setProgress(index++);
                   }
 
                   unfilteredList = newUnfilteredList;
                   filteredList = newFilteredList;
-                  idSet = newIDSet;
                 }
 
                 monitor.setNote("Refiltering...");