jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Phillips <notificati...@github.com>
Subject Re: [jclouds-labs-aws] JCLOUDS-457: Add polling strategy (#44)
Date Sun, 03 Aug 2014 07:31:18 GMT
> +   }
> +
> +   @Inject
> +   public BasePollingStrategy(GlacierClient client) {
> +      this(DEFAULT_INITIAL_WAIT, DEFAULT_TIME_BETWEEN_POLLS, client);
> +   }
> +
> +   private boolean inProgress(String job, String vault) {
> +      JobMetadata jobMetadata = client.describeJob(vault, job);
> +      return (jobMetadata != null) && (jobMetadata.getStatusCode() == JobStatus.IN_PROGRESS);
> +   }
> +
> +   private void waitForJob(String job, String vault) throws InterruptedException {
> +      Thread.sleep(initialWait);
> +      while (inProgress(job, vault)) {
> +         Thread.sleep(timeBetweenPolls);

> Do you think I should do this in the javadoc, or maybe in the readme/getting started
guide?

I would say the Javadoc should simply say "this method can be long-running and can be interrupted"
for those methods where that is appropriate.

The Getting Started Guide should describe the provider in general, and also explain that the
operations are long-running and can be interrupted. It could say something like "see the Javadoc
to find out which methods can be interrupted", and perhaps give an example of how that could
be done.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/44/files#r15733330
Mime
View raw message