Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
52eea5cc
Commit
52eea5cc
authored
Jun 16, 2017
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "use custom connection validator instead of sending SELECT 1 query"
This reverts commit
f6816a26
.
parent
7ffe731a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
29 deletions
+1
-29
DataSourceValidator.java
...ip/framework/apollo/common/utils/DataSourceValidator.java
+0
-27
application.properties
apollo-common/src/main/resources/application.properties
+1
-2
No files found.
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/DataSourceValidator.java
deleted
100644 → 0
View file @
7ffe731a
package
com
.
ctrip
.
framework
.
apollo
.
common
.
utils
;
import
org.apache.tomcat.jdbc.pool.Validator
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.sql.Connection
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
DataSourceValidator
implements
Validator
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DataSourceValidator
.
class
);
private
static
final
int
DEFAULT_VALIDATE_TIMEOUT_IN_SECONDS
=
5
;
@Override
public
boolean
validate
(
Connection
connection
,
int
validateAction
)
{
boolean
isValid
=
false
;
try
{
isValid
=
connection
.
isValid
(
DEFAULT_VALIDATE_TIMEOUT_IN_SECONDS
);
}
catch
(
Throwable
ex
)
{
LOGGER
.
warn
(
"Data source validation error"
,
ex
);
}
return
isValid
;
}
}
apollo-common/src/main/resources/application.properties
View file @
52eea5cc
...
...
@@ -3,8 +3,7 @@ spring.http.converters.preferred-json-mapper=gson
# DataSource
spring.datasource.testWhileIdle
=
true
spring.datasource.testOnBorrow
=
true
spring.datasource.validatorClassName
=
com.ctrip.framework.apollo.common.utils.DataSourceValidator
spring.datasource.validationInterval
=
5000
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.initSQL
=
set names utf8mb4
# Naming strategy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment