mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
24.52.2009 2e5052b686e11016544d09999cf8373ee39035ce
Cleanup the completed tasks and dispose the progress dialogs once they are closed, since these increases the used memory and today there is no UI to redisplay closed progress dialogs.
2 files modified
38 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java 30 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java 8 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -179,6 +179,15 @@
  }
  /**
   * Unregisters a task.
   * @param task the task to be unregistered.
   */
  public void unregisterTask(Task task)
  {
    tasks.remove(task);
  }
  /**
   * Tells whether an index must be reindexed or not.
   * @param index the index.
   * @return <CODE>true</CODE> if the index must be reindexed and
@@ -815,6 +824,7 @@
        {
          while (!stopPooling)
          {
            cleanupTasks();
            regenerateDescriptor();
            Thread.sleep(poolingPeriod);
          }
@@ -1237,6 +1247,26 @@
  }
  /**
   * Cleans the tasks that are over.
   */
  private void cleanupTasks()
  {
    Set<Task> toClean = new HashSet<Task>();
    for (Task task : tasks)
    {
      if (task.getState() == Task.State.FINISHED_SUCCESSFULLY ||
          task.getState() == Task.State.FINISHED_WITH_ERROR)
      {
        toClean.add(task);
      }
    }
    for (Task task : toClean)
    {
      unregisterTask(task);
    }
  }
  /**
   * Returns whether the provided task is running on the provided server or not.
   * The code takes into account that the server object might not be fully
   * initialized (but at least it contains the host name and the instance
opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java
@@ -262,6 +262,14 @@
    }
    /**
     * {@inheritDoc}
     */
    public boolean isDisposeOnClose()
    {
      return true;
    }
    /**
     * Appends a line to the logs (Details are) section of the panel.  The text
     * will be preceded by a new line (is similar to println()).
     * @param msg the HTML formatted text to be appended.