Skip to content

Commit

Permalink
One more throw and snippet.
Browse files Browse the repository at this point in the history
  • Loading branch information
mderka committed Apr 4, 2016
1 parent 8ad3e89 commit 0f3dc9a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions gcloud-java-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,20 @@ while (recordSetIterator.hasNext()) {

// Build and apply the change request to our zone
ChangeRequestInfo changeRequest = changeBuilder.build();
zone.applyChangeRequest(changeRequest);
ChangeRequest pendingRequest = zone.applyChangeRequest(changeRequest);
```
You can find more information about changes in the [Cloud DNS documentation] (https://cloud.google.com/dns/what-is-cloud-dns#cloud_dns_api_concepts).

When the change request is applied, it is registered with the Cloud DNS service for processing. We
can wait for its completion as follows:

```java
while (ChangeRequestInfo.Status.PENDING.equals(changeRequest.status())) {
while (!pendingRequest.isDone()) {
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
System.err.println("The thread was interrupted while waiting...");
}
changeRequest = dns.getChangeRequest(zone.name(), changeRequest.generatedId());
}
System.out.println("The change request has been applied.");
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public Dns dns() {

/**
* Applies this change request to the zone identified by {@code zoneName}.
*
* @throws DnsException upon failure or if zone is not found
*/
public ChangeRequest applyTo(String zoneName, Dns.ChangeRequestOption... options) {
return dns.applyChangeRequest(zoneName, this, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public static ChangeRequestListOption sortOrder(SortingOrder order) {
* servers. The fields to be returned can be selected by {@link ChangeRequestOption}s.
*
* @return the new {@link ChangeRequest}
* @throws DnsException upon failure if zone is not found
* @throws DnsException upon failure or if zone is not found
* @see <a href="https://cloud.google.com/dns/api/v1/changes/create">Cloud DNS Changes: create</a>
*/
ChangeRequest applyChangeRequest(String zoneName, ChangeRequestInfo changeRequest,
Expand Down

0 comments on commit 0f3dc9a

Please sign in to comment.