Author: jflesch
Date: 2006-11-01 20:35:02 +0000 (Wed, 01 Nov 2006)
New Revision: 10788

Modified:
   trunk/apps/Thaw/src/thaw/core/Logger.java
   trunk/apps/Thaw/src/thaw/core/MainWindow.java
   trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
   trunk/apps/Thaw/src/thaw/plugins/ToolbarModifier.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
   trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
Log:
Fix possible freeze when updating indexes with a jvm 1.4

Modified: trunk/apps/Thaw/src/thaw/core/Logger.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Logger.java   2006-11-01 20:16:48 UTC (rev 
10787)
+++ trunk/apps/Thaw/src/thaw/core/Logger.java   2006-11-01 20:35:02 UTC (rev 
10788)
@@ -20,7 +20,7 @@
         *
         * 2 or more is recommanded.
         */
-       public final static int LOG_LEVEL = 3;
+       public final static int LOG_LEVEL = 2;

        private static Vector logListeners = null;


Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/MainWindow.java       2006-11-01 20:16:48 UTC 
(rev 10787)
+++ trunk/apps/Thaw/src/thaw/core/MainWindow.java       2006-11-01 20:35:02 UTC 
(rev 10788)
@@ -237,7 +237,11 @@
                this.updateToolBar();
        }

+       public void resetLastKnowToolBarModifier() {
+               lastToolBarModifier = null;
+       }

+
        /**
         * Used to add a tab in the main window.
         * In the future, even if the interface, this function should remain 
available.

Modified: trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-11-01 20:16:48 UTC 
(rev 10787)
+++ trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-11-01 20:35:02 UTC 
(rev 10788)
@@ -172,7 +172,7 @@
                tabId = 
core.getMainWindow().getTabbedPane().indexOfTab(I18n.getMessage("thaw.common.status"));

                if (tabId < 0) {
-                       Logger.warning(this, "Unable to find back the tab !");
+                       Logger.warning(this, "Unable to find the tab !");
                        return;
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/ToolbarModifier.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/ToolbarModifier.java       2006-11-01 
20:16:48 UTC (rev 10787)
+++ trunk/apps/Thaw/src/thaw/plugins/ToolbarModifier.java       2006-11-01 
20:35:02 UTC (rev 10788)
@@ -29,6 +29,7 @@

        public void setMainWindow(MainWindow target) {
                this.mainWindow = target;
+               this.mainWindow.resetLastKnowToolBarModifier();
        }

        public void addButtonToTheToolbar(JButton button) {
@@ -47,6 +48,10 @@

        public void displayButtonsInTheToolbar() {
                if (mainWindow != null) {
+                       if (buttons.size() == 0) {
+                               Logger.notice(this, "No button to display ?");
+                       }
+
                        mainWindow.changeButtonsInTheToolbar(this, buttons);
                        areDisplayed = true;
                } else

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-11-01 20:16:48 UTC 
(rev 10787)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-11-01 20:35:02 UTC 
(rev 10788)
@@ -334,14 +334,6 @@

                clientGet.addObserver(this);

-               /*
-                * These requests are usually quite fast, and don't consume a 
lot
-                * of bandwith / CPU. So we can skip the queue and start 
immediatly
-                * (and like this, they won't appear in the queue)
-                */
-               //this.queueManager.addQueryToThePendingQueue(clientGet);
-               clientGet.start(queueManager);
-
                Thread downloadAndParse = new Thread(new 
DownloadAndParse(clientGet, rewriteKey));
                downloadAndParse.start();

@@ -363,6 +355,13 @@
                }

                public void run() {
+                       /*
+                        * These requests are usually quite fast, and don't 
consume a lot
+                        * of bandwith / CPU. So we can skip the queue and 
start immediatly
+                        * (and like this, they won't appear in the queue)
+                        */
+                       
//this.queueManager.addQueryToThePendingQueue(clientGet);
+                       clientGet.start(queueManager);
                        loadXML(clientGet.getInputStream());
                        save();
                }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-11-01 
20:16:48 UTC (rev 10787)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-11-01 
20:35:02 UTC (rev 10788)
@@ -329,6 +329,25 @@
                return null;
        }

+
+       public void startUpdateFromThisNode(IndexTreeNode node) {
+               Thread th = new Thread(new Updater(node));
+               th.start();
+       }
+
+       private class Updater implements Runnable {
+               IndexTreeNode node;
+
+               public Updater(IndexTreeNode node) {
+                       this.node = node;
+               }
+
+               public void run() {
+                       node.update();
+               }
+       }
+
+
        public void actionPerformed(ActionEvent e) {
                if(this.selectedNode == null)
                        this.selectedNode = this.root;
@@ -445,15 +464,15 @@

                if(e.getSource() == this.updateIndex
                   || e.getSource() == this.updateIndexCategory) {
-                       this.selectedNode.update();
+                       startUpdateFromThisNode(this.selectedNode);
                }

                if (e.getSource() == this.reloadFromFreenet) {
-                       this.selectedNode.updateFromFreenet(-1);
+                       startUpdateFromThisNode(this.selectedNode);
                }

                if (e.getSource() == this.refreshAll) {
-                       this.root.update();
+                       startUpdateFromThisNode(this.selectedNode);
                }

                if(e.getSource() == this.copyPublicKey

Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java  
2006-11-01 20:16:48 UTC (rev 10787)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java  
2006-11-01 20:35:02 UTC (rev 10788)
@@ -315,7 +315,7 @@
                        }
                }

-               Logger.warning(this, "update(): Unknow change ?!");
+               Logger.notice(this, "update(): unknow change");
                this.reloadQueue();
        }



Reply via email to