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 protected
BasePersistTask(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 void
await()
Blocks caller until task is finished.boolean
await(long timeoutMillis)
Blocks caller until the task is finished or timeout is exceeded.void
awaitForStage(PersistTaskStage stage)
protected boolean
compareAndSetStage(PersistTaskStage expectedStage, PersistTaskStage newStage)
boolean
equals(Object o)
long
getCreationTime()
long
getId()
PersistTaskStage
getStage()
int
hashCode()
boolean
isAddedToQueueInsideAnotherTask()
void
markAsUpdated()
void
rethrowError()
void
setAddedToQueueInsideAnotherTask()
boolean
setStage(PersistTaskStage stage)
Updates the stage of the task and the related DB record.String
toString()
boolean
updateStage(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:
getId
in interfacePersistTask
-
await
public void await() throws InterruptedException, PersistDeadlockException
Description copied from interface:PersistTask
Blocks caller until task is finished.- Specified by:
await
in interfacePersistTask
- Throws:
InterruptedException
- if someone interrupts the caller threadPersistDeadlockException
-
await
public boolean await(long timeoutMillis) throws InterruptedException, PersistDeadlockException
Description copied from interface:PersistTask
Blocks caller until the task is finished or timeout is exceeded.- Specified by:
await
in interfacePersistTask
- Parameters:
timeoutMillis
- timeout in milliseconds to wait- Returns:
true
if the task finished,false
otherwise- Throws:
InterruptedException
- if the thread was interruptedPersistDeadlockException
-
awaitForStage
public void awaitForStage(@NotNull PersistTaskStage stage) throws InterruptedException
- Specified by:
awaitForStage
in interfacePersistTaskEx
- Throws:
InterruptedException
-
getStage
@NotNull public PersistTaskStage getStage()
- Specified by:
getStage
in interfacePersistTask
-
updateStage
public boolean updateStage(@NotNull PersistTaskStage stage)
Description copied from interface:PersistTaskEx
Updates the inner stage of the task without the database updating.- Specified by:
updateStage
in interfacePersistTaskEx
- Parameters:
stage
- the current stage of the task- Returns:
true
if task's stage was changed,false
otherwise
-
rethrowError
public void rethrowError()
- Specified by:
rethrowError
in interfacePersistTaskEx
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTime
in interfacePersistTaskEx
-
setAddedToQueueInsideAnotherTask
public void setAddedToQueueInsideAnotherTask()
- Specified by:
setAddedToQueueInsideAnotherTask
in interfacePersistTaskEx
-
isAddedToQueueInsideAnotherTask
public boolean isAddedToQueueInsideAnotherTask()
- Specified by:
isAddedToQueueInsideAnotherTask
in interfacePersistTaskEx
-
setStage
public boolean setStage(@NotNull PersistTaskStage stage)
Updates the stage of the task and the related DB record. Returnstrue
if and only if the stage of the task was changed.
-
markAsUpdated
public void markAsUpdated()
-
compareAndSetStage
protected boolean compareAndSetStage(@Nullable PersistTaskStage expectedStage, @NotNull PersistTaskStage newStage)
-
-