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/ - #普通身份登 ...
随机推荐
- 【BZOJ】2734: [HNOI2012]集合选数
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2734 考虑$N=4$的情况: \begin{bmatrix} 1&3 &X ...
- 远程连接MongoDB报“Network is unreachable”错误的解决方法
解决办法:/etc/mongod.conf 里把127.0.0.1 改成 0.0.0.0
- go 内嵌对象类型
demo1 // Sample program to show how to embed a type into another type and // the relationship betwee ...
- 关于python的面向对象
一,面向对象 1..面向对象的过程:一切以事物的流程为核心,核心是过程二字,过程是指解决问题的步骤, 是一种机械是的编程思维 优点:负责的问题流程化,编写相对简单 缺点:可扩展性能差 2.面向对象一切 ...
- 力扣(LeetCode)922. 按奇偶排序数组 II
给定一个非负整数数组 A, A 中一半整数是奇数,一半整数是偶数. 对数组进行排序,以便当 A[i] 为奇数时,i 也是奇数:当 A[i] 为偶数时, i 也是偶数. 你可以返回任何满足上述条件的数组 ...
- HTML标记 2 ——表格
<table width="800" border="0"> -----------------------表开头 <tr> ...
- Codeforces 458C - Elections
458C - Elections 思路: 三分凹形函数极小值域 代码: #include<bits/stdc++.h> using namespace std; #define ll lo ...
- php set_time_limit()的作用是什么
php set_time_limit()用法测试 一.总结 一句话总结:在php中set_time_limit函数是用来限制页面执行时间的,如我想把一个php页面的执行时间定义为5秒就可以set_ti ...
- English trip V1 - B 14. There Are Flowers in My Office 我办公室里有花 Teacher:Lamb Key: There be(is/are)
In this lesson you will learn to describe a room or place. 这节课讲学习描述一个房间或地方 课上内容(Lesson) 1. Where do ...
- Debian初始化配置
1.解决中文显示乱码windows的宋体文件上传到debian的字体目录,并运行dpkg-reconfigure locales命令来设置系统的字体root@debian:~# mv simsun.t ...