@@ -52,7 +52,6 @@ public class Operation implements Serializable {
52
52
private final ComputeOptions options ;
53
53
private final String id ;
54
54
private final OperationId operationId ;
55
- private final Long creationTimestamp ;
56
55
private final String clientOperationId ;
57
56
private final String operationType ;
58
57
private final String targetLink ;
@@ -296,7 +295,6 @@ static final class Builder {
296
295
297
296
private Compute compute ;
298
297
private String id ;
299
- private Long creationTimestamp ;
300
298
private OperationId operationId ;
301
299
private String clientOperationId ;
302
300
private String operationType ;
@@ -324,9 +322,6 @@ static final class Builder {
324
322
if (operationPb .getId () != null ) {
325
323
id = operationPb .getId ().toString ();
326
324
}
327
- if (operationPb .getCreationTimestamp () != null ) {
328
- creationTimestamp = TIMESTAMP_FORMATTER .parseMillis (operationPb .getCreationTimestamp ());
329
- }
330
325
if (RegionOperationId .matchesUrl (operationPb .getSelfLink ())) {
331
326
operationId = RegionOperationId .fromUrl (operationPb .getSelfLink ());
332
327
} else if (ZoneOperationId .matchesUrl (operationPb .getSelfLink ())) {
@@ -372,11 +367,6 @@ Builder id(String id) {
372
367
return this ;
373
368
}
374
369
375
- Builder creationTimestamp (Long creationTimestamp ) {
376
- this .creationTimestamp = creationTimestamp ;
377
- return this ;
378
- }
379
-
380
370
Builder operationId (OperationId operationId ) {
381
371
this .operationId = checkNotNull (operationId );
382
372
return this ;
@@ -471,7 +461,6 @@ private Operation(Builder builder) {
471
461
this .compute = checkNotNull (builder .compute );
472
462
this .options = compute .options ();
473
463
this .id = builder .id ;
474
- this .creationTimestamp = builder .creationTimestamp ;
475
464
this .operationId = checkNotNull (builder .operationId );
476
465
this .clientOperationId = builder .clientOperationId ;
477
466
this .operationType = builder .operationType ;
@@ -505,13 +494,6 @@ public String id() {
505
494
return id ;
506
495
}
507
496
508
- /**
509
- * Returns the creation timestamp in milliseconds since epoch.
510
- */
511
- public Long creationTimestamp () {
512
- return creationTimestamp ;
513
- }
514
-
515
497
/**
516
498
* Returns the operation's identity. This method returns an {@link GlobalOperationId} for global
517
499
* operations, a {@link RegionOperationId} for region operations and a {@link ZoneOperationId} for
@@ -658,23 +640,21 @@ public boolean exists() throws ComputeException {
658
640
659
641
/**
660
642
* Checks if this operation has completed its execution, either failing or succeeding. If the
661
- * operation does not exist this method returns {@code false }. To correctly wait for operation's
662
- * 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 :
663
645
* <pre> {@code
664
- * if (operation.exists()) {
665
- * while(!operation.isDone()) {
666
- * Thread.sleep(1000L);
667
- * }
646
+ * while(!operation.isDone()) {
647
+ * Thread.sleep(1000L);
668
648
* }}</pre>
669
649
*
670
- * @return {@code true} if this operation is in {@link Operation.Status#DONE} state, {@code false}
671
- * 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}
672
652
* @throws ComputeException upon failure
673
653
*/
674
654
public boolean isDone () throws ComputeException {
675
655
Operation operation =
676
656
compute .get (operationId , Compute .OperationOption .fields (Compute .OperationField .STATUS ));
677
- return operation != null && operation .status () == Status .DONE ;
657
+ return operation == null || operation .status () == Status .DONE ;
678
658
}
679
659
680
660
/**
@@ -705,7 +685,6 @@ public String toString() {
705
685
return MoreObjects .toStringHelper (this )
706
686
.add ("id" , id )
707
687
.add ("operationsId" , operationId )
708
- .add ("creationTimestamp" , creationTimestamp )
709
688
.add ("clientOperationId" , clientOperationId )
710
689
.add ("operationType" , operationType )
711
690
.add ("targetLink" , targetLink )
@@ -743,9 +722,6 @@ com.google.api.services.compute.model.Operation toPb() {
743
722
if (id != null ) {
744
723
operationPb .setId (new BigInteger (id ));
745
724
}
746
- if (creationTimestamp != null ) {
747
- operationPb .setCreationTimestamp (TIMESTAMP_FORMATTER .print (creationTimestamp ));
748
- }
749
725
operationPb .setName (operationId .operation ());
750
726
operationPb .setClientOperationId (clientOperationId );
751
727
switch (operationId .type ()) {
0 commit comments