Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
DQMP
Project
Project
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
data
DQMP
Commits
9d347b7e
Commit
9d347b7e
authored
Mar 25, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update logs
parent
1e4d4db4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
JdbcConnectPool.java
src/main/java/com/gmei/data/dqmp/pool/JdbcConnectPool.java
+10
-8
No files found.
src/main/java/com/gmei/data/dqmp/pool/JdbcConnectPool.java
View file @
9d347b7e
...
@@ -16,7 +16,7 @@ public class JdbcConnectPool {
...
@@ -16,7 +16,7 @@ public class JdbcConnectPool {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JdbcConnectPool
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JdbcConnectPool
.
class
);
private
static
Properties
prop
;
private
static
Properties
prop
;
private
static
int
currentsize
=
0
;
private
static
int
requestCount
=
0
;
private
static
LinkedList
<
Connection
>
connList
=
new
LinkedList
<
Connection
>();
private
static
LinkedList
<
Connection
>
connList
=
new
LinkedList
<
Connection
>();
static
{
static
{
...
@@ -29,7 +29,7 @@ public class JdbcConnectPool {
...
@@ -29,7 +29,7 @@ public class JdbcConnectPool {
for
(
int
i
=
0
;
i
<
Integer
.
valueOf
(
prop
.
getProperty
(
"initSize"
));
i
++)
{
for
(
int
i
=
0
;
i
<
Integer
.
valueOf
(
prop
.
getProperty
(
"initSize"
));
i
++)
{
Connection
connection
=
createConnect
();
Connection
connection
=
createConnect
();
connList
.
add
(
connection
);
connList
.
add
(
connection
);
currentsize
++;
//
currentsize++;
}
}
}
}
...
@@ -40,19 +40,21 @@ public class JdbcConnectPool {
...
@@ -40,19 +40,21 @@ public class JdbcConnectPool {
*/
*/
public
static
Connection
getConnect
()
{
public
static
Connection
getConnect
()
{
Connection
connection
=
null
;
Connection
connection
=
null
;
if
(
connList
.
size
()
>
0
)
{
int
connSize
=
connList
.
size
();
if
(
connSize
>
0
)
{
connection
=
connList
.
getFirst
();
connection
=
connList
.
getFirst
();
connList
.
removeFirst
();
connList
.
removeFirst
();
currentsize
--;
//
currentsize--;
}
else
{
}
else
{
while
(
c
urrents
ize
<
Integer
.
valueOf
(
prop
.
getProperty
(
"maxSize"
))){
while
(
c
onnS
ize
<
Integer
.
valueOf
(
prop
.
getProperty
(
"maxSize"
))){
connList
.
addLast
(
createConnect
());
connList
.
addLast
(
createConnect
());
currentsize
++;
//
currentsize++;
}
}
connection
=
getConnect
();
connection
=
getConnect
();
}
}
logger
.
info
(
"Current pool size : {}"
,
currentsize
);
requestCount
++;
logger
.
info
(
"connList size : {}"
,
connList
.
size
());
logger
.
info
(
"requestCount : {}"
,
requestCount
);
logger
.
info
(
"connList size : {}"
,
connSize
);
return
connection
;
return
connection
;
}
}
...
...
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