File tree Expand file tree Collapse file tree
gcloud-java-compute/src/main/java/com/google/gcloud/compute Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -640,23 +640,21 @@ public boolean exists() throws ComputeException {
640640
641641 /**
642642 * Checks if this operation has completed its execution, either failing or succeeding. If the
643- * operation does not exist this method returns {@code false }. To correctly wait for operation's
644- * completion, check that the operation exists first using {@link #exists()} :
643+ * operation does not exist this method returns {@code true }. You can wait for operation
644+ * completion with :
645645 * <pre> {@code
646- * if (operation.exists()) {
647- * while(!operation.isDone()) {
648- * Thread.sleep(1000L);
649- * }
646+ * while(!operation.isDone()) {
647+ * Thread.sleep(1000L);
650648 * }}</pre>
651649 *
652- * @return {@code true} if this operation is in {@link Operation.Status#DONE} state, {@code false}
653- * if the state is not {@link Operation.Status#DONE} or the operation does not exist
650+ * @return {@code true} if this operation is in {@link Operation.Status#DONE} state or if it does
651+ * not exist, {@code false} if the state is not {@link Operation.Status#DONE}
654652 * @throws ComputeException upon failure
655653 */
656654 public boolean isDone () throws ComputeException {
657655 Operation operation =
658656 compute .get (operationId , Compute .OperationOption .fields (Compute .OperationField .STATUS ));
659- return operation != null && operation .status () == Status .DONE ;
657+ return operation == null || operation .status () == Status .DONE ;
660658 }
661659
662660 /**
You can’t perform that action at this time.
0 commit comments