/** * Refresh these credentials only if they have expired or are expiring imminently. * * @throws IOException during token refresh. */ public void refreshIfExpired() throws IOException { synchronized(lock) { if (shouldRefresh()) { refresh(); } } }
/** * Refresh these credentials only if they have expired or are expiring imminently. * * @throws IOException during token refresh. */ public void refreshIfExpired() throws IOException { synchronized(lock) { if (shouldRefresh()) { refresh(); } } }
/** * Provide the request metadata by ensuring there is a current access token and providing it * as an authorization bearer token. */ @Override public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { synchronized(lock) { if (shouldRefresh()) { refresh(); } return Preconditions.checkNotNull(requestMetadata, "requestMetadata"); } }
/** * Provide the request metadata by ensuring there is a current access token and providing it * as an authorization bearer token. */ @Override public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { synchronized(lock) { if (shouldRefresh()) { refresh(); } return Preconditions.checkNotNull(requestMetadata, "requestMetadata"); } }
@Override public void getRequestMetadata(final URI uri, Executor executor, final RequestMetadataCallback callback) { Map<String, List<String>> metadata; synchronized(lock) { if (shouldRefresh()) { // The base class implementation will do a blocking get in the executor. super.getRequestMetadata(uri, executor, callback); return; } metadata = Preconditions.checkNotNull(requestMetadata, "cached requestMetadata"); } callback.onSuccess(metadata); }
@Override public void getRequestMetadata(final URI uri, Executor executor, final RequestMetadataCallback callback) { Map<String, List<String>> metadata; synchronized(lock) { if (shouldRefresh()) { // The base class implementation will do a blocking get in the executor. super.getRequestMetadata(uri, executor, callback); return; } metadata = Preconditions.checkNotNull(requestMetadata, "cached requestMetadata"); } callback.onSuccess(metadata); }