> +
> + @Override
> + public void destroyNode(final String id) {
> + logger.debug("Destroying %s ...", id);
> + String storageAccountName = id.replaceAll("[^A-Za-z0-9 ]", "") +
> "storage";
> + int index = id.lastIndexOf("-");
> + String group = id.substring(0, index);
> +
> + // Delete VM
> + URI uri = api.getVirtualMachineApi(getGroupId()).delete(id);
> + if (uri != null){
> + boolean jobDone = Predicates2.retry(new Predicate<URI>() {
> + @Override public boolean apply(URI uri) {
> + return ParseJobStatus.JobStatus.DONE ==
> api.getJobApi().jobStatus(uri);
> + }
> + }, 60 * 10 * 1000 /* 5 minute timeout */).apply(uri);
Consider declaring all these predicates in the compute service module so they
can be easily reused. Also that will facilitate making the timeouts
configurable (they should be). Have a look at the DigitalOcean compute service
context module to see an example of how reusable predicates are defined and
injected.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/267/files/bae5d6dfcdb26e31057db4551c5996836666a31b#r63965622