Class BasePersistTask
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.persisting.BasePersistTask
-
- All Implemented Interfaces:
PersistTaskEx,PersistTask
- Direct Known Subclasses:
ProjectPersistTask
public abstract class BasePersistTask extends Object implements PersistTaskEx
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasePersistTask(long id, PersistTaskStage initialStage, long creationTime, PersisterOptions options, PersistTasksStorage tasksStorage, DeadlocksDetector deadlocksDetector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Blocks caller until task is finished.booleanawait(long timeoutMillis)Blocks caller until the task is finished or timeout is exceeded.voidawaitForStage(PersistTaskStage stage)protected booleancompareAndSetStage(PersistTaskStage expectedStage, PersistTaskStage newStage)booleanequals(Object o)longgetCreationTime()longgetId()PersistTaskStagegetStage()inthashCode()booleanisAddedToQueueInsideAnotherTask()voidmarkAsUpdated()voidrethrowError()voidsetAddedToQueueInsideAnotherTask()booleansetStage(PersistTaskStage stage)Updates the stage of the task and the related DB record.StringtoString()booleanupdateStage(PersistTaskStage stage)Updates the inner stage of the task without the database updating.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.PersistTask
awaitUninterruptibly, getDescription, getError
-
Methods inherited from interface jetbrains.buildServer.serverSide.impl.persisting.PersistTaskEx
addError, canBeInterrupted, getFileWatcher, getUser, isCanceled, markAsFinished, notifyFileWatcher, onRemoveFromQueue, run
-
-
-
-
Constructor Detail
-
BasePersistTask
protected BasePersistTask(long id, @NotNull PersistTaskStage initialStage, long creationTime, @NotNull PersisterOptions options, @NotNull PersistTasksStorage tasksStorage, @Nullable DeadlocksDetector deadlocksDetector)
-
-
Method Detail
-
getId
public long getId()
- Specified by:
getIdin interfacePersistTask
-
await
public void await() throws InterruptedException, PersistDeadlockExceptionDescription copied from interface:PersistTaskBlocks caller until task is finished.- Specified by:
awaitin interfacePersistTask- Throws:
InterruptedException- if someone interrupts the caller threadPersistDeadlockException
-
await
public boolean await(long timeoutMillis) throws InterruptedException, PersistDeadlockExceptionDescription copied from interface:PersistTaskBlocks caller until the task is finished or timeout is exceeded.- Specified by:
awaitin interfacePersistTask- Parameters:
timeoutMillis- timeout in milliseconds to wait- Returns:
trueif the task finished,falseotherwise- Throws:
InterruptedException- if the thread was interruptedPersistDeadlockException
-
awaitForStage
public void awaitForStage(@NotNull PersistTaskStage stage) throws InterruptedException- Specified by:
awaitForStagein interfacePersistTaskEx- Throws:
InterruptedException
-
getStage
@NotNull public PersistTaskStage getStage()
- Specified by:
getStagein interfacePersistTask
-
updateStage
public boolean updateStage(@NotNull PersistTaskStage stage)Description copied from interface:PersistTaskExUpdates the inner stage of the task without the database updating.- Specified by:
updateStagein interfacePersistTaskEx- Parameters:
stage- the current stage of the task- Returns:
trueif task's stage was changed,falseotherwise
-
rethrowError
public void rethrowError()
- Specified by:
rethrowErrorin interfacePersistTaskEx
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTimein interfacePersistTaskEx
-
setAddedToQueueInsideAnotherTask
public void setAddedToQueueInsideAnotherTask()
- Specified by:
setAddedToQueueInsideAnotherTaskin interfacePersistTaskEx
-
isAddedToQueueInsideAnotherTask
public boolean isAddedToQueueInsideAnotherTask()
- Specified by:
isAddedToQueueInsideAnotherTaskin interfacePersistTaskEx
-
setStage
public boolean setStage(@NotNull PersistTaskStage stage)Updates the stage of the task and the related DB record. Returnstrueif and only if the stage of the task was changed.
-
markAsUpdated
public void markAsUpdated()
-
compareAndSetStage
protected boolean compareAndSetStage(@Nullable PersistTaskStage expectedStage, @NotNull PersistTaskStage newStage)
-
-