ActiveMQ 的连接和会话
要了解 connection 和 session 的概念,可以先从 ConnectionState 和 SessionState 入手:
// 省略部分代码
public class ConnectionState {
ConnectionInfo info;
private final ConcurrentHashMap<TransactionId, TransactionState> transactions = new ConcurrentHashMap<TransactionId, TransactionState>();
private final ConcurrentHashMap<SessionId, SessionState> sessions = new ConcurrentHashMap<SessionId, SessionState>();
private final List<DestinationInfo> tempDestinations = Collections.synchronizedList(new ArrayList<DestinationInfo>());
private final AtomicBoolean shutdown = new AtomicBoolean(false);
private boolean connectionInterruptProcessingComplete = true;
private HashMap<ConsumerId, ConsumerInfo> recoveringPullConsumers; public ConnectionState(ConnectionInfo info) {
this.info = info;
// Add the default session id.
addSession(new SessionInfo(info, -1));
}
}
从代码可以看出,连接里有事务集合、会话集合、临时队列集合等,这说明:
1. 事务属于一个连接; 2. 会话属于一个连接; 3. 临时队列的生存期是连接的有效期
// 省略部分代码
public class SessionState {
final SessionInfo info; private final Map<ProducerId, ProducerState> producers = new ConcurrentHashMap<ProducerId, ProducerState>();
private final Map<ConsumerId, ConsumerState> consumers = new ConcurrentHashMap<ConsumerId, ConsumerState>();
private final AtomicBoolean shutdown = new AtomicBoolean(false); public SessionState(SessionInfo info) {
this.info = info;
}
}
从上面能看出,producer 和 consumer 是属于某个会话的,producer 和 consumer 都有唯一的 ID 。
// 省略部分代码
public class ProducerState {
final ProducerInfo info;
private TransactionState transactionState;
} public class ConsumerState {
final ConsumerInfo info;
}
ProducerState 和 ConsumerState 只是做了简单的封装。
其中 ConnectionInfo, SessionInfo, ProducerInfo, ConsumerInfo 都是消息类型,均继承自 BaseCommand 接口。
ActiveMQ 的连接和会话的更多相关文章
- memcache和activemq使用连接,然后close
memcache和activemq使用连接,然后close
- 理解oracle中连接和会话
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcytp44 理解oracle中连接和会话 1. 概念不同:概念不同: 连接是指物 ...
- 数据库的连接、会话与SQLite
通俗来讲,会话(Session) 是通信双方从开始通信到通信结束期间的一个上下文(Context).这个上下文是一段位于服务器端的内存:记录了本次连接的所有相关状态和运行数据. 连接(Connecti ...
- ActiveMQ学习笔记(9)----ActiveMQ静态网络连接
1. 启动多个Broker 在win10下同一台服务器启动多个Broker, 步骤如下: 1. 复制安装目录下的conf文件夹命名为conf2 2. 修改activemq.xml中的brokerNam ...
- [转帖]postgresql查看用户连接以及杀死连接的会话
postgresql查看用户连接以及杀死连接的会话 2017年10月11日 15:21:18 DB_su 阅读数 8908更多 分类专栏: postgresql 版权声明:本文为博主原创文章,遵循 ...
- Oracle连接与会话
连接(connection):连接是从客户端到oracle数据库实例的一条物理路径. 会话(session):会话是数据库实例中存在的一个逻辑实体. case1:一个连接可以有多个会话 SQL> ...
- Oracle 连接、会话数的查看,修改
http://blog.csdn.net/xiaoyao6650/article/details/4027041 查看processes #当前的连接数 select count(*) from v$ ...
- LVS的持久连接、会话保持和高可用介绍
持续连接 1)持久连接(lvs persistence)模板: 实现无论使用任何调度算法,在一段时间内(默认360s),能够实现将来自同一个地址的请求始终发往同一个RS ipvsadm -A|E -t ...
- 【HICP Gauss】数据库 数据库管理(连接方式 会话模式 存储表空间)-6
数据库连接方式:驱动连接和客户端连接 驱动连接 : JDBC GSC ODBC 客户端连接 zsql工具 zsql / as sysdba -q #管理员身份登陆 zsql omm/ - #普通身份登 ...
随机推荐
- 草珊瑚理解IFC(inline formatting context)
1. 认识字体font-family 字体渲染的实际高度, 由字体本身的设置(升部ascender,降部descender,大写字母高度Capital Height,小写字母高度X-Height等等) ...
- R语言通过loess去除某个变量对数据的影响--CNV分析
当我们想研究不同sample的某个变量A之间的差异时,往往会因为其它一些变量B对该变量的固有影响,而影响不同sample变量A的比较,这个时候需要对sample变量A进行标准化之后才能进行比较.标准化 ...
- VC.【转】采用_beginthread/_beginthreadex函数创建多线程
https://blog.csdn.net/cbnotes/article/details/8331632 还可以看这个网址的内容:[多线程]VC6使用_beginthread开启多线程的方法-技术宅 ...
- "不是内部或外部命令"
问题描述: 使用cmd 运行某个路径下(一般是C:PROGRAM FILES\...或者E:\program files\....或者D:\program files\......下面的某个)的exe ...
- Java 8新特性探究(二)深入解析默认方法
什么是默认方法,为什么要有默认方法 简单说,就是接口可以有实现方法,而且不需要实现类去实现其方法.只需在方法名前面加个default关键字即可. 为什么要有这个特性?首先,之前的接口是个双刃剑,好处是 ...
- jfinal集成cas单点认证实践
本示例jfinal集成cas单点认证,采用获取到登录用户session信息后,在本地站点备份一份session信息,主要做以下几个步骤: 1.站点引入响应jar包: 2.在web.xml中配置对应过滤 ...
- 日常英语---十三、MapleStory/Monsters/Level 11-20(邪恶之眼)
日常英语---十三.MapleStory/Monsters/Level 11-20(邪恶之眼) 一.总结 一句话总结: evil ['ivl] A stronger version of Evil E ...
- (6)进程---Event事件
# 阻塞事件 : e = Event()生成事件对象e e.wait()是给程序加阻塞 , 程序当中是否加阻塞完全取决于该对象中的is_set() [默认返回值是False] e.wait(2) 传参 ...
- [ /* 和 / 的区别 ] Difference between / and /* in servlet mapping url pattern
<url-pattern>/*</url-pattern> The /* on a servlet overrides all other servlets, includin ...
- Android Error:Could not find lottie.jar
Android Error:Could not find lottie.jar 今天遇到了一个及其头疼的问题 同事的工程导到我的电脑里却报错,错误是找不到jcenter仓库里的lottie.jar包 ...