Class SingleNodeAgentCommandsExecutor
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.agent.SingleNodeAgentCommandsExecutor
-
- All Implemented Interfaces:
AgentCommandsExecutor
public class SingleNodeAgentCommandsExecutor extends Object implements AgentCommandsExecutor
-
-
Constructor Summary
Constructors Constructor Description SingleNodeAgentCommandsExecutor(int initialCommandId, ExecutorService executorService, Supplier<jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.AgentData> agentDataSupplier, Supplier<Long> timeSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()voiddone(String result, int commandId)StringexecuteCommandAndWait(PollingRemoteAgentConnection.Command command)Synchronously execute commandvoidfailed(Error error, int commandId)PollingRemoteAgentConnection.CommandgetNextCommand()booleanhasActiveSubscriptions(long subscriptionTimeout)voidinProgress(int commandId)voidscheduleCommand(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.voidunsubscribeFromNextCommand(com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command> future)Remove listener returned bysubscribeToNextCommand()method.
-
-
-
Constructor Detail
-
SingleNodeAgentCommandsExecutor
public SingleNodeAgentCommandsExecutor(int initialCommandId, @NotNull ExecutorService executorService, @NotNull Supplier<jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.AgentData> agentDataSupplier, @NotNull Supplier<Long> timeSupplier)
-
-
Method Detail
-
scheduleCommand
public void scheduleCommand(@NotNull PollingRemoteAgentConnection.Command command, @NotNull jetbrains.buildServer.serverSide.impl.agent.PollingRemoteAgentConnection.Callback callback) throws RejectedExecutionException- Specified by:
scheduleCommandin interfaceAgentCommandsExecutor- Throws:
RejectedExecutionException
-
executeCommandAndWait
public String executeCommandAndWait(@NotNull PollingRemoteAgentConnection.Command command) throws AgentCommandExecutionException, AgentTimeoutException, InterruptedException
Synchronously execute command- Specified by:
executeCommandAndWaitin interfaceAgentCommandsExecutor- Throws:
AgentCommandExecutionExceptionAgentTimeoutExceptionInterruptedException
-
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:
subscribeToNextCommandin interfaceAgentCommandsExecutor
-
unsubscribeFromNextCommand
public void unsubscribeFromNextCommand(@NotNull com.google.common.util.concurrent.ListenableFuture<PollingRemoteAgentConnection.Command> future)Remove listener returned bysubscribeToNextCommand()method.- Specified by:
unsubscribeFromNextCommandin interfaceAgentCommandsExecutor
-
getNextCommand
@Nullable public PollingRemoteAgentConnection.Command getNextCommand()
- Specified by:
getNextCommandin interfaceAgentCommandsExecutor
-
done
public void done(@NotNull String result, int commandId)- Specified by:
donein interfaceAgentCommandsExecutor- Throws:
UnrecognizedCommandException- when server doesn't know about this command
-
inProgress
public void inProgress(int commandId)
- Specified by:
inProgressin interfaceAgentCommandsExecutor
-
failed
public void failed(@NotNull Error error, int commandId)- Specified by:
failedin interfaceAgentCommandsExecutor- Throws:
UnrecognizedCommandException- when server doesn't know about this command
-
hasActiveSubscriptions
public boolean hasActiveSubscriptions(long subscriptionTimeout)
- Specified by:
hasActiveSubscriptionsin interfaceAgentCommandsExecutor
-
dispose
public void dispose()
- Specified by:
disposein interfaceAgentCommandsExecutor
-
-