Repository: googleapis/java-datastore
Pull request #1676 (2024-12-03 19:22:50)

Refactor: refactor code changes from maincopy
This pull request is generated with proto changes between [googleapis/googleapis@5257378](https://github.com/googleapis/googleapis/commit/5257378f52352e70b8995713f0d4484bdab7e71d) (exclusive) and [googleapis/googleapis@a547fc1](https://github.com/googleapis/googleapis/commit/a547fc1420eb0a0f3ae32b0a4eb72d3b8b17d136) (inclusive).

BEGIN_COMMIT_OVERRIDE
BEGIN_NESTED_COMMIT
fix(deps): update the Java code generator (gapic-generator-java) to 2.50.0
END_NESTED_COMMIT
END_COMMIT_OVERRIDE

generated-files-bot[bot]: <!-- probot comment [12634855]-->
*Warning*: This pull request is touching the following templated files:

* .github/sync-repo-settings.yaml
* .kokoro/presubmit/graalvm-native.cfg

Patch:
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 203f9eac..2afe7bfe 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,4 +1,5 @@
 version: 2
+
 updates:
   - package-ecosystem: "maven"
     directory: "/"
@@ -16,4 +17,4 @@ updates:
     # If a security vulnerability comes in, we will be notified about 
     # it via template in the synthtool repository.
     ignore:
-      - dependency-name: "*"
+      - dependency-name: "*"
\ No newline at end of file
diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml
index fce568dc..20364434 100644
--- a/.github/sync-repo-settings.yaml
+++ b/.github/sync-repo-settings.yaml
@@ -18,6 +18,8 @@ branchProtectionRules:
       - 'Kokoro - Test: Java GraalVM Native Image'
       - 'Kokoro - Test: Java 17 GraalVM Native Image'
       - javadoc
+      - library_generation
+      - unmanaged_dependency_check
   - pattern: 1.106.5-sp
     isAdminEnforced: true
     requiredApprovingReviewCount: 1
@@ -107,22 +109,6 @@ branchProtectionRules:
       - cla/google
       - 'Kokoro - Test: Java GraalVM Native Image'
       - 'Kokoro - Test: Java 17 GraalVM Native Image'
-  - pattern: V3-experimental
-    isAdminEnforced: true
-    requiredApprovingReviewCount: 1
-    requiresCodeOwnerReviews: true
-    requiresStrictStatusChecks: false
-    requiredStatusCheckContexts:
-      - dependencies (17)
-      - lint
-      - clirr
-      - units (8)
-      - units (11)
-      - 'Kokoro - Test: Integration'
-      - cla/google
-      - 'Kokoro - Test: Java GraalVM Native Image'
-      - 'Kokoro - Test: Java 17 GraalVM Native Image'
-      - javadoc
   - pattern: 2.15.x
     isAdminEnforced: true
     requiredApprovingReviewCount: 1
diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml
index 46b80edc..35aa3b15 100644
--- a/.github/workflows/hermetic_library_generation.yaml
+++ b/.github/workflows/hermetic_library_generation.yaml
@@ -37,7 +37,7 @@ jobs:
       with:
         fetch-depth: 0
         token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
-    - uses: googleapis/sdk-platform-java/.github/scripts@v2.49.0
+    - uses: googleapis/sdk-platform-java/.github/scripts@v2.50.0
       if: env.SHOULD_RUN == 'true'
       with:
         base_ref: ${{ github.base_ref }}
diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml
index f1796d28..0ee0f5aa 100644
--- a/.github/workflows/unmanaged_dependency_check.yaml
+++ b/.github/workflows/unmanaged_dependency_check.yaml
@@ -14,6 +14,6 @@ jobs:
       shell: bash
       run: .kokoro/build.sh
     - name: Unmanaged dependency check
-      uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.39.0
+      uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.40.0
       with:
         bom-path: google-cloud-datastore-bom/pom.xml
diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg
index e8c154f4..aabe0f1f 100644
--- a/.kokoro/presubmit/graalvm-native-17.cfg
+++ b/.kokoro/presubmit/graalvm-native-17.cfg
@@ -3,7 +3,7 @@
 # Configure the docker image for kokoro-trampoline.
 env_vars: {
   key: "TRAMPOLINE_IMAGE"
-  value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.39.0"
+  value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.40.0"
 }
 
 env_vars: {
diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg
index 046dc8df..4b9610ff 100644
--- a/.kokoro/presubmit/graalvm-native.cfg
+++ b/.kokoro/presubmit/graalvm-native.cfg
@@ -3,7 +3,7 @@
 # Configure the docker image for kokoro-trampoline.
 env_vars: {
   key: "TRAMPOLINE_IMAGE"
-  value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.39.0"
+  value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.40.0"
 }
 
 env_vars: {
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36d4e90c..07cf43d6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 # Changelog
 
+## [2.24.3](https://github.com/googleapis/java-datastore/compare/v2.24.2...v2.24.3) (2024-11-18)
+
+
+### Dependencies
+
+* Update sdk platform java dependencies ([#1662](https://github.com/googleapis/java-datastore/issues/1662)) ([b4d3ab9](https://github.com/googleapis/java-datastore/commit/b4d3ab9a72bb2a4dff59bf54abcc5d9536b2596b))
+
 ## [2.24.2](https://github.com/googleapis/java-datastore/compare/v2.24.1...v2.24.2) (2024-11-06)
 
 
diff --git a/generation_config.yaml b/generation_config.yaml
index 273697bc..b9de0b01 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,5 +1,5 @@
-gapic_generator_version: 2.49.0
-googleapis_commitish: 5257378f52352e70b8995713f0d4484bdab7e71d
+gapic_generator_version: 2.50.0
+googleapis_commitish: a547fc1420eb0a0f3ae32b0a4eb72d3b8b17d136
 libraries_bom_version: 26.50.0
 libraries:
   - api_shortname: datastore
diff --git a/google-cloud-datastore-bom/pom.xml b/google-cloud-datastore-bom/pom.xml
index 6d426af8..4f4cb251 100644
--- a/google-cloud-datastore-bom/pom.xml
+++ b/google-cloud-datastore-bom/pom.xml
@@ -8,7 +8,7 @@
   <parent>
     <groupId>com.google.cloud</groupId>
     <artifactId>sdk-platform-java-config</artifactId>
-    <version>3.39.0</version>
+    <version>3.40.0</version>
   </parent>
 
   <name>Google Cloud datastore BOM</name>
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java
index cafef310..4db454e2 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java
@@ -117,7 +117,7 @@ import javax.annotation.Generated;
  *         RetrySettings.newBuilder()
  *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
  *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
+ *             .setMaxRetryDelayDuration(Duration.ofMillis(5000))
  *             .setTotalTimeoutDuration(Duration.ofHours(24))
  *             .build());
  * datastoreAdminSettingsBuilder
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java
index 82df00c0..aa10d582 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java
@@ -67,9 +67,9 @@ import com.google.datastore.admin.v1.ListIndexesResponse;
 import com.google.longrunning.Operation;
 import com.google.protobuf.Empty;
 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.
 /**
@@ -138,7 +138,7 @@ import org.threeten.bp.Duration;
  *         RetrySettings.newBuilder()
  *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
  *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
+ *             .setMaxRetryDelayDuration(Duration.ofMillis(5000))
  *             .setTotalTimeoutDuration(Duration.ofHours(24))
  *             .build());
  * datastoreAdminSettingsBuilder
@@ -449,21 +449,21 @@ public class DatastoreAdminStubSettings extends StubSettings<DatastoreAdminStubS
       RetrySettings settings = null;
       settings =
           RetrySettings.newBuilder()
-              .setInitialRpcTimeout(Duration.ofMillis(60000L))
+              .setInitialRpcTimeoutDuration(Duration.ofMillis(60000L))
               .setRpcTimeoutMultiplier(1.0)
-              .setMaxRpcTimeout(Duration.ofMillis(60000L))
-              .setTotalTimeout(Duration.ofMillis(60000L))
+              .setMaxRpcTimeoutDuration(Duration.ofMillis(60000L))
+              .setTotalTimeoutDuration(Duration.ofMillis(60000L))
               .build();
       definitions.put("no_retry_0_params", settings);
       settings =
           RetrySettings.newBuilder()
-              .setInitialRetryDelay(Duration.ofMillis(100L))
+              .setInitialRetryDelayDuration(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.3)
-              .setMaxRetryDelay(Duration.ofMillis(60000L))
-              .setInitialRpcTimeout(Duration.ofMillis(60000L))
+              .setMaxRetryDelayDuration(Duration.ofMillis(60000L))
+              .setInitialRpcTimeoutDuration(Duration.ofMillis(60000L))
               .setRpcTimeoutMultiplier(1.0)
-              .setMaxRpcTimeout(Duration.ofMillis(60000L))
-              .setTotalTimeout(Duration.ofMillis(60000L))
+              .setMaxRpcTimeoutDuration(Duration.ofMillis(60000L))
+              .setTotalTimeoutDuration(Duration.ofMillis(60000L))
               .build();
       definitions.put("retry_policy_1_params", settings);
       RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -592,13 +592,13 @@ public class DatastoreAdminStubSettings extends StubSettings<DatastoreAdminStubS
           .setPollingAlgorithm(
               OperationTimedPollAlgorithm.create(
                   RetrySettings.newBuilder()
-                      .setInitialRetryDelay(Duration.ofMillis(5000L))
+                      .setInitialRetryDelayDuration(Duration.ofMillis(5000L))
                       .setRetryDelayMultiplier(1.5)
-                      .setMaxRetryDelay(Duration.ofMillis(45000L))
-                      .setInitialRpcTimeout(Duration.ZERO)
+                      .setMaxRetryDelayDuration(Duration.ofMillis(45000L))
+                      .setInitialRpcTimeoutDuration(Duration.ZERO)
                       .setRpcTimeoutMultiplier(1.0)
-                      .setMaxRpcTimeout(Duration.ZERO)
-                      .setTotalTimeout(Duration.ofMillis(300000L))
+                      .setMaxRpcTimeoutDuration(Duration.ZERO)
+                      .setTotalTimeoutDuration(Duration.ofMillis(300000L))
                       .build()));
 
       builder
@@ -616,13 +616,13 @@ public class DatastoreAdminStubSettings extends StubSettings<DatastoreAdminStubS
           .setPollingAlgorithm(
               OperationTimedPollAlgorithm.create(
                   RetrySettings.newBuilder()
-                      .setInitialRetryDelay(Duration.ofMillis(5000L))
+                      .setInitialRetryDelayDuration(Duration.ofMillis(5000L))
                       .setRetryDelayMultiplier(1.5)
-                      .setMaxRetryDelay(Duration.ofMillis(45000L))
-                      .setInitialRpcTimeout(Duration.ZERO)
+                      .setMaxRetryDelayDuration(Duration.ofMillis(45000L))
+                      .setInitialRpcTimeoutDuration(Duration.ZERO)
                       .setRpcTimeoutMultiplier(1.0)
-                      .setMaxRpcTimeout(Duration.ZERO)
-                      .setTotalTimeout(Duration.ofMillis(300000L))
+                      .setMaxRpcTimeoutDuration(Duration.ZERO)
+                      .setTotalTimeoutDuration(Duration.ofMillis(300000L))
                       .build()));
 
       builder
@@ -639,13 +639,13 @@ public class DatastoreAdminStubSettings extends StubSettings<DatastoreAdminStubS
           .setPollingAlgorithm(
               OperationTimedPollAlgorithm.create(
                   RetrySettings.newBuilder()
-                      .setInitialRetryDelay(Duration.ofMillis(5000L))
+                      .setInitialRetryDelayDuration(Duration.ofMillis(5000L))
                       .setRetryDelayMultiplier(1.5)
-                      .setMaxRetryDelay(Duration.ofMillis(45000L))
-                      .setInitialRpcTimeout(Duration.ZERO)
+                      .setMaxRetryDelayDuration(Duration.ofMillis(45000L))
+                      .setInitialRpcTimeoutDuration(Duration.ZERO)
                       .setRpcTimeoutMultiplier(1.0)
-                      .setMaxRpcTimeout(Duration.ZERO)
-                      .setTotalTimeout(Duration.ofMillis(300000L))
+                      .setMaxRpcTimeoutDuration(Duration.ZERO)
+                      .setTotalTimeoutDuration(Duration.ofMillis(300000L))
                       .build()));
 
       builder
@@ -662,13 +662,13 @@ public class DatastoreAdminStubSettings extends StubSettings<DatastoreAdminStubS
           .setPollingAlgorithm(
               OperationTimedPollAlgorithm.create(
                   RetrySettings.newBuilder()
-                      .setInitialRetryDelay(Duration.ofMillis(5000L))
+                      .setInitialRetryDelayDuration(Duration.ofMillis(5000L))
                       .setRetryDelayMultiplier(1.5)
-                      .setMaxRetryDelay(Duration.ofMillis(45000L))
-                      .setInitialRpcTimeout(Duration.ZERO)
+                      .setMaxRetryDelayDuration(Duration.ofMillis(45000L))
+                      .setInitialRpcTimeoutDuration(Duration.ZERO)
                       .setRpcTimeoutMultiplier(1.0)
-                      .setMaxRpcTimeout(Duration.ZERO)
-                      .setTotalTimeout(Duration.ofMillis(300000L))
+                      .setMaxRpcTimeoutDuration(Duration.ZERO)
+                      .setTotalTimeoutDuration(Duration.ofMillis(300000L))
                       .build()));
 
       return builder;
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java
index 52184a01..6738d84e 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java
@@ -15,25 +15,27 @@
  */
 package com.google.cloud.datastore.models;
 
+import static com.google.api.gax.util.TimeConversionUtils.toThreetenDuration;
+
 import com.google.api.core.BetaApi;
 import com.google.api.core.InternalApi;
+import com.google.api.core.ObsoleteApi;
 import com.google.cloud.Structs;
 import com.google.common.base.Objects;
 import java.util.Map;
-import org.threeten.bp.Duration;
 
 /** Model class for {@link com.google.datastore.v1.ExecutionStats} */
 @BetaApi
 public class ExecutionStats {
   private final long resultsReturned;
-  private final Duration executionDuration;
+  private final java.time.Duration executionDuration;
   private final long readOperations;
   private final Map<String, Object> debugStats;
 
   @InternalApi
   public ExecutionStats(com.google.datastore.v1.ExecutionStats proto) {
     this.resultsReturned = proto.getResultsReturned();
-    this.executionDuration = Duration.ofNanos(proto.getExecutionDuration().getNanos());
+    this.executionDuration = java.time.Duration.ofNanos(proto.getExecutionDuration().getNanos());
     this.readOperations = proto.getReadOperations();
     this.debugStats = Structs.asMap(proto.getDebugStats());
   }
@@ -51,8 +53,14 @@ public class ExecutionStats {
     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/v1/stub/DatastoreStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java
index 53158ec5..12a1b177 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.RunAggregationQueryResponse;
 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 class DatastoreStubSettings extends StubSettings<DatastoreStubSettings> {
       RetrySettings settings = null;
       settings =
           RetrySettings.newBuilder()
-              .setInitialRetryDelay(Duration.ofMillis(100L))
+              .setInitialRetryDelayDuration(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.3)
-              .setMaxRetryDelay(Duration.ofMillis(60000L))
-              .setInitialRpcTimeout(Duration.ofMillis(60000L))
+              .setMaxRetryDelayDuration(Duration.ofMillis(60000L))
+              .setInitialRpcTimeoutDuration(Duration.ofMillis(60000L))
               .setRpcTimeoutMultiplier(1.0)
-              .setMaxRpcTimeout(Duration.ofMillis(60000L))
-              .setTotalTimeout(Duration.ofMillis(60000L))
+              .setMaxRpcTimeoutDuration(Duration.ofMillis(60000L))
+              .setTotalTimeoutDuration(Duration.ofMillis(60000L))
               .build();
       definitions.put("retry_policy_0_params", settings);
       settings =
           RetrySettings.newBuilder()
-              .setInitialRpcTimeout(Duration.ofMillis(60000L))
+              .setInitialRpcTimeoutDuration(Duration.ofMillis(60000L))
               .setRpcTimeoutMultiplier(1.0)
-              .setMaxRpcTimeout(Duration.ofMillis(60000L))
-              .setTotalTimeout(Duration.ofMillis(60000L))
+              .setMaxRpcTimeoutDuration(Duration.ofMillis(60000L))
+              .setTotalTimeoutDuration(Duration.ofMillis(60000L))
               .build();
       definitions.put("no_retry_1_params", settings);
       RETRY_PARAM_DEFINITIONS = definitions.build();
diff --git a/pom.xml b/pom.xml
index 1b19ec4f..aec03ebc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
   <parent>
     <groupId>com.google.cloud</groupId>
     <artifactId>sdk-platform-java-config</artifactId>
-    <version>3.39.0</version>
+    <version>3.40.0</version>
   </parent>
 
   <developers>


Test patch:
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 4dcf2c95..15e73a6b 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.List;
 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 class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
     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 class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
    *     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.
    *
    * <p>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 class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
    * <p>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/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java
index 1f421d87..cb242f2a 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java
@@ -20,12 +20,12 @@ import com.google.cloud.datastore.testing.LocalDatastoreHelper;
 import com.google.cloud.grpc.GrpcTransportOptions;
 import com.google.common.truth.Truth;
 import java.io.IOException;
+import java.time.Duration;
 import java.util.Arrays;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.threeten.bp.Duration;
 
 @RunWith(Parameterized.class)
 public class DatastoreTestGrpc extends AbstractDatastoreTest {
@@ -56,6 +56,6 @@ public class DatastoreTestGrpc extends AbstractDatastoreTest {
   public static void afterClass() throws Exception {
     datastore.close();
     Truth.assertThat(datastore.isClosed()).isTrue();
-    helper.stop(Duration.ofMinutes(1));
+    helper.stopDuration(Duration.ofMinutes(1));
   }
 }
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java
index 245f68a1..a73cae8e 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java
@@ -19,12 +19,12 @@ package com.google.cloud.datastore;
 import com.google.cloud.datastore.testing.LocalDatastoreHelper;
 import com.google.cloud.grpc.GrpcTransportOptions;
 import java.io.IOException;
+import java.time.Duration;
 import java.util.Arrays;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.threeten.bp.Duration;
 
 @RunWith(Parameterized.class)
 public class DatastoreTestHttp extends AbstractDatastoreTest {
@@ -52,6 +52,6 @@ public class DatastoreTestHttp extends AbstractDatastoreTest {
 
   @AfterClass
   public static void afterClass() throws Exception {
-    helper.stop(Duration.ofMinutes(1));
+    helper.stopDuration(Duration.ofMinutes(1));
   }
 }
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java
index 66822bd9..52e76016 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java
@@ -85,6 +85,7 @@ import com.google.common.collect.Range;
 import com.google.common.truth.Truth;
 import com.google.datastore.v1.TransactionOptions;
 import com.google.datastore.v1.TransactionOptions.ReadOnly;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -105,7 +106,6 @@ import org.junit.Test;
 import org.junit.rules.Timeout;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.threeten.bp.Duration;
 
 @RunWith(Parameterized.class)
 public abstract class AbstractITDatastoreTest {
@@ -649,7 +649,7 @@ public abstract class AbstractITDatastoreTest {
     Truth.assertThat(debugStats.get("index_entries_scanned"))
         .isEqualTo(expectedIndexEntriesScanned);
 
-    Duration executionDuration = executionStats.getExecutionDuration();
+    Duration executionDuration = executionStats.getExecutionDurationJavaTime();
     Truth.assertThat(executionDuration).isIn(Range.greaterThan(Duration.ofMillis(0)));
 
     long readOperations = executionStats.getReadOperations();
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java
index 4706e3b8..a0e778ce 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java
@@ -41,8 +41,8 @@ public class ExecutionStatsTest {
   @Test
   public void testModel() {
     Truth.assertThat(executionStats.getDebugStats()).isEqualTo(Structs.asMap(struct));
-    Truth.assertThat(executionStats.getExecutionDuration())
-        .isEqualTo(org.threeten.bp.Duration.ofNanos(duration.getNanos()));
+    Truth.assertThat(executionStats.getExecutionDurationJavaTime())
+        .isEqualTo(java.time.Duration.ofNanos(duration.getNanos()));
     Truth.assertThat(executionStats.getReadOperations()).isEqualTo(2);
     Truth.assertThat(executionStats.getResultsReturned()).isEqualTo(3);
   }
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java
index 76fd0058..f8134825 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java
@@ -21,8 +21,8 @@ import static com.google.common.truth.Truth.assertThat;
 import com.google.api.gax.retrying.RetrySettings;
 import com.google.api.gax.rpc.UnaryCallSettings;
 import com.google.cloud.datastore.DatastoreOptions;
+import java.time.Duration;
 import org.junit.Test;
-import org.threeten.bp.Duration;
 
 public class RpcUtilsTest {
 
@@ -40,9 +40,9 @@ public class RpcUtilsTest {
     // datastoreOptions with custom retry settings
     RetrySettings customRetrySettings =
         RetrySettings.newBuilder()
-            .setTotalTimeout(Duration.ofMinutes(2))
-            .setInitialRpcTimeout(Duration.ofSeconds(5))
-            .setMaxRpcTimeout(Duration.ofSeconds(10))
+            .setTotalTimeoutDuration(Duration.ofMinutes(2))
+            .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+            .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
             .setRetryDelayMultiplier(1.5)
             .setMaxAttempts(5)
             .build();
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java
index 8359eb04..155dfed6 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java
@@ -36,6 +36,7 @@ import com.google.cloud.http.HttpTransportOptions;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.time.Duration;
 import java.util.concurrent.TimeoutException;
 import org.junit.After;
 import org.junit.Assert;
@@ -43,7 +44,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
 
 @RunWith(JUnit4.class)
 public class ITLocalDatastoreHelperTest {
@@ -199,7 +199,7 @@ public class ITLocalDatastoreHelperTest {
       assertNotNull(datastore.get(key));
       helper.reset();
       assertNull(datastore.get(key));
-      helper.stop(Duration.ofMinutes(1));
+      helper.stopDuration(Duration.ofMinutes(1));
       datastore.get(key);
       Assert.fail();
     } catch (DatastoreException ex) {
@@ -219,7 +219,7 @@ public class ITLocalDatastoreHelperTest {
       assertNotNull(datastore.get(key));
       helper.reset();
       assertNull(datastore.get(key));
-      helper.stop(Duration.ofMinutes(1));
+      helper.stopDuration(Duration.ofMinutes(1));
       datastore.get(key);
       Assert.fail();
     } catch (DatastoreException ex) {
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java
index c35cbf66..0321b63d 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java
@@ -29,9 +29,9 @@ import com.google.cloud.datastore.StructuredQuery;
 import com.google.cloud.grpc.GrpcTransportOptions;
 import com.google.cloud.http.HttpTransportOptions;
 import io.opentelemetry.sdk.OpenTelemetrySdk;
+import java.time.Duration;
 import java.util.UUID;
 import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
 
 /**
  * Utility to create a remote datastore configuration for testing. Datastore options can be obtained
@@ -131,13 +131,13 @@ public class RemoteDatastoreHelper {
   private static RetrySettings retrySettings() {
     return RetrySettings.newBuilder()
         .setMaxAttempts(10)
-        .setMaxRetryDelay(Duration.ofMillis(30000L))
-        .setTotalTimeout(Duration.ofMillis(120000L))
-        .setInitialRetryDelay(Duration.ofMillis(250L))
+        .setMaxRetryDelayDuration(Duration.ofMillis(30000L))
+        .setTotalTimeoutDuration(Duration.ofMillis(120000L))
+        .setInitialRetryDelayDuration(Duration.ofMillis(250L))
         .setRetryDelayMultiplier(1.0)
-        .setInitialRpcTimeout(Duration.ofMillis(120000L))
+        .setInitialRpcTimeoutDuration(Duration.ofMillis(120000L))
         .setRpcTimeoutMultiplier(1.0)
-        .setMaxRpcTimeout(Duration.ofMillis(120000L))
+        .setMaxRpcTimeoutDuration(Duration.ofMillis(120000L))
         .build();
   }
 }
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 045b16a9..33aa63ab 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.Test;
 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 class ConceptsTest {
    */
   @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) {