@InterfaceAudience.Private
@InterfaceStability.Stable
public final class SharedInstanceProfileCredentialsProvider
extends com.amazonaws.auth.InstanceProfileCredentialsProvider
InstanceProfileCredentialsProvider that enforces
instantiation of only a single instance.
This credential provider calls the EC2 instance metadata service to obtain
credentials. For highly multi-threaded applications, it's possible that
multiple instances call the service simultaneously and overwhelm it with
load. The service handles this by throttling the client with an HTTP 429
response or forcibly terminating the connection. Forcing use of a single
instance reduces load on the metadata service by allowing all threads to
share the credentials. The base class is thread-safe, and there is nothing
that varies in the credentials across different instances of
S3AFileSystem connecting to different buckets, so sharing a singleton
instance is safe.
As of AWS SDK 1.11.39, the SDK code internally enforces a singleton. After
Hadoop upgrades to that version or higher, it's likely that we can remove
this class.| Modifier and Type | Method and Description |
|---|---|
static SharedInstanceProfileCredentialsProvider |
getInstance()
Returns the singleton instance.
|
public static SharedInstanceProfileCredentialsProvider getInstance()
Copyright © 2017 Apache Software Foundation. All Rights Reserved.