FROM
- The type returned by the delegate Future.TO
- The type to convert to.public class RefreshAuthTokenTransformingFuture<FROM,TO> extends Object implements Future<TO>
Future that both delegates to another one and provides the ability to transform the response to another type. This is intended to work with some authenticated calls, like instance principals, and has handling so that if we receive a 401, we’ll refresh the auth token and then try again.
This is to account for scenarios where we have a valid/non-expired token but the permissions for the instance have changed since the token was issued and so on the server-side the presented token is considered invalid.
Constructor and Description |
---|
RefreshAuthTokenTransformingFuture(Future<FROM> delegate,
Function<FROM,TO> transformer,
RefreshableOnNotAuthenticatedProvider<?> authProvider,
Supplier<Future<FROM>> generateNewFutureForRetry)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Deprecated.
|
TO |
get()
Deprecated.
|
TO |
get(long timeout,
TimeUnit unit)
Deprecated.
|
boolean |
isCancelled()
Deprecated.
|
boolean |
isDone()
Deprecated.
|
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<TO>
public TO get() throws InterruptedException, ExecutionException
get
in interface Future<TO>
InterruptedException
ExecutionException
public TO get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<TO>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2016–2024. All rights reserved.