gu.simplemq.SimplemqContext Maven / Gradle / Ivy
package gu.simplemq;
/**
* simplemq运行上下文对象
* @author guyadong
*
*/
public class SimplemqContext {
public static final ThreadLocal context = new InheritableThreadLocal<>();
Channel> currentChannel ;
SimplemqContext() {
}
/**
* 用指定的 Channel 设置上下文对象
* @param currentChannel
*/
static void setChannel(Channel> currentChannel){
SimplemqContext c;
if((c = context.get()) == null){
c = new SimplemqContext();
context.set(c);
}
c.currentChannel = currentChannel;
}
public String getCurrentChannelName(){
return currentChannel != null ? currentChannel.name : null;
}
public Channel> getCurrentChannel(){
return currentChannel;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy