From 85bc65ad360e8021f8cbb8b52e64b71b3cbfc2f9 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 15 Aug 2007 22:59:05 +0000
Subject: [PATCH] Launch the method backgroundTaskCompleted in the event thread.  This way we avoid having locking problems and the reactivity of the Graphical interfaces using this classes improves a lot.

---
 opends/src/quicksetup/org/opends/quicksetup/util/BackgroundThreadTask.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/BackgroundThreadTask.java b/opends/src/quicksetup/org/opends/quicksetup/util/BackgroundThreadTask.java
index 0309735..03a1ede 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/BackgroundThreadTask.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/BackgroundThreadTask.java
@@ -26,6 +26,8 @@
  */
 package org.opends.quicksetup.util;
 
+import javax.swing.SwingUtilities;
+
 
 
 /**
@@ -62,12 +64,24 @@
   {
     try
     {
-      T returnValue = backgroundTask.processBackgroundTask();
-      backgroundTask.backgroundTaskCompleted(returnValue, null);
+      final T returnValue = backgroundTask.processBackgroundTask();
+      SwingUtilities.invokeLater(new Runnable()
+      {
+        public void run()
+        {
+          backgroundTask.backgroundTaskCompleted(returnValue, null);
+        }
+      });
     }
-    catch (Throwable t)
+    catch (final Throwable t)
     {
-      backgroundTask.backgroundTaskCompleted(null, t);
+      SwingUtilities.invokeLater(new Runnable()
+      {
+        public void run()
+        {
+          backgroundTask.backgroundTaskCompleted(null, t);
+        }
+      });
     }
   }
 }

--
Gitblit v1.10.0