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 class
MultiNodeTasksDbImpl.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 int
IDENTITY_MAX_LENGTH
static String
PACKED_LONG_VALUE_PREFIX
static String
PLAIN_LONG_VALUE_PREFIX
static String
PROCESS_TASKS_DELAY_MILLIS
static String
TASK_COMPLETION_POLL_INTERVAL
static String
TASKS_BACKGROUND_PROCESSING_PAUSED
static String
TASKS_PROCESSING_PACK_SIZE
static String
TEAMCITY_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:
submit
in interfaceMultiNodeTasks
-
subscribe
public void subscribe(@NotNull String taskType, @NotNull MultiNodeTasks.TaskConsumer consumer)
Description copied from interface:MultiNodeTasks
Subscribes 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:
subscribe
in interfaceMultiNodeTasks
-
unsubscribe
public void unsubscribe(@NotNull String taskType)
Description copied from interface:MultiNodeTasks
Unsubscribes a consumer for the task of the specified type.- Specified by:
unsubscribe
in interfaceMultiNodeTasks
-
subscribeOnSingletonTask
public void subscribeOnSingletonTask(@NotNull String taskType, @NotNull MultiNodeTasks.TaskConsumer consumer)
Description copied from interface:MultiNodeTasks
Subscribe 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:
subscribeOnSingletonTask
in interfaceMultiNodeTasks
-
findTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findTasks
in interfaceMultiNodeTasks
-
findTaskById
@Nullable public MultiNodeTasks.SubmittedTask findTaskById(int id)
- Specified by:
findTaskById
in interfaceMultiNodeTasks
-
findInProgressTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findInProgressTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findInProgressTasks
in interfaceMultiNodeTasks
-
findInProgressTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findInProgressTasks()
- Specified by:
findInProgressTasks
in interfaceMultiNodeTasks
- Returns:
- all currently in progress tasks
-
findPendingTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> findPendingTasks(@NotNull Collection<String> taskTypes)
- Specified by:
findPendingTasks
in interfaceMultiNodeTasks
-
findTask
@Nullable public MultiNodeTasks.SubmittedTask findTask(@NotNull String taskType, @NotNull String taskIdentity)
- Specified by:
findTask
in interfaceMultiNodeTasks
-
getUnfinishedTasks
@NotNull public List<MultiNodeTasks.SubmittedTask> getUnfinishedTasks()
Description copied from interface:MultiNodeTasks
Returns 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:
getUnfinishedTasks
in 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:
findFinishedTasks
in interfaceMultiNodeTasks
-
addListener
public void addListener(@NotNull MultiNodeTasksListener listener)
- Specified by:
addListener
in interfaceMultiNodeTasks
-
removeListener
public void removeListener(@NotNull MultiNodeTasksListener listener)
- Specified by:
removeListener
in 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:
getLastTaskId
in interfaceMultiNodeTasks
- Returns:
- the id of the last created task
-
-