Openfire版本:3.8.2 使用openfire整合自己的用户库之后,看其JDBCAuthProvider源码,可以看到getConnection()方法是直接从JDBC驱动去获得一个新的连接,如果在数据库连接教慢或者请求较多的时候会造成效率极其低下甚至有可能客户端登录超时,这是我们不能允许的,所以我们必须给他设置加个连接池。
if(pds == null){
jdbcUserName = JiveGlobals.getProperty("jdbcAuthProvider.jdbcUserName");
jdbcUserPassword = JiveGlobals.getProperty("jdbcAuthProvider.jdbcUserPassword");
minimumConnectionCount = JiveGlobals.getIntProperty("jdbcAuthProvider.minimumConnectionCount",10);
maximumConnectionCount = JiveGlobals.getIntProperty("jdbcAuthProvider.maximumConnectionCount",20);
prototypeCount = JiveGlobals.getIntProperty("jdbcAuthProvider.prototypeCount",20);
maximumActiveTime = JiveGlobals.getIntProperty("jdbcAuthProvider.maximumActiveTime",900000);
maximumConnectionLifetime = JiveGlobals.getIntProperty("jdbcAuthProvider.maximumConnectionLifetime",14400000);
jdbcDriver = JiveGlobals.getProperty("jdbcProvider.driver");
connectionString = JiveGlobals.getProperty("jdbcProvider.connectionString");
pds = new ProxoolDataSource();
pds.setDriver(jdbcDriver);
pds.setDriverUrl(connectionString);
pds.setUser(jdbcUserName);
pds.setPassword(jdbcUserPassword);
pds.setMinimumConnectionCount(minimumConnectionCount);
pds.setMaximumConnectionCount(maximumConnectionCount);
pds.setPrototypeCount(prototypeCount);
pds.setMaximumActiveTime(maximumActiveTime);
pds.setMaximumConnectionLifetime(maximumConnectionLifetime);
}
long conectionGetStartTime = System.currentTimeMillis();
// Connection connection = DriverManager.getConnection(connectionString);
Connection connection = pds.getConnection();
long conectionGetEndTime = System.currentTimeMillis();
Log.info("获得连接时间 : "+(conectionGetEndTime - conectionGetStartTime ) + " , 连接对象: "+connection.toString());
return connection;
[版权声明]本站内文章,如未特别注明,均系原创或翻译之作,本人保留一切权利。本站原创及译作未经本人许可,不得用于商业用途及传统媒体。网络媒体可随意转载,或以此为基础进行演译,但务必以链接形式注明原始出处和作者信息,否则属于侵权行为。另对本站转载他处文章,俱有说明,如有侵权请联系本人,本人将会在第一时间删除侵权文章。及此说明,重中之重。
分享到:
相关推荐
[经典] Openfire SPARK 整合 扩展用户 用户组
openfire 用户整合,手把手交你实现。
NULL 博文链接:https://linfengsheng.iteye.com/blog/1343814
实现openfire与用户数据库集成 实现用户认证、用户查询
自己写的获取所有在线用户的openfire插件,直接上传到openfire服务器即可使用,访问路径为host:port/plugins/onlines/listall
代码里做了逻辑处理,会随机只返回3个,改下就可以了 访问路径 127.0.0.1:8080/plugins/onlineuser/getallusers
openfire插件,用户入群加web接口,史上最全,下载即用
libjingle0.6.14连接openfire
openfire使用hazelCast集群
openfire记录在线统计人数插件
利用smack对xmpp协议的封装,对openfire服务器进行高效简单的连接
使用openfire和mysql,在android端建立连接,登录功能的实现,至于注册用户,是在openfire里实现的
浅显易懂地介绍xmpp与openfire开源项目的使用
Openfire3.7.1集群配置,针对需要多用户同时在线的openfire架构集群配置设置
这是一个简单地asmack连接Openfire的测试类,供初学者用。
基于Openfire服务器的用户行为审计插件设计与实现.pdf
对Openfire进行扩展,支持在线指定聊天室和全部在线人员的查看。
openfire的用户接收消息计数器,应用很方便,通过填写openfire的用户user_no号与密码,还有服务器的ip地址,点击登录就可以等待消息的接收,并且统计接收消息的数量.
openfire3.6.3插件开发方法说明: winxp/myeclipse6.5/jdk1.5&1.6/mysql5.0/openfire3.6.3 开发步骤:1. 布署openfire3.6.3源码(请参考openfire3.6.3导入eclipse项目实现方法)
Android 开发 openfire xmpp 协议 即时通讯