Skip to content

Commit

Permalink
trying to get DT object
Browse files Browse the repository at this point in the history
  • Loading branch information
osscm committed Apr 10, 2024
1 parent 7b7d7b8 commit 59beb06
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 <DelegationToken>)() ->
stats.getThriftDelegationToken().wrap(() -> {
try (ThriftMetastoreClient client = createMetastoreClient()) {
return new DelegationToken(System.nanoTime(), client.getDelegationToken(username));
}
}));
}).call()
);
}
catch (Exception e) {
if (e instanceof InterruptedException) {
Expand Down

0 comments on commit 59beb06

Please sign in to comment.