Class MultiNodeTasksDbImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.MultiNodeTasksDbImpl
-
- All Implemented Interfaces:
MultiNodeTasks
public class MultiNodeTasksDbImpl extends Object implements MultiNodeTasks
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMultiNodeTasksDbImpl.PerformingTaskImpl-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.MultiNodeTasks
MultiNodeTasks.PerformingTask, MultiNodeTasks.PersistedTask, MultiNodeTasks.SubmittedTask, MultiNodeTasks.Task, MultiNodeTasks.TaskConsumer, MultiNodeTasks.TaskData
-
-
Field Summary
Fields Modifier and Type Field Description static intIDENTITY_MAX_LENGTHstatic StringPACKED_LONG_VALUE_PREFIXstatic StringPLAIN_LONG_VALUE_PREFIXstatic StringPROCESS_TASKS_DELAY_MILLISstatic StringTASK_COMPLETION_POLL_INTERVALstatic StringTASKS_BACKGROUND_PROCESSING_PAUSEDstatic StringTASKS_PROCESSING_PACK_SIZEstatic StringTEAMCITY_OFFLINE_NODE_TASK_TIMEOUT_MILLIS
-
Constructor Summary
Constructors Constructor Description MultiNodeTasksDbImpl(SQLRunnerEx sqlRunner, EventDispatcher<BuildServerListener> eventDispatcher, TeamCityNodes teamCityNodes, ExecutorServices executors, ServerResponsibility serverResponsibility, ServerMetrics serverMetrics, SecurityContextEx securityContext, NumericIdSequences idSequences)
-
Method Summary
-
-
-
Field Detail
-
IDENTITY_MAX_LENGTH
public static final int IDENTITY_MAX_LENGTH
- See Also:
- Constant Field Values
-
TASK_COMPLETION_POLL_INTERVAL
public static final String TASK_COMPLETION_POLL_INTERVAL
- See Also:
- Constant Field Values
-
TEAMCITY_OFFLINE_NODE_TASK_TIMEOUT_MILLIS
public static final String TEAMCITY_OFFLINE_NODE_TASK_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
PROCESS_TASKS_DELAY_MILLIS
public static final String PROCESS_TASKS_DELAY_MILLIS
- See Also:
- Constant Field Values
-
PLAIN_LONG_VALUE_PREFIX
public static final String PLAIN_LONG_VALUE_PREFIX
- See Also:
- Constant Field Values
-
PACKED_LONG_VALUE_PREFIX
public static final String PACKED_LONG_VALUE_PREFIX
- See Also:
- Constant Field Values
-
TASKS_PROCESSING_PACK_SIZE
public static final String TASKS_PROCESSING_PACK_SIZE
- See Also:
- Constant Field Values
-
TASKS_BACKGROUND_PROCESSING_PAUSED
public static final String TASKS_BACKGROUND_PROCESSING_PAUSED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultiNodeTasksDbImpl
@Autowired public MultiNodeTasksDbImpl(@NotNull SQLRunnerEx sqlRunner, @NotNull EventDispatcher<BuildServerListener> eventDispatcher, @NotNull TeamCityNodes teamCityNodes, @NotNull ExecutorServices executors, @NotNull ServerResponsibility serverResponsibility, @NotNull ServerMetrics serverMetrics, @NotNull SecurityContextEx securityContext, @NotNull NumericIdSequences idSequences)
-
-
Method Detail
-
start
protected void start()
-
stop
protected void stop()
-
submit
@NotNull public MultiNodeTasks.SubmittedTask submit(@NotNull MultiNodeTasks.Task task)
- Specified by:
submitin interfaceMultiNodeTasks
-
subscribe
public void subscribe(@NotNull String taskType, @NotNull MultiNodeTasks.TaskConsumer consumer)Description copied from interface:MultiNodeTasksSubscribes a consumer for the task of the specified type. The task may not be accepted by the consumer, in this case it should throwCannotAcceptTaskException.- Specified by:
subscribein interfaceMultiNodeTasks
-
unsubscribe
public void unsubscribe(@NotNull String taskType)Description copied from interface:MultiNodeTasksUnsubscribes a consumer for the task of the specified type.- Specified by:
unsubscribein interfaceMultiNodeTasks
-
subscribeOnSingletonTask
public void subscribeOnSingletonTask(@NotNull String taskType, @NotNull MultiNodeTasks.TaskConsumer consumer)Description copied from interface:MultiNodeTasksSubscribe for a task that is guaranteed to be executed only once per identity: when the second task with the same identity is found it's marked as finished immediately, without calling subscribers.- Specified by:
subscribeOnSingletonTaskin interfaceMultiNodeTasks
-
findTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findTasksin interfaceMultiNodeTasks
-
findTaskById
@Nullable public MultiNodeTasks.SubmittedTask findTaskById(int id)
- Specified by:
findTaskByIdin interfaceMultiNodeTasks
-
findInProgressTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findInProgressTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findInProgressTasksin interfaceMultiNodeTasks
-
findInProgressTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findInProgressTasks()
- Specified by:
findInProgressTasksin interfaceMultiNodeTasks- Returns:
- all currently in progress tasks
-
findPendingTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findPendingTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findPendingTasksin interfaceMultiNodeTasks
-
findTask
@Nullable public MultiNodeTasks.SubmittedTask findTask(@NotNull String taskType, @NotNull String taskIdentity)
- Specified by:
findTaskin interfaceMultiNodeTasks
-
getUnfinishedTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> getUnfinishedTasks()
Description copied from interface:MultiNodeTasksReturns currently known pending and in-progress tasks.
The list includes tasks created by the current and by other nodes.
Note: contrary to various find* methods, this method does not fetch the data from the database, instead it returns the list which is updated periodically and may not contain the most up-to-date information.
The tasks are sorted by their creation time, the oldest comes first.
- Specified by:
getUnfinishedTasksin interfaceMultiNodeTasks- Returns:
- the currently known list of pending and in progress tasks
-
findFinishedTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findFinishedTasks(@NotNull Collection<String> taskTypes, long finishTimeThresholdMs)
- Specified by:
findFinishedTasksin interfaceMultiNodeTasks
-
addListener
public void addListener(@NotNull MultiNodeTasksListener listener)- Specified by:
addListenerin interfaceMultiNodeTasks
-
removeListener
public void removeListener(@NotNull MultiNodeTasksListener listener)- Specified by:
removeListenerin interfaceMultiNodeTasks
-
finishWithNodeInaccessibleState
public void finishWithNodeInaccessibleState(@NotNull MultiNodeTasks.SubmittedTask task)
-
cleanupOldTasks
protected void cleanupOldTasks()
-
setBeforeTaskInterceptor
@TestOnly public void setBeforeTaskInterceptor(Function<MultiNodeTasks.PerformingTask,Boolean> beforeTaskInterceptor)
-
getLastTaskId
public long getLastTaskId()
- Specified by:
getLastTaskIdin interfaceMultiNodeTasks- Returns:
- the id of the last created task
-
-