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

abobrov
17.56.2009 7a9de17f26709fcd7270afd90215e50196bf4395
- [Issue 2233] log notices when any given task starts and ends execution.

2 files modified
21 ■■■■ changed files
opends/src/messages/messages/task.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/task/TaskThread.java 19 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/task.properties
@@ -194,3 +194,5 @@
SEVERE_ERR_TASK_LDAP_FAILED_TO_CONNECT_WRONG_PORT_106=Unable to connect to the \
 server at %s on port %s. Check this port is an administration port
INFO_TASK_STATE_RECURRING_107=Recurring
NOTICE_TASK_STARTED_108=%s task %s started execution
NOTICE_TASK_FINISHED_109=%s task %s finished execution
opends/src/server/org/opends/server/backends/task/TaskThread.java
@@ -36,6 +36,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.TaskMessages.*;
import static org.opends.server.util.StaticUtils.*;
@@ -69,7 +70,7 @@
  // The object that will be used for signaling the thread when there is new
  // work to perform.
  private Object notifyLock;
  private final Object notifyLock;
@@ -168,6 +169,7 @@
   * Operates in a loop, sleeping until there is no work to do, then
   * processing the task and returning to the scheduler for more work.
   */
  @Override
  public void run()
  {
    while (! exitRequested)
@@ -196,8 +198,18 @@
      {
        if (!TaskState.isDone(getAssociatedTask().getTaskState()))
        {
          TaskState returnState = getAssociatedTask().execute();
          getAssociatedTask().setTaskState(returnState);
          Task task = getAssociatedTask();
          Message message = NOTE_TASK_STARTED.get(
            task.getDisplayName(), task.getTaskID());
          logError(message);
          TaskState returnState = task.execute();
          task.setTaskState(returnState);
          message = NOTE_TASK_FINISHED.get(
            task.getDisplayName(), task.getTaskID());
          logError(message);
        }
      }
      catch (Exception e)
@@ -241,6 +253,7 @@
   *
   * @return debug information about this thread as a string.
   */
  @Override
  public Map<String, String> getDebugProperties()
  {
    Map<String, String> properties = super.getDebugProperties();