From 59beb06e7e61347087f8dc00d6f6769d54ac1339 Mon Sep 17 00:00:00 2001 From: mmalhotra Date: Tue, 9 Apr 2024 22:19:18 -0700 Subject: [PATCH] trying to get DT object --- .../thrift/TokenFetchingMetastoreClientFactory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/TokenFetchingMetastoreClientFactory.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/TokenFetchingMetastoreClientFactory.java index 812838cda832e6..3674c0878a4710 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/TokenFetchingMetastoreClientFactory.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/TokenFetchingMetastoreClientFactory.java @@ -21,6 +21,7 @@ import dev.failsafe.Failsafe; import dev.failsafe.FailsafeExecutor; import dev.failsafe.RetryPolicy; +import dev.failsafe.function.CheckedSupplier; import io.trino.cache.NonEvictableLoadingCache; import io.trino.plugin.base.security.UserNameProvider; import io.trino.plugin.hive.ForHiveMetastore; @@ -30,6 +31,7 @@ import java.time.Duration; import java.util.Optional; +import java.util.concurrent.Callable; import static com.google.common.base.Throwables.throwIfInstanceOf; import static com.google.common.base.Throwables.throwIfUnchecked; @@ -123,11 +125,13 @@ private DelegationToken loadDelegationToken(String username) { try { // added retry and stats for the thrift delegation token - return (DelegationToken) failSafeExecutor().get(() -> stats.getThriftDelegationToken().wrap(() -> { + return (DelegationToken) failSafeExecutor().get((CheckedSupplier )() -> + stats.getThriftDelegationToken().wrap(() -> { try (ThriftMetastoreClient client = createMetastoreClient()) { return new DelegationToken(System.nanoTime(), client.getDelegationToken(username)); } - })); + }).call() + ); } catch (Exception e) { if (e instanceof InterruptedException) {