diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java index ba8e57cde..9b892b14e 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java @@ -19,6 +19,7 @@ import com.google.bigtable.v2.ReadChangeStreamResponse; import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange; import com.google.protobuf.ByteString; +import java.time.Instant; import javax.annotation.Nonnull; /** @@ -115,7 +116,7 @@ interface ChangeStreamRecordBuilder { void startUserMutation( @Nonnull ByteString rowKey, @Nonnull String sourceClusterId, - java.time.Instant commitTimestamp, + Instant commitTimestamp, int tieBreaker); /** @@ -123,8 +124,7 @@ void startUserMutation( * once. If called, the current change stream record must not include any close stream message * or heartbeat. */ - void startGcMutation( - @Nonnull ByteString rowKey, java.time.Instant commitTimestamp, int tieBreaker); + void startGcMutation(@Nonnull ByteString rowKey, Instant commitTimestamp, int tieBreaker); /** Called to add a DeleteFamily mod. */ void deleteFamily(@Nonnull String familyName); @@ -177,7 +177,7 @@ void mergeToCell( /** Called once per stream record to signal that all mods have been processed (unless reset). */ ChangeStreamRecordT finishChangeStreamMutation( - @Nonnull String token, java.time.Instant estimatedLowWatermark); + @Nonnull String token, Instant estimatedLowWatermark); /** Called when the current in progress change stream record should be dropped */ void reset(); diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java index c28482a0a..217caa93f 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java @@ -112,8 +112,7 @@ public void startUserMutation( /** {@inheritDoc} */ @Override - public void startGcMutation( - ByteString rowKey, java.time.Instant commitTimestamp, int tieBreaker) { + public void startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker) { this.changeStreamMutationBuilder = ChangeStreamMutation.createGcMutation(rowKey, commitTimestamp, tieBreaker); } @@ -176,7 +175,7 @@ public void finishCell() { /** {@inheritDoc} */ @Override public ChangeStreamRecord finishChangeStreamMutation( - String token, java.time.Instant estimatedLowWatermark) { + String token, Instant estimatedLowWatermark) { this.changeStreamMutationBuilder.setToken(token); this.changeStreamMutationBuilder.setLowWatermarkTime(estimatedLowWatermark); return this.changeStreamMutationBuilder.build(); diff --git a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java index 28e191c73..06e2967a6 100644 --- a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java +++ b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/CbtTestProxy.java @@ -60,6 +60,7 @@ import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.IOException; +import java.time.Duration; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -108,7 +109,7 @@ public static CbtTestProxy create() { * @param newTimeout The value that is used to set the timeout. */ private static BigtableDataSettings.Builder overrideTimeoutSetting( - java.time.Duration newTimeout, BigtableDataSettings.Builder settingsBuilder) { + Duration newTimeout, BigtableDataSettings.Builder settingsBuilder) { updateTimeout( settingsBuilder.stubSettings().bulkMutateRowsSettings().retrySettings(), newTimeout); @@ -127,8 +128,8 @@ private static BigtableDataSettings.Builder overrideTimeoutSetting( return settingsBuilder; } - private static void updateTimeout(RetrySettings.Builder settings, java.time.Duration newTimeout) { - java.time.Duration rpcTimeout = settings.getInitialRpcTimeoutDuration(); + private static void updateTimeout(RetrySettings.Builder settings, Duration newTimeout) { + Duration rpcTimeout = settings.getInitialRpcTimeoutDuration(); // TODO: this should happen in gax // Clamp the rpcTimeout to the overall timeout @@ -179,8 +180,8 @@ public synchronized void createClient( .setAppProfileId(request.getAppProfileId()); if (request.hasPerOperationTimeout()) { - java.time.Duration newTimeout = - java.time.Duration.ofMillis(Durations.toMillis(request.getPerOperationTimeout())); + Duration newTimeout = + Duration.ofMillis(Durations.toMillis(request.getPerOperationTimeout())); settingsBuilder = overrideTimeoutSetting(newTimeout, settingsBuilder); logger.info( String.format( diff --git a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java index b887f7504..b0d5a4d34 100644 --- a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java +++ b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java @@ -21,6 +21,7 @@ import com.google.cloud.bigtable.data.v2.models.sql.SqlType; import com.google.cloud.bigtable.data.v2.models.sql.Statement; import com.google.protobuf.Timestamp; +import java.time.Instant; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -156,8 +157,8 @@ static Object decodeArrayElement(Value value, SqlType elemType) { } } - private static java.time.Instant toInstant(Timestamp timestamp) { - return java.time.Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos()); + private static Instant toInstant(Timestamp timestamp) { + return Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos()); } private static Date fromProto(com.google.type.Date proto) {