Package alluxio
Class ClientContext
- java.lang.Object
-
- alluxio.ClientContext
-
- Direct Known Subclasses:
MasterClientContext
@PublicApi public class ClientContext extends java.lang.Object
AClientContext
contains information required and pertaining to making network connections and performing operations with remote Alluxio processes. TheClientContext
should only contain the information which is necessary to make those connections. AClientContext
are not expensive objects to create, however it is important to be aware that if the configuration with which the instance is created does not have the cluster default configuration loaded that any new clients which use the context will need to load the cluster defaults upon connecting to the Alluxio master. Path level configuration may not be needed for any ClientContext, it is currently only used in BaseFileSystem, so it is initially lazily loaded by FileSystemContext when it's needed. Ideally only a singleClientContext
should be needed when initializing an application. This will use as few network resources as possible.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClientContext(ClientContext ctx)
This constructor does not create a copy of the configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClientContext
create()
static ClientContext
create(AlluxioConfiguration alluxioConf)
static ClientContext
create(javax.security.auth.Subject subject, AlluxioConfiguration alluxioConf)
A client context with information about the subject and configuration of the client.AlluxioConfiguration
getClusterConf()
java.lang.String
getClusterConfHash()
PathConfiguration
getPathConf()
java.lang.String
getPathConfHash()
javax.security.auth.Subject
getSubject()
boolean
getUriValidationEnabled()
UserState
getUserState()
void
loadConf(java.net.InetSocketAddress address, boolean loadClusterConf, boolean loadPathConf)
This method will load the cluster and path level configuration defaults and update the configuration in one RPC.void
loadConfIfNotLoaded(java.net.InetSocketAddress address)
Loads configuration if not loaded from meta master yet.ClientContext
setUriValidationEnabled(boolean uriValidationEnabled)
-
-
-
Constructor Detail
-
ClientContext
protected ClientContext(ClientContext ctx)
This constructor does not create a copy of the configuration.
-
-
Method Detail
-
create
public static ClientContext create(javax.security.auth.Subject subject, AlluxioConfiguration alluxioConf)
A client context with information about the subject and configuration of the client.- Parameters:
subject
- the security subject to usealluxioConf
- theAlluxioConfiguration
to use- Returns:
- a new client context with the specified properties and subject
-
create
public static ClientContext create(AlluxioConfiguration alluxioConf)
- Parameters:
alluxioConf
- the specifiedAlluxioConfiguration
to use- Returns:
- the client context with the given properties and an empty subject
-
create
public static ClientContext create()
- Returns:
- a new
ClientContext
with values loaded from the alluxio-site properties and an empty subject.
-
loadConf
public void loadConf(java.net.InetSocketAddress address, boolean loadClusterConf, boolean loadPathConf) throws AlluxioStatusException
This method will load the cluster and path level configuration defaults and update the configuration in one RPC. This method should be synchronized so that concurrent calls to it don't continually overwrite the previous configuration. The cluster defaults are updated per connection establishment, or when cluster defaults updates are detected on client side.- Parameters:
address
- the address to load cluster defaults fromloadClusterConf
- whether to load cluster level configurationloadPathConf
- whether to load path level configuration- Throws:
AlluxioStatusException
-
loadConfIfNotLoaded
public void loadConfIfNotLoaded(java.net.InetSocketAddress address) throws AlluxioStatusException
Loads configuration if not loaded from meta master yet.- Parameters:
address
- meta master address- Throws:
AlluxioStatusException
-
setUriValidationEnabled
public ClientContext setUriValidationEnabled(boolean uriValidationEnabled)
- Parameters:
uriValidationEnabled
- whether URI validation is enabled- Returns:
- updated instance of ClientContext
-
getUriValidationEnabled
public boolean getUriValidationEnabled()
- Returns:
true
if URI validation is enabled
-
getClusterConf
public AlluxioConfiguration getClusterConf()
- Returns:
- the cluster level configuration backing this context
-
getPathConf
public PathConfiguration getPathConf()
- Returns:
- the path level configuration backing this context
-
getClusterConfHash
public java.lang.String getClusterConfHash()
- Returns:
- hash of cluster level configuration
-
getPathConfHash
public java.lang.String getPathConfHash()
- Returns:
- hash of path level configuration
-
getSubject
public javax.security.auth.Subject getSubject()
- Returns:
- the Subject backing this context
-
getUserState
public UserState getUserState()
- Returns:
- the UserState for this context
-
-