public long increment(String name, int size)
throws SystemException {
if (size < _MINIMUM_INCREMENT_SIZE) {
size = _MINIMUM_INCREMENT_SIZE;
}
CounterRegister register = getCounterRegister(name);//从hashMap中取出
synchronized (register) {
long newValue = register.getCurrentValue() + size;
if (newValue > register.getRangeMax()) {//理解这一句提高性能的策略:)
Session session = null;
try {
Connection connection = getConnection();
session = new SessionImpl(
_sessionFactory.openSession(connection));
Counter counter = (Counter)session.get(
Counter.class, register.getName());
newValue = counter.getCurrentId() + 1;
long rangeMax =
counter.getCurrentId() + register.getRangeSize();
counter.setCurrentId(rangeMax);
session.save(counter);
session.flush();
register.setCurrentValue(newValue);
register.setRangeMax(rangeMax);
}
catch (Exception e) {
throw processException(e);
}
finally {
session.close();
}
}
else {
register.setCurrentValue(newValue);
}
return newValue;
}
}
com.liferay.counter.service.persistence.CounterPersistence
HeatBeat机制:
http://issues.liferay.com/browse/LPS-557
LEP-7681 addressed an issue where the counter service caused the connection pool to run out of connections. This fix works well for the most part, but there is a side effect where the database terminates the jdbc connection on deployments that have long periods of inactivity (mysql default is 8 hours).
The most generic solution for this is to create a Job that will sent heartbeats (a simple query) to let the database know that this connection is still alive at a default interval of 60 minutes. This is configurable via portal-ext.properties:
#
# Set the interval in minutes for the ConnectionHearbeatJob.
# This will determine how often the database is polled for long running
# connections and will prevent the database from disconnecting the socket
# prematurely.
#
counter.connection.heartbeat.job.interval=60
分享到:
相关推荐
1.程序功能说明: MATLAB实现多种群遗传算法(完整代码) 逼近C=[9,8,7,6,5,4,3,2,1]的9维向量. 2.代码说明:注释清晰,参数和变量说明清晰,方便更改、方便初学者使用,模块化编程,方便替换目标函数。运行环境Windows7及以上操作系统,MATLAB2014a及以上版本。 3.适用专业:计算机、电子信息工程、数学、物理、机械工程、土木工程等专业的大学生、研究生毕业设计,各类专业的课程设计、海外留学生作业等。 4作者介绍:资深算法工程师, 从事Matlab、Python算法仿真工作15年,专业研究遗传算法、粒子群算法、蚁群算法、鲸鱼算法、狼群算法等. 有问题联系QQ: 1579325979
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
小学元旦晚会PPT 模版
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
MATLAB中的语义分割技术探究与应用实践,matlab,语义分割 ,matlab; 语义分割,Matlab语义分割技术解析
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
1、文件内容:pulseaudio-10.0-6.el7_9.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/pulseaudio-10.0-6.el7_9.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
"基于OpenCV与深度学习的人脸表情识别系统:利用Python与PyQt构建的可视化实时检测工具",基于OpenCV的人脸表情识别系统 相关技术:python,opencv,pyqt,深度学习 (请自行安装向日葵远程软件,以便提供远程帮助) 可编译为.exe文件。 软件说明:摄像头实时检测,加载照片,视频均可。 有基础的同学,可自行修改完善。 第一张和第二张为运行截图。 ,基于OpenCV的人脸表情识别系统; Python; OpenCV; PyQt; 深度学习; 实时检测; 照片和视频支持; 可编译为.exe文件; 运行截图。,"基于OpenCV与深度学习的人脸表情识别系统"
,步进方案,步进源码,两相步进矢量控制,超前角控制两种模式,成熟产品方案 支持特殊功能定制
三相储能PCS双向能量流动与Matlab仿真控制研究——基于SVPWM调制技术的建模与应用,三相储能PCS(Matlab仿真) 1.可实现Grid to Battery,Battery to Grid的能量双向流动。 2.本仿真基于Matlab仿真建立的模型, 3.采用SVPWM进行控制 ,三相储能PCS; 双向能量流动; Matlab仿真; SVPWM控制,三相储能PCS:能量双向流Matlab仿真模型(SVPWM控制)
deepseek部署教程.md
nodejs010-nodejs-ansicolors-0.3.2-1.el6.centos.alt.noarch.rpm
基于三菱PLC的四路抢答器控制系统原理及实践:含带解释的梯形图与IO分配图解,三菱 MCGS 基于PLC的四路抢答器控制系统 带解释的梯形图接线图原理图图纸,io分配,组态画面 ,三菱MCGS; PLC四路抢答器; 控制系统; 梯形图接线图; 原理图图纸; IO分配; 组态画面。,三菱PLC四路抢答器控制系统原理图及组态画面解析
基于运动数据时空特征提取的人类运动片段.pdf
基于机器学习的选股模型及投资组合研究.pdf
ollama安装包。。。。。。。。。。。。。。。。。
nodejs010-nodejs-ansistyles-0.1.3-1.el6.centos.alt.x86_64.rpm
Screenshot_20250201_111207_com_tencent_mm_LauncherUI.jpg
基于时空Transformer的端到端的视频注视目标检测.pdf