getDebugStats() {
return debugStats;
}
+ /** This method is obsolete. Use {@link #getExecutionDurationJavaTime()} instead. */
+ @ObsoleteApi("Use getExecutionDurationJavaTime() instead")
+ public org.threeten.bp.Duration getExecutionDuration() {
+ return toThreetenDuration(getExecutionDurationJavaTime());
+ }
+
/** Returns the total time to execute the query in the backend. */
- public Duration getExecutionDuration() {
+ public java.time.Duration getExecutionDurationJavaTime() {
return executionDuration;
}
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
index 4dcf2c953..15e73a6b6 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
@@ -16,9 +16,11 @@
package com.google.cloud.datastore.testing;
+import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeDuration;
import static com.google.common.base.MoreObjects.firstNonNull;
import com.google.api.core.InternalApi;
+import com.google.api.core.ObsoleteApi;
import com.google.cloud.NoCredentials;
import com.google.cloud.ServiceOptions;
import com.google.cloud.datastore.DatastoreOptions;
@@ -39,7 +41,6 @@
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
-import org.threeten.bp.Duration;
/**
* Utility to start and stop local Google Cloud Datastore emulators.
@@ -316,6 +317,14 @@ public void reset() throws IOException {
sendPostRequest("/reset");
}
+ /** This method is obsolete. Use {@link #stopDuration(java.time.Duration)} instead */
+ @ObsoleteApi("Use stopDuration(java.time.Duration) instead")
+ @Override
+ public void stop(org.threeten.bp.Duration timeout)
+ throws IOException, InterruptedException, TimeoutException {
+ stopDuration(toJavaTimeDuration(timeout));
+ }
+
/**
* Stops the Datastore emulator.
*
@@ -328,15 +337,16 @@ public void reset() throws IOException {
* this value high to ensure proper shutdown, like 5 seconds or more.
*/
@Override
- public void stop(Duration timeout) throws IOException, InterruptedException, TimeoutException {
+ public void stopDuration(java.time.Duration timeout)
+ throws IOException, InterruptedException, TimeoutException {
sendPostRequest("/shutdown");
- waitForProcess(timeout);
+ waitForProcessDuration(timeout);
deleteRecursively(gcdPath);
}
/**
- * Stops the Datastore emulator. The same as {@link #stop(Duration)} but with timeout duration of
- * 20 seconds.
+ * Stops the Datastore emulator. The same as {@link #stopDuration(java.time.Duration)} but with
+ * timeout duration of 20 seconds.
*
* It is important to stop the emulator. Since the emulator runs in its own process, not
* stopping it might cause it to become orphan.
@@ -344,7 +354,7 @@ public void stop(Duration timeout) throws IOException, InterruptedException, Tim
*
It is not required to call {@link #reset()} before {@code stop()}.
*/
public void stop() throws IOException, InterruptedException, TimeoutException {
- stop(Duration.ofSeconds(20));
+ stopDuration(java.time.Duration.ofSeconds(20));
}
static void deleteRecursively(Path path) throws IOException {
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java
index 53158ec52..12a1b177e 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java
@@ -56,9 +56,9 @@
import com.google.datastore.v1.RunQueryRequest;
import com.google.datastore.v1.RunQueryResponse;
import java.io.IOException;
+import java.time.Duration;
import java.util.List;
import javax.annotation.Generated;
-import org.threeten.bp.Duration;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
@@ -328,21 +328,21 @@ public static class Builder extends StubSettings.Builder
com.google.cloud
sdk-platform-java-config
- 3.39.0
+ 3.40.0
diff --git a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
index 045b16a9a..33aa63ab4 100644
--- a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
+++ b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
@@ -77,7 +77,6 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
/** Contains Cloud Datastore snippets demonstrating concepts for documentation. */
@RunWith(JUnit4.class)
@@ -147,7 +146,7 @@ public void tearDown() throws Exception {
*/
@AfterClass
public static void afterClass() throws IOException, InterruptedException, TimeoutException {
- HELPER.stop(Duration.ofMinutes(1));
+ HELPER.stopDuration(java.time.Duration.ofMinutes(1));
}
private void assertValidKey(Key taskKey) {