com.amazonaws.waiters.FixedDelayStrategy Java Examples
The following examples show how to use
com.amazonaws.waiters.FixedDelayStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomAmazonWaiterProvider.java From cloudbreak with Apache License 2.0 | 6 votes |
public Waiter<DescribeAutoScalingGroupsRequest> getAutoscalingInstancesInServiceWaiter(AmazonAutoScalingClient asClient, Integer requiredCount) { return new WaiterBuilder<DescribeAutoScalingGroupsRequest, DescribeAutoScalingGroupsResult>() .withSdkFunction(new DescribeAutoScalingGroupsFunction(asClient)) .withAcceptors(new WaiterAcceptor<DescribeAutoScalingGroupsResult>() { @Override public boolean matches(DescribeAutoScalingGroupsResult describeAutoScalingGroupsResult) { return describeAutoScalingGroupsResult.getAutoScalingGroups().get(0).getInstances() .stream().filter(instance -> IN_SERVICE.equals(instance.getLifecycleState())).count() == requiredCount; } @Override public WaiterState getState() { return WaiterState.SUCCESS; } }) .withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(DEFAULT_MAX_ATTEMPTS), new FixedDelayStrategy(DEFAULT_DELAY_IN_SECONDS))) .withExecutorService(WaiterExecutorServiceFactory.buildExecutorServiceForWaiter("AmazonRDSWaiters")).build(); }
Example #2
Source File: ECSService.java From amazon-ecs-plugin with MIT License | 5 votes |
public void waitForTasksRunning(String tasksArn, String clusterArn, long timeoutInMillis, int DelayBetweenPollsInSeconds) { final AmazonECS client = clientSupplier.get(); Waiter<DescribeTasksRequest> describeTaskWaiter = new AmazonECSWaiters(client).tasksRunning(); describeTaskWaiter.run(new WaiterParameters<DescribeTasksRequest>( new DescribeTasksRequest() .withTasks(tasksArn) .withCluster(clusterArn) .withSdkClientExecutionTimeout((int)timeoutInMillis)) .withPollingStrategy(new PollingStrategy(new MaxTimeRetryStrategy(timeoutInMillis), new FixedDelayStrategy(DelayBetweenPollsInSeconds)))); }
Example #3
Source File: EventPrinter.java From pipeline-aws-plugin with Apache License 2.0 | 4 votes |
private PollingStrategy pollingStrategy(PollConfiguration pollConfiguration) { int pollIntervalSeconds = (int) (pollConfiguration.getPollInterval().toMillis() / 1000L); this.listener.getLogger().println("Setting up a polling strategy to poll every " + pollConfiguration.getPollInterval() + " for a maximum of " + pollConfiguration.getTimeout()); return new PollingStrategy(new TimeOutRetryStrategy(pollConfiguration.getTimeout()), new FixedDelayStrategy(pollIntervalSeconds)); }