Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tron-explore
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
张建华@五瓣科技
tron-explore
Commits
5b00ca90
Commit
5b00ca90
authored
Nov 18, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整线程池数量
parent
18fd5782
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
Engine.java
src/main/java/com/wuban/tron/explore/fetch/Engine.java
+8
-4
PersistThreadPool.java
.../java/com/wuban/tron/explore/fetch/PersistThreadPool.java
+2
-2
No files found.
src/main/java/com/wuban/tron/explore/fetch/Engine.java
View file @
5b00ca90
...
...
@@ -45,7 +45,9 @@ public class Engine {
*/
private
AddressBalanceHandler
addressHandler
;
public
static
final
int
FETCHER_NUM
=
10
;
public
static
final
int
BLOCK_FETCHER_NUM
=
10
;
public
static
final
int
BALANCE_FETCHER_NUM
=
3
;
public
Engine
(
String
name
)
{
this
.
executor
=
new
Executor
(
name
);
...
...
@@ -76,8 +78,7 @@ public class Engine {
this
.
handler
=
new
BlockDataHandler
();
this
.
fetcher
=
new
BlockDataFetcher
(
this
.
handler
);
this
.
executor
.
execute
(
this
.
handler
);
//int cupNum = ThreadPoolUtil.getCupNum()*2;
for
(
int
i
=
0
;
i
<=
FETCHER_NUM
;
i
++)
{
for
(
int
i
=
0
;
i
<=
BLOCK_FETCHER_NUM
;
i
++)
{
this
.
executor
.
execute
(
this
.
fetcher
);
}
...
...
@@ -87,9 +88,12 @@ public class Engine {
this
.
addressHandler
=
new
AddressBalanceHandler
();
this
.
addressFetcher
=
new
AddressBalanceFetcher
(
this
.
addressHandler
);
this
.
executor
.
execute
(
this
.
addressHandler
);
this
.
executor
.
execute
(
this
.
addressFetcher
);
for
(
int
i
=
0
;
i
<
BALANCE_FETCHER_NUM
;
i
++)
{
this
.
executor
.
execute
(
this
.
addressFetcher
);
}
}
public
synchronized
void
reload
()
{
this
.
executor
.
shutdown
();
this
.
executor
.
rebuild
();
...
...
src/main/java/com/wuban/tron/explore/fetch/PersistThreadPool.java
View file @
5b00ca90
...
...
@@ -26,10 +26,10 @@ public class PersistThreadPool {
public
PersistThreadPool
()
{
for
(
int
i
=
0
;
i
<
POLL_SIZE
;
i
++)
{
executors
.
add
(
new
ThreadPoolExecutor
(
POLL_SIZE
,
POLL_SIZE
*
5
,
0
,
TimeUnit
.
SECONDS
,
executors
.
add
(
new
ThreadPoolExecutor
(
POLL_SIZE
,
POLL_SIZE
*
2
,
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
new
PersistThreadFactory
(
i
)));
}
log
.
info
(
"初始化线程池 name:{} coreSize:{} maxSize:{}"
,
"PersistThreadPool"
,
POLL_SIZE
,
POLL_SIZE
*
5
);
log
.
info
(
"初始化线程池 name:{} coreSize:{} maxSize:{}"
,
"PersistThreadPool"
,
POLL_SIZE
,
POLL_SIZE
*
2
);
}
public
void
stop
()
{
...
...
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