It would be something like:
```java
Predicate<Server> blockUntilRunning = Predicates2.retry(new Predicate<Server>()
{
@Override
public boolean apply(Server input){
Server refreshed = api.serversApi().getServer(input.getServerId());
return VirtualMachineState.RUNNING == refreshed.getVirtualMachineState();
}
}, 60l, 2l, 360l, TimeUnit.SECONDS);
blockUntilRunning.apply(serverToWaitFor);
```
Take into account, though, that as long as you can return the
`NodeAndInitialCredentials` object with enough data you don't have to actively
wait in the implementation of the compute service adapter.
jclouds will transform the object you returned into a `NodeMetadata` using the
[ServerToNodeMetadata](https://github.com/devcsrj/jclouds-labs/blob/master/profitbricks-c2/src/main/java/org/jclouds/profitbricks/functions/ServerToNodeMetadata.java)
function, and poll the status of that node until it is running. You don't have
to wait in the adapter as jclouds will already wait until the node is running.
Just make sure that what you return in the `listNodes` and the
`createNodeWithGroupEncodedIntoName` methods can be transformed into a
`NodeMetadata` using the mentioned function (and make sure the status is
properly populated).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/72#issuecomment-55094434