Class MultiNodeAgentCommandsExecutor
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.agent.MultiNodeAgentCommandsExecutor
-
- All Implemented Interfaces:
AgentCommandsExecutor
public class MultiNodeAgentCommandsExecutor extends Object implements AgentCommandsExecutor
-
-
Field Summary
Fields Modifier and Type Field Description static String
AGENT_COMMAND_PREFIX
static String
AGENT_ID_PREFIX
-
Constructor Summary
Constructors Constructor Description MultiNodeAgentCommandsExecutor(ExecutorService executorService, MultiNodeTasks multiNodeTasks, MultiNodeAgentCommandsListener agentCommandsListener, Supplier<jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.AgentData> agentDetailsSupplier, Supplier<Long> timeSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultiNodeTasks.TaskData
createMultinodeTask(PollingRemoteAgentConnection.Command command, String identity)
void
dispose()
void
done(String result, int commandId)
String
executeCommandAndWait(PollingRemoteAgentConnection.Command command)
Synchronously execute commandvoid
failed(Error error, int commandId)
PollingRemoteAgentConnection.Command
getNextCommand()
boolean
hasActiveSubscriptions(long subscriptionTimeout)
void
inProgress(int commandId)
void
notifySubscribersOnNewCommand(MultiNodeTasks.SubmittedTask task)
void
scheduleCommand(PollingRemoteAgentConnection.Command command, jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.Callback callback)
com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command>
subscribeToNextCommand()
Allows to subscribe to the next command for the agent.void
unsubscribeFromNextCommand(com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command> future)
Remove listener returned bysubscribeToNextCommand()
method.
-
-
-
Field Detail
-
AGENT_COMMAND_PREFIX
public static final String AGENT_COMMAND_PREFIX
- See Also:
- Constant Field Values
-
AGENT_ID_PREFIX
public static final String AGENT_ID_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultiNodeAgentCommandsExecutor
public MultiNodeAgentCommandsExecutor(@NotNull ExecutorService executorService, @NotNull MultiNodeTasks multiNodeTasks, @NotNull MultiNodeAgentCommandsListener agentCommandsListener, @NotNull Supplier<jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.AgentData> agentDetailsSupplier, @NotNull Supplier<Long> timeSupplier)
-
-
Method Detail
-
notifySubscribersOnNewCommand
public void notifySubscribersOnNewCommand(@NotNull MultiNodeTasks.SubmittedTask task)
-
scheduleCommand
public void scheduleCommand(@NotNull PollingRemoteAgentConnection.Command command, @NotNull jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.Callback callback) throws RejectedExecutionException
- Specified by:
scheduleCommand
in interfaceAgentCommandsExecutor
- Throws:
RejectedExecutionException
-
executeCommandAndWait
public String executeCommandAndWait(@NotNull PollingRemoteAgentConnection.Command command) throws AgentCommandExecutionException, AgentTimeoutException, InterruptedException
Synchronously execute command- Specified by:
executeCommandAndWait
in interfaceAgentCommandsExecutor
- Throws:
AgentCommandExecutionException
AgentTimeoutException
InterruptedException
-
createMultinodeTask
@NotNull public static MultiNodeTasks.TaskData createMultinodeTask(@NotNull PollingRemoteAgentConnection.Command command, @NotNull String identity)
-
subscribeToNextCommand
@NotNull public com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command> subscribeToNextCommand()
Allows to subscribe to the next command for the agent. Returned future will be released when command is available. In this caseFuture.get()
will return this command.- Specified by:
subscribeToNextCommand
in interfaceAgentCommandsExecutor
-
unsubscribeFromNextCommand
public void unsubscribeFromNextCommand(@NotNull com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command> future)
Remove listener returned bysubscribeToNextCommand()
method.- Specified by:
unsubscribeFromNextCommand
in interfaceAgentCommandsExecutor
-
getNextCommand
@Nullable public PollingRemoteAgentConnection.Command getNextCommand()
- Specified by:
getNextCommand
in interfaceAgentCommandsExecutor
-
done
public void done(@NotNull String result, int commandId)
- Specified by:
done
in interfaceAgentCommandsExecutor
- Throws:
UnrecognizedCommandException
- when server doesn't know about this command
-
inProgress
public void inProgress(int commandId)
- Specified by:
inProgress
in interfaceAgentCommandsExecutor
-
failed
public void failed(@NotNull Error error, int commandId)
- Specified by:
failed
in interfaceAgentCommandsExecutor
- Throws:
UnrecognizedCommandException
- when server doesn't know about this command
-
hasActiveSubscriptions
public boolean hasActiveSubscriptions(long subscriptionTimeout)
- Specified by:
hasActiveSubscriptions
in interfaceAgentCommandsExecutor
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceAgentCommandsExecutor
-
-