public class WorkerCtx extends Object implements Serializable
Simple class used to register singletons within a storm worker.
Constructor and Description |
---|
WorkerCtx()
Creates a new
WorkerCtx instance. |
Modifier and Type | Method and Description |
---|---|
protected <T> BeanFactory<T> |
getBeanfactory(Class<T> clazz)
Return an instance provider of the specified type.
|
<T,K,V> T |
getWorkerBean(Class<T> clazz,
Map<K,V> stormConf)
Return an instance, which is shared (within a Worker), of the specified type.
|
<T,K,V> T |
getWorkerBean(Class<T> clazz,
Map<K,V> stormConf,
boolean force)
Return an instance, which is shared (within a Worker), of the specified type.
|
<T> void |
register(Class<T> clazz,
BeanFactory<T> provider)
Register a bean provider for a specified type.
|
public WorkerCtx()
Creates a new WorkerCtx
instance.
public <T> void register(Class<T> clazz, BeanFactory<T> provider)
Register a bean provider for a specified type.
protected <T> BeanFactory<T> getBeanfactory(Class<T> clazz)
Return an instance provider of the specified type.
RuntimeException
- if no bean provider can be resolve for the given class.public <T,K,V> T getWorkerBean(Class<T> clazz, Map<K,V> stormConf)
Return an instance, which is shared (within a Worker), of the specified type.
public <T,K,V> T getWorkerBean(Class<T> clazz, Map<K,V> stormConf, boolean force)
Return an instance, which is shared (within a Worker), of the specified type.
clazz
- the class of the bean.stormConf
- the storm configurationforce
- if true
= create a new instance even if one already exist.T
.Copyright © 2019 The Apache Software Foundation. All Rights Reserved.