spring datasource 使用 proxool
XmlWebApplicationContext使用的xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd"> <bean id="proxoolDatasource" class="org.logicalcobwebs.proxool.ProxoolDataSource" lazy-init="false"
p:alias="proxoolPool"
p:driver="com.mysql.jdbc.Driver"
p:driverUrl="jdbc:mysql://localhost:3306/mydatabase"
p:user="user1"
p:password="123456"
p:minimumConnectionCount="10"
p:maximumConnectionCount="200"
p:houseKeepingSleepTime="90000"
p:maximumActiveTime="108000"
p:maximumConnectionLifetime="1200000"
p:prototypeCount="5"
/> </beans>
关于proxool 中的参数说明,括号内为 配置dataSource时的参数名:
注意:所有时间参数单位都是ms。
1. house-keeping-sleep-time (houseKeepingSleepTime):
默认值:30s
作用: 时间间隔,检查连接状态和通过测试house-keeping-test-sql指定的SQL语句创建和销毁连接。
2. house-keeping-test-sql (houseKeepingTestSql)
默认值:无
作用:测试连接状态的简单SQL语句,如果没有定义, 则测试会被忽略。
3. maximum-active-time (maximumActiveTime)
默认值: 5mins
作用:house-keeping-sleep-time检查时发现 某个连接占用的时间超过该时间 时 会关闭该连接,此值要比期待响应的最长时间要大。
4. maximum-connection-count (maximumConnectionCount):
默认值: 15
作用: 连接池 可以使用 的最大连接数量。
5. maximum-connection-lifetime(maximumConnectionLifetime):
默认值: 4 hours
作用:连接的最大生存时间,超过这个时间 连接就会被销毁。
6. minimum-connection-count(minimumConnectionCount):
默认值:5
作用:连接池 使用 的最小连接数量
7. prototype-count(prototypeCount)
默认值:0
作用:在不超过最大连接数的情况下,连接池中保证的空闲连接的数量。
8. overload-without-refusal-lifetime(overloadWithoutRefusalLifetime)
默认值:60s
作用:用于判断连接池是否超负荷的时间,如果在这个时间内 连接池无法提供连接, 那么说明连接池已超负荷。
9. maximum-new-connections (已废弃),参见simultaneous-build-throttle
10. simultaneous-build-throttle (simultaneousBuildThrottle)
默认值:10
作用:最多同时可以创建连接的个数。参见源码org.logicalcobwebs.proxool.Prototyper.buildConnection(int, String)方法。
11. recently-started-threshold(recentlyStartedThreshold)
默认值:60s
作用:用来判断连接池状态的一个时间值,某个连接的活跃时间小于该值 或者 连接池中有空闲的连接,则连接池的状态为UP。
12.trace(trace)
默认值:false
作用:是否每次执行SQL都在日志里记录(DEBUG)
13.jmx(jmx)
默认值:false
作用:如果设为true,那么连接池会注册为一个JMX Sever的 MBean, 使用的名字是 Proxool:type=Pool, name=<alias>
14.jmx-agent-id(jmxAgentId)
默认值:无
作用:逗号分隔的ID 列表, 被 MBeanServerFactory.findMBeanServer(String agentId) 使用
15.jndi-name:
默认值:无
作用:参见DataSource 说明
16. alias:
默认值:null
作用:连接池使用的别名。
另外数据库连接信息由下面几个参数指定:
driver="com.mysql.jdbc.Driver"
driverUrl="jdbc:mysql://localhost:3306/mydatabase"
user="user1"
password="123456"
spring datasource 使用 proxool的更多相关文章
- spring datasource jdbc 密码 加解密
spring datasource 密码加密后运行时解密的解决办法 - 一号门-程序员的工作,程序员的生活(java,python,delphi实战)http://www.yihaomen.com/a ...
- Failed to bind properties under 'spring.datasource' to javax.sql.DataSource
这是我的配置文件 # 国际化配置文件(包名.基础名) spring.messages.basename=i18n.login server.tomcat.uri-encoding=UTF- sprin ...
- IDEA报错: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
运行审核流模块: 在ActivitiServiceApplication模块日志报错: Error starting ApplicationContext. To display the auto-c ...
- springBoot配置druid监控报错Failed to bind properties under 'spring.datasource.druid' to javax.sql.DataSource
报错信息: Description: Failed to bind properties under 'spring.datasource.druid' to javax.sql.DataSource ...
- Spring dataSource
1.何为dataSource DataSource 接口是 JDBC 2.0 API 中的新增内容,它提供了连接到数据源的另一种方法. 作为 DriverManager 工具的替代项,DataSour ...
- Spring DataSource>DBCP & C3P0
Spring在第三方依赖包中包含了两个数据源的实现类包,其一是Apache的DBCP,其二是 C3P0.可以在Spring配置文件中利用这两者中任何一个配置数据源. DBCP数据源 DBCP类包位于 ...
- spring datasource和mybatis的datasource来源在哪里
配置一个数据源 spring在第三方依赖包中包含了两个数据源的实现类包,其一是Apache的DBCP,其二是 C3P0.可以在Spring配置文件中利用这两者中任何一个配置数据源. 配置一个 ...
- Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
从报错信息中,我们就可以分析出错误原因是触发了数据源的自动化配置,然而当前项目其实并不需要数据源.查其根源是依赖方提供的API依赖中引用了一些多余的依赖触发了该自动化配置的加载. 如何解决 为了解决上 ...
- idea -- spring datasource配置文件不显示datasource.properties文件对应属性的值,错误提示cannot resolve property key
原文:https://yq.aliyun.com/articles/657711 点击 文件 顶部的 蓝色 MVC application context,修改为Local File
随机推荐
- nginx+lua的基本原理概念介绍
一. 概述 Nginx是一个高性能,支持高并发的,轻量级的web服务器.目前,Apache依然web服务器中的老大,但是在全球前1000大的web服务器中,Nginx的份额为22.4%.Nginx采用 ...
- Python threading 多参数传递方法
今天开启线程传递参数的时候,出现了一个小问题,一直不能传递多个参数,如下 import threading thread1 = threading.Thread(target=fun, args=[1 ...
- 通过动态SQL语句创建游标
DECLARE @sql varchar(100); DECLARE @TableName varchar(32); DECLARE @FieldName varchar(32); DECLARE @ ...
- activemq 安装 部署
ActiveMQ是一种开源的,实现了JMS1.1规范的,面向消息(MOM)的中间件,为应用程序提供高效的.可扩展的.稳定的和安全的企业级消息通信.ActiveMQ使用Apache提供的授权,任何人都可 ...
- 并发编程基础之wait以及notify的用法
一:概念 线程通信中经常用到wait和notify,顾名思义,wait即让当前线程处于等待状态,notify通知锁对象 上的另一个线程被唤醒,这里的唤醒是指可以去争夺锁资源,nofityAll是唤醒该 ...
- vue实现pc端无限加载功能
主要思路通过自定义指令,在视图初始化完成后,绑定scroll事件.当scrollTop + clientHeight >= scrollHeight时(此时滚定条到了底部)触发loadMore事 ...
- k8s(3)-Pods和Nodes的概念
Pod是什么? 在前面创建部署时,Kubernetes创建了一个Pod来托管您的应用程序实例.Pod是一个Kubernetes抽象,表示一组一个或多个应用程序容器(如Docker或rkt),以及这些容 ...
- MFMailComposeViewController发送邮件的实例
本文转载至 http://blog.csdn.net/liufeng520/article/details/7585140 iPhone API已经提供了系统写邮件界面的接口,使用MFMailCo ...
- Windows下Codeblocks调试Cocos2d-x项目体验(一次失败的体验)
很久之前的一篇文章有介绍过在Ubuntu下安装Cocos2d-x3.11并使用Codeblock调试Cocos2d-x程序:http://www.cnblogs.com/moonlightpoet/p ...
- 六、Sql Server 基础培训《进度6-更新删除(实际操作)》
知识点: 假设,创建表test1,test2. drop table test1 create table test1 ( FID int identity(1,1), FBillNo varchar ...