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
ef3a0a68
Commit
ef3a0a68
authored
Dec 28, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计区块大小功能调整
parent
2400d4b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
BlockDataFetcher.java
...n/java/com/wuban/tron/explore/fetch/BlockDataFetcher.java
+1
-1
Executor.java
src/main/java/com/wuban/tron/explore/fetch/Executor.java
+1
-1
PersistThreadPoolV2.java
...ava/com/wuban/tron/explore/fetch/PersistThreadPoolV2.java
+2
-2
TransactionServiceImpl.java
...ban/tron/explore/service/impl/TransactionServiceImpl.java
+7
-11
No files found.
src/main/java/com/wuban/tron/explore/fetch/BlockDataFetcher.java
View file @
ef3a0a68
...
...
@@ -53,7 +53,7 @@ public class BlockDataFetcher<T> extends AbstractJob implements IBlockDataFetche
num
=
Long
.
valueOf
(
blockNumStr
);
TronResponseData
data
=
tronService
.
getBlockByNum
(
num
);
if
(
data
!=
null
)
{
log
.
info
(
"已抓取数据区块高度 num:{}"
,
num
);
//
log.info("已抓取数据区块高度 num:{}", num);
dataList
.
add
(
data
);
}
}
...
...
src/main/java/com/wuban/tron/explore/fetch/Executor.java
View file @
ef3a0a68
...
...
@@ -20,7 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@Slf4j
public
class
Executor
{
private
static
final
int
SIZE
=
5
;
private
static
final
int
SIZE
=
6
;
private
final
List
<
AbstractJob
>
jobList
=
new
ArrayList
<>();
private
final
String
name
;
private
ThreadPoolExecutor
pool
;
...
...
src/main/java/com/wuban/tron/explore/fetch/PersistThreadPoolV2.java
View file @
ef3a0a68
...
...
@@ -26,10 +26,10 @@ public class PersistThreadPoolV2 {
private
PersistThreadPoolV2
()
{
for
(
int
i
=
0
;
i
<
POLL_SIZE
;
i
++)
{
executors
.
add
(
new
ThreadPoolExecutor
(
POLL_SIZE
,
POLL_SIZE
*
2
,
10L
,
TimeUnit
.
SECONDS
,
executors
.
add
(
new
ThreadPoolExecutor
(
POLL_SIZE
*
3
,
POLL_SIZE
*
3
,
10L
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
new
PersistThreadFactory
(
i
)));
}
log
.
info
(
"数据持久化-线程池 name:{} coreSize:{} maxSize:{}"
,
"PersistThreadPool"
,
POLL_SIZE
*
POLL_SIZE
,
POLL_SIZE
*
POLL_SIZE
*
2
);
log
.
info
(
"数据持久化-线程池 name:{} coreSize:{} maxSize:{}"
,
"PersistThreadPool"
,
POLL_SIZE
*
3
,
POLL_SIZE
*
POLL_SIZE
*
3
);
}
public
static
PersistThreadPoolV2
getInstance
()
{
...
...
src/main/java/com/wuban/tron/explore/service/impl/TransactionServiceImpl.java
View file @
ef3a0a68
...
...
@@ -108,6 +108,10 @@ public class TransactionServiceImpl implements TransactionService {
Set
<
String
>
conAddrSet
=
new
HashSet
<>();
if
(
transactionList
.
size
()
!=
0
)
{
censusTransNumber
=
transactionList
.
size
();
// 数据统计
this
.
censusFlushRedis
(
censusBlockSize
,
censusTransNumber
);
transactionList
.
forEach
(
o
->
{
// hex 数据转换成base58
String
ownerAddress
;
...
...
@@ -149,11 +153,9 @@ public class TransactionServiceImpl implements TransactionService {
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
this
.
addressRepository
.
batchInsertOnDuplicateKey
(
records
);
}
addressPushRedis
(
hexSet
);
conAddrPushRedis
(
conAddrSet
);
// 数据统计
this
.
censusFlushRedis
(
censusBlockSize
,
censusTransNumber
);
}
}
...
...
@@ -299,14 +301,8 @@ public class TransactionServiceImpl implements TransactionService {
* @param transNumber
*/
private
void
censusFlushRedis
(
String
blockSize
,
Integer
transNumber
)
{
String
zero
=
"0"
;
if
(!
StringUtils
.
isEmpty
(
blockSize
)
&&
!
blockSize
.
equals
(
zero
))
{
this
.
stringRedisTemplate
.
opsForList
().
leftPush
(
Constant
.
CENSUS_BLOCK_SIZE
,
blockSize
);
}
if
(
transNumber
!=
0
)
{
this
.
stringRedisTemplate
.
opsForList
().
leftPush
(
Constant
.
CENSUS_TRANS
,
transNumber
.
toString
());
}
this
.
stringRedisTemplate
.
opsForList
().
leftPush
(
Constant
.
CENSUS_BLOCK_SIZE
,
blockSize
);
this
.
stringRedisTemplate
.
opsForList
().
leftPush
(
Constant
.
CENSUS_TRANS
,
transNumber
.
toString
());
}
@Override
...
...
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