public class SharedResourcesBrokerFactory extends Object
SharedResourcesBroker.
All SharedResourcesBrokers created by this factory automatically load a set of configurations. In order of
preference:
* Programmatically supplied configurations in createDefaultTopLevelBroker(Config, ScopeInstance).
* Configurations in a broker configuration resource. The default path of the resource is DEFAULT_BROKER_CONF_FILE,
but its path can be overriden with BROKER_CONF_FILE_KEY either in programmatically supplied configurations,
java properties, or environment variables.
* Java properties of the current JVM.
* Environment variables of the current shell.
* Hadoop configuration obtained via Configuration.Configuration(). This can be disabled setting
LOAD_HADOOP_CONFIGURATION to false.| Modifier and Type | Field and Description |
|---|---|
static String |
BROKER_CONF_FILE_KEY |
static String |
DEFAULT_BROKER_CONF_FILE |
static String |
LOAD_HADOOP_CONFIGURATION |
| Constructor and Description |
|---|
SharedResourcesBrokerFactory() |
| Modifier and Type | Method and Description |
|---|---|
static <S,T> void |
addBrokerKeys(Map<String,String> configMap,
Iterable<Map.Entry<S,T>> entries) |
static <S extends ScopeType<S>> |
createDefaultTopLevelBroker(com.typesafe.config.Config config,
ScopeInstance<S> globalScope)
Create a root
SharedResourcesBroker. |
static SharedResourcesBroker<?> |
getImplicitBroker()
Get the implicit
SharedResourcesBroker in the callers thread. |
static void |
registerImplicitBroker(SharedResourcesBroker<?> broker)
Register a
SharedResourcesBroker to be used as the implicit broker for this and all new children threads. |
public static final String LOAD_HADOOP_CONFIGURATION
public static final String BROKER_CONF_FILE_KEY
public static final String DEFAULT_BROKER_CONF_FILE
public static <S extends ScopeType<S>> SharedResourcesBrokerImpl<S> createDefaultTopLevelBroker(com.typesafe.config.Config config, ScopeInstance<S> globalScope)
SharedResourcesBroker. Subscoped brokers should be built using
SharedResourcesBroker.newSubscopedBuilder(ScopeInstance).
In general, this method will be called only once per application, and all other brokers will Nbe children of the root
application broker.S - The ScopeType DAG used for this broker tree.config - The global configuration of the broker.globalScope - The scope of the root broker.public static SharedResourcesBroker<?> getImplicitBroker()
SharedResourcesBroker in the callers thread. This is either a singleton broker configured
from environment variables, java options, and classpath configuration options, or a specific broker injected
elsewhere in the application.
In general, it is preferable to explicitly pass around SharedResourcesBrokers, as that allows better
control over the scoping. However, in cases where it is hard to do so, this method provides an alternative to
method of acquiring a configured broker.public static void registerImplicitBroker(SharedResourcesBroker<?> broker)
SharedResourcesBroker to be used as the implicit broker for this and all new children threads.