You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/11/16 21:35:59 UTC

svn commit: r595814 - /directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java

Author: seelmann
Date: Fri Nov 16 12:35:58 2007
New Revision: 595814

URL: http://svn.apache.org/viewvc?rev=595814&view=rev
Log:
Performance improvement

Modified:
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java?rev=595814&r1=595813&r2=595814&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java Fri Nov 16 12:35:58 2007
@@ -57,6 +57,9 @@
     /** The current input */
     private ModificationLogsViewInput input;
 
+    /** The last refresh timestamp. */
+    private long lastRefreshTimestamp;
+
     /** Listener that listens for selections of connections */
     private INullSelectionListener connectionSelectionListener = new INullSelectionListener()
     {
@@ -175,10 +178,16 @@
      */
     public void entryUpdated( EntryModificationEvent event )
     {
-        if ( !( event instanceof AttributesInitializedEvent ) && !( event instanceof ChildrenInitializedEvent ) )
+        // performance optimization: refresh only once per second
+        long now = System.currentTimeMillis();
+        if ( lastRefreshTimestamp + 1000 < now )
         {
-            refreshInput();
-            scrollToNewest();
+            if ( !( event instanceof AttributesInitializedEvent ) && !( event instanceof ChildrenInitializedEvent ) )
+            {
+                refreshInput();
+                scrollToNewest();
+                lastRefreshTimestamp = now;
+            }
         }
     }
 
@@ -209,10 +218,10 @@
         catch ( Exception e )
         {
         }
-
     }
-    
-	/**
+
+
+    /**
      * Clears the input and deletes the logfiles for it
      * 
      */