| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
beanCtx
bean 容器.
|
protected cn.xnatural.enet.event.EP |
ep
1.
|
protected org.slf4j.Logger |
log |
protected String |
name
服务名字标识.(保证唯一)
可用于命名空间:
1.
|
| Modifier and Type | Method and Description |
|---|---|
AppContext |
app()
当前应用上下文
|
ServerTpl |
async(Runnable fn)
异步执行.
|
ServerTpl |
async(Runnable fn,
Consumer<Throwable> exFn)
异步执行.
|
Map<String,Object> |
attrs()
当前服务的属性集
|
protected <T> T |
bean(Class<T> type)
全局查找 bean
|
protected <T> T |
bean(Class<T> type,
String name)
全局查找 bean
|
protected ExecutorService |
exec()
线程池
|
protected ServerTpl |
exposeBean(Object bean,
String... names)
暴露 bean 给其它模块用.
|
<T> T |
getAttr(String key,
Class<T> type,
T defaultValue)
获取属性
|
protected Boolean |
getBoolean(String key,
Boolean defaultValue) |
protected Double |
getDouble(String key,
Double defaultValue) |
protected Float |
getFloat(String key,
Float defaultValue) |
protected Integer |
getInteger(String key,
Integer defaultValue) |
protected Long |
getLong(String key,
Long defaultValue) |
String |
getName()
服务名
|
protected String |
getStr(String key,
String defaultValue) |
protected <T> T |
localBean(Class<T> bType)
本地查找 对象
|
protected <T> T |
localBean(Class<T> bType,
String bName)
本地查找 对象
|
protected <T> T |
localBean(cn.xnatural.enet.event.EC ec,
Class<T> bType,
String bName) |
Devourer |
queue(Runnable fn)
对列执行, 加入到当前
name为对列名的对列 |
Devourer |
queue(String qName)
获取执行对列
|
Devourer |
queue(String qName,
Runnable fn)
对列执行
|
ServerTpl |
setAttr(String aName,
Object aValue)
设置属性
|
protected final org.slf4j.Logger log
protected final String name
@Inject protected cn.xnatural.enet.event.EP ep
public ServerTpl(String name)
public ServerTpl()
@EL(name={"bean.get","{name}.bean.get"})
protected <T> T localBean(cn.xnatural.enet.event.EC ec,
Class<T> bType,
String bName)
protected <T> T localBean(Class<T> bType, String bName)
bType - 对象类型bName - 对象名字protected <T> T localBean(Class<T> bType)
bType - 对象类型protected <T> T bean(Class<T> type, String name)
type - bean类型name - bean名字protected <T> T bean(Class<T> type)
type - bean类型public ServerTpl async(Runnable fn, Consumer<Throwable> exFn)
fn - 异步执行的函数exFn - 错误处理函数public Devourer queue(String qName, Runnable fn)
qName - 对列名, 默认当前server名称fn - 要执行的函数Devourer当前对列public Devourer queue(Runnable fn)
name为对列名的对列fn - 要执行的函数Devourer当前对列protected ServerTpl exposeBean(Object bean, String... names)
bean - bean实例names - bean 名字public AppContext app()
AppContextprotected ExecutorService exec()
ExecutorServicepublic String getName()
public ServerTpl setAttr(String aName, Object aValue)
aName - 属性名aValue - 属性值ServerTplpublic <T> T getAttr(String key, Class<T> type, T defaultValue)
key - 属性keytype - 值类型defaultValue - 默认值Copyright © 2022. All rights reserved.