当前位置:网站首页>Bonecp uses data sources
Bonecp uses data sources
2022-07-06 18:26:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
bonecp.properties
jdbc.driverClass=oracle.jdbc.driver.OracleDriver
jdbc.jdbcUrl=jdbc:oracle:thin:@192.168.30.4:1521:test
jdbc.username=test
jdbc.password=test
#Sets the minimum number of connections that will be contained in every partition.
bonecp.minConnectionsPerPartition=1
#Sets the maximum number of connections that will be contained in every partition.
#Setting this to 5 with 3 partitions means you will have 15 unique
#connections to the database. Note that the connection pool will not create all
#these connections in one go but rather start off with minConnectionsPerPartition and gradually
#increase connections as required.
bonecp.maxConnectionsPerPartition=5
#Sets the acquireIncrement property. When the available connections are about to run
#out, BoneCP will dynamically create new ones in batches. This property controls how
#many new connections to create in one go (up to a maximum of
#maxConnectionsPerPartition). Note: This is a per partition setting.
bonecp.acquireIncrement=1
#Sets number of partitions to use. In order to reduce lock contention
#and thus improve performance, each incoming connection request picks off a connection from
#a pool that has thread-affinity, i.e. pool[threadId % partition_count]. The higher this number,
#the better your performance will be for the case when you have plenty
#of short-lived threads. Beyond a certain threshold, maintenance of these pools will start
#to have a negative effect on performance (and only for the case when
#connections on a partition start running out). Default: 1, minimum: 1, recommended:
#2-4 (but very app specific)
bonecp.partitionCount=1
#Sets the idleConnectionTestPeriod. This sets the time (in minutes), for a connection
#to remain idle before sending a test query to the DB. This is
#useful to prevent a DB from timing out connections on its end. Do
#not use aggressive values here! Default: 240 min, set to 0
#to disable
bonecp.idleConnectionTestPeriodInMinutes=240
#Sets the idleConnectionTestPeriod. This sets the time (in seconds), for a connection
#to remain idle before sending a test query to the DB. This is
#useful to prevent a DB from timing out connections on its end. Do
#not use aggressive values here! Default: 240 min, set to 0
#to disable
bonecp.idleConnectionTestPeriodInSeconds=14400
#Sets Idle max age (in min). The time (in minutes), for a
#connection to remain unused before it is closed off. Do not use aggressive
#values here! Default: 60 minutes, set to 0 to disable.
bonecp.idleMaxAgeInMinutes=60
#Sets Idle max age (in seconds). The time (in seconds), for a
#connection to remain unused before it is closed off. Do not use aggressive
#values here! Default: 60 minutes, set to 0 to disable.
bonecp.idleMaxAgeInSeconds=3600
#Sets statementsCacheSize setting. The number of statements to cache.
bonecp.statementsCacheSize=0
#Sets number of helper threads to create that will handle releasing a connection.
#When this value is set to zero, the application thread is blocked
#until the pool is able to perform all the necessary cleanup to recycle
#the connection and make it available for another thread. When a non-zero
#value is set, the pool will create threads that will take care of
#recycling a connection when it is closed (the application dumps the connection into
#a temporary queue to be processed asychronously to the application via the release
#helper threads). Useful when your application is doing lots of work on
#each connection (i.e. perform an SQL query, do lots of non-DB stuff and
#perform another query), otherwise will probably slow things down.
bonecp.releaseHelperThreads=3
#Instruct the pool to create a helper thread to watch over connection acquires
#that are never released (or released twice). This is for debugging purposes only
#and will create a new thread for each call to getConnection(). Enabling this
#option will have a big negative impact on pool performance.
bonecp.closeConnectionWatch=false
#If enabled, log SQL statements being executed.
bonecp.logStatementsEnabled=false
#Sets the number of ms to wait before attempting to obtain a connection
#again after a failure.
bonecp.acquireRetryDelayInMs=7000
#Set to true to force the connection pool to obtain the initial connections
#lazily.
bonecp.lazyInit=false
#Set to true to enable recording of all transaction activity and replay the
#transaction automatically in case of a connection failure.
bonecp.transactionRecoveryEnabled=false
#After attempting to acquire a connection and failing, try to connect these many
#times before giving up. Default 5.
bonecp.acquireRetryAttempts=5
#Set to true to disable JMX.
bonecp.disableJMX=false
#Queries taking longer than this limit to execute are logged.
bonecp.queryExecuteTimeLimitInMs=0
#Sets the Pool Watch thread threshold. The pool watch thread attempts to
#maintain a number of connections always available (between minConnections and maxConnections). This value
#sets the percentage value to maintain. For example, setting it to 20 means
#that if the following condition holds: Free Connections / MaxConnections < poolAvailabilityThreshold
#new connections will be created. In other words, it tries to keep at
#least 20% of the pool full of connections. Setting the value to zero
#will make the pool create new connections when it needs them but it
#also means your application may have to wait for new connections to be
#obtained at times. Default: 20.
bonecp.poolAvailabilityThreshold=20
#If set to true, the pool will not monitor connections for proper closure.
#Enable this option if you only ever obtain your connections via a mechanism
#that is guaranteed to release the connection back to the pool (eg Spring's
#jdbcTemplate, some kind of transaction manager, etc).
bonecp.disableConnectionTracking=false
#Sets the maximum time (in milliseconds) to wait before a call to getConnection
#is timed out. Setting this to zero is similar to setting it
#to Long.MAX_VALUE Default: 0 ( = wait forever )
bonecp.connectionTimeoutInMs=0
#Sets the no of ms to wait when close connection watch threads are
#enabled. 0 = wait forever.
bonecp.closeConnectionWatchTimeoutInMs=0
#Sets number of statement helper threads to create that will handle releasing a
#statement. When this value is set to zero, the application thread is
#blocked until the pool and JDBC driver are able to close off the
#statement. When a non-zero value is set, the pool will create threads
#that will take care of closing off the statement asychronously to the application
#via the release helper threads). Useful when your application is opening up
#lots of statements otherwise will probably slow things down.
bonecp.statementReleaseHelperThreads=0
#Sets the maxConnectionAge in seconds. Any connections older than this setting will be
#closed off whether it is idle or not. Connections currently in use will
#not be affected until they are returned to the pool.
bonecp.maxConnectionAgeInSeconds=0
#If set to true, keep track of some more statistics for exposure via
#JMX. Will slow down the pool operation.
bonecp.statisticsEnabled=false
#If set to true, no attempts at passing in a username/password will be
#attempted when trying to obtain a raw (driver) connection. Useful for cases when
#you already have another mechanism on authentication eg NTLM.
bonecp.externalAuth=false
applicationContenxt.xml
<!-- load properties file -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:cn/com/config/dataSource/bonecp.properties</value>
</list>
</property>
</bean>
<!-- Configure data sources -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<ref local="boneCPDataSource" />
</property>
</bean>
<bean id="boneCPDataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close">
<!-- BoneCP type -->
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="minConnectionsPerPartition" value="${bonecp.minConnectionsPerPartition}" />
<property name="maxConnectionsPerPartition" value="${bonecp.maxConnectionsPerPartition}" />
<property name="partitionCount" value="${bonecp.partitionCount}" />
<property name="acquireIncrement" value="${bonecp.acquireIncrement}" />
<property name="statementsCacheSize" value="${bonecp.statementsCacheSize}" />
<property name="releaseHelperThreads" value="${bonecp.releaseHelperThreads}" />
</bean>
Copyright notice : This article is an original blog article , Blog , Without consent , Shall not be reproduced .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117391.html Link to the original text :https://javaforall.cn
边栏推荐
- atcoder它A Mountaineer
- 队列的实现
- POJ 2208 已知边四面体六个长度,计算体积
- Compilation principle - top-down analysis and recursive descent analysis construction (notes)
- Jerry is the custom background specified by the currently used dial enable [chapter]
- UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
- Jerry's watch reads the file through the file name [chapter]
- Jerry's access to additional information on the dial [article]
- Take you through ancient Rome, the meta universe bus is coming # Invisible Cities
- 【中山大学】考研初试复试资料分享
猜你喜欢
std::true_type和std::false_type
UDP协议:因性善而简单,难免碰到“城会玩”
2019 Alibaba cluster dataset Usage Summary
MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...
使用cpolar建立一个商业网站(1)
287. Find duplicates
1700C - Helping the Nature
[the 300th weekly match of leetcode]
F200 - UAV equipped with domestic open source flight control system based on Model Design
微信为什么使用 SQLite 保存聊天记录?
随机推荐
传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
atcoder它A Mountaineer
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
Grafana 9.0 is officially released! It's the strongest!
Recursive way
Windows连接Linux上安装的Redis
C语言高校实验室预约登记系统
MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...
DOM Brief
std::true_type和std::false_type
Reprint: defect detection technology of industrial components based on deep learning
Unity资源顺序加载的一个方法
Self-supervised Heterogeneous Graph Neural Network with Co-contrastive Learning 论文阅读
Jerry's watch reading setting status [chapter]
测试123
Why does wechat use SQLite to save chat records?
STM32+ENC28J60+UIP协议栈实现WEB服务器示例
Jerry's watch deletes the existing dial file [chapter]
简单易用的PDF转SVG程序
图之广度优先遍历