| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server task always |
| | | * completes successfully. It is intended only for testing purposes. |
| | |
| | | public class DummyTask |
| | | extends Task |
| | | { |
| | | // The length of time that the task should sleep before completing. |
| | | /** The length of time that the task should sleep before completing. */ |
| | | private long sleepTime; |
| | | |
| | | // The task state to use when interrupting the task. This will be |
| | | // null unless the task gets interrupted. |
| | | /** |
| | | * The task state to use when interrupting the task. This will be |
| | | * null unless the task gets interrupted. |
| | | */ |
| | | private volatile TaskState interruptedState; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getDisplayName() { |
| | | return LocalizableMessage.raw("Dummy"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeTask() |
| | | throws DirectoryException |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | protected TaskState runTask() |
| | | { |
| | | long stopTime = System.currentTimeMillis() + sleepTime; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isInterruptable() |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void interruptTask(TaskState taskState, LocalizableMessage interruptMessage) |
| | | { |