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> topoConf)
Return an instance, which is shared (within a Worker), of the specified type.
|
<T,K,V> T |
getWorkerBean(Class<T> clazz,
Map<K,V> topoConf,
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 classpublic <T,K,V> T getWorkerBean(Class<T> clazz, Map<K,V> topoConf)
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> topoConf, boolean force)
Return an instance, which is shared (within a Worker), of the specified type.
clazz - the class of the bean.topoConf - the storm configurationforce - if true= create a new instance even if one already exist.T.Copyright © 2021 The Apache Software Foundation. All rights reserved.