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

jvergara
24.52.2009 2e5052b686e11016544d09999cf8373ee39035ce
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