@PublicApi public class ClientContext extends Object
ClientContext
contains information required and pertaining to making network
connections and performing operations with remote Alluxio processes. The ClientContext
should only contain the information which is necessary to make those connections.
A ClientContext
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 single ClientContext
should be needed when initializing an application.
This will use as few network resources as possible.Modifier | Constructor and Description |
---|---|
protected |
ClientContext(ClientContext ctx)
This constructor does not create a copy of the configuration.
|
protected |
ClientContext(Subject subject,
AlluxioConfiguration alluxioConf) |
Modifier and Type | Method and Description |
---|---|
static ClientContext |
create() |
static ClientContext |
create(AlluxioConfiguration alluxioConf) |
static ClientContext |
create(Subject subject,
AlluxioConfiguration alluxioConf)
A client context with information about the subject and configuration of the client.
|
AlluxioConfiguration |
getClusterConf() |
String |
getClusterConfHash() |
Subject |
getSubject() |
boolean |
getUriValidationEnabled() |
UserState |
getUserState() |
void |
loadConf(InetSocketAddress address)
This method will load the cluster and path level configuration defaults and update
the configuration in one RPC.
|
void |
loadConfIfNotLoaded(InetSocketAddress address)
Loads configuration if not loaded from meta master yet.
|
protected void |
setClusterConf(AlluxioConfiguration alluxioConfiguration) |
protected void |
setClusterConfHash(String clusterConfHash) |
ClientContext |
setUriValidationEnabled(boolean uriValidationEnabled) |
protected ClientContext(ClientContext ctx)
protected ClientContext(Subject subject, AlluxioConfiguration alluxioConf)
public static ClientContext create(Subject subject, AlluxioConfiguration alluxioConf)
subject
- the security subject to usealluxioConf
- the AlluxioConfiguration
to usepublic static ClientContext create(AlluxioConfiguration alluxioConf)
alluxioConf
- the specified AlluxioConfiguration
to usepublic static ClientContext create()
ClientContext
with values loaded from the alluxio-site properties and
an empty subject.public void loadConf(InetSocketAddress address) throws AlluxioStatusException
address
- the address to load cluster defaults fromAlluxioStatusException
public void loadConfIfNotLoaded(InetSocketAddress address) throws AlluxioStatusException
address
- meta master addressAlluxioStatusException
public ClientContext setUriValidationEnabled(boolean uriValidationEnabled)
uriValidationEnabled
- whether URI validation is enabledpublic boolean getUriValidationEnabled()
true
if URI validation is enabledpublic AlluxioConfiguration getClusterConf()
protected void setClusterConf(AlluxioConfiguration alluxioConfiguration)
protected void setClusterConfHash(String clusterConfHash)
public String getClusterConfHash()
public Subject getSubject()
public UserState getUserState()
Copyright © 2023. All Rights Reserved.