@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.
|
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() |
PathConfiguration |
getPathConf() |
String |
getPathConfHash() |
Subject |
getSubject() |
boolean |
getUriValidationEnabled() |
UserState |
getUserState() |
void |
loadConf(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(InetSocketAddress address)
Loads configuration if not loaded from meta master yet.
|
ClientContext |
setUriValidationEnabled(boolean uriValidationEnabled) |
protected ClientContext(ClientContext ctx)
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, boolean loadClusterConf, boolean loadPathConf) throws AlluxioStatusException
address
- the address to load cluster defaults fromloadClusterConf
- whether to load cluster level configurationloadPathConf
- whether to load path level configurationAlluxioStatusException
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()
public PathConfiguration getPathConf()
public String getClusterConfHash()
public String getPathConfHash()
public Subject getSubject()
public UserState getUserState()
Copyright © 2023. All Rights Reserved.