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 Sat, 02 Aug 2014 14:52:35 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);

> It seemed correct to me allowing interruption

Given the time these operations can take, that makes sense to me too. But from what I recall
we catch `InterruptedException` in GlacierBlobstore and rethrow as a RuntimeException, so
we don't really give you that much "nice" control as a user.

In any case, would it make sense to document (probably on GlacierBlobstore) that it is "safe"
to interrupt the long-running operations, and giving a code example (in the Javadocs or jclouds-examples)
showing how to do that..?

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