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

jvergara
24.52.2009 a962f63052985ec85f0965a4b5ff2024f6dc0a51
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
40 ■■■■■ changed files
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java 32 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java 8 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -169,7 +169,7 @@
  }
  /**
   * Registers a task.  The Control Panel creates a task everytime an operation
   * Registers a task.  The Control Panel creates a task every time an operation
   * is made and they are stored here.
   * @param task the task to be registered.
   */
@@ -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
opendj-sdk/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.