use of io.nuls.utxo.accounts.storage.service.UtxoAccountsStorageService in project nuls by nuls-io.
the class UtxoAccountsModuleBootstrap method start.
@Override
public void start() {
Log.info("start utxoAccountsModule");
// 启动进行本地数据一致性判断与回滚
try {
UtxoAccountsService utxoAccountsService = NulsContext.getServiceBean(UtxoAccountsService.class);
UtxoAccountsStorageService utxoAccountsStorageService = NulsContext.getServiceBean(UtxoAccountsStorageService.class);
BlockService blockService = NulsContext.getServiceBean(BlockService.class);
long hadSynBlockHeight = utxoAccountsStorageService.getHadSynBlockHeight();
// 启动处理数据一致性
if (!utxoAccountsService.validateIntegrityBootstrap(hadSynBlockHeight)) {
Log.error("start utxoAccountsModule fail." + hadSynBlockHeight);
return;
}
} catch (Exception e) {
Log.error(e);
Log.error("start utxoAccountsModule fail.");
return;
}
ScheduledThreadPoolExecutor executor = TaskManager.createScheduledThreadPool(1, new NulsThreadFactory(UtxoAccountsConstant.MODULE_ID_UTXOACCOUNTS, "utxoAccountsThread"));
executor.scheduleAtFixedRate(NulsContext.getServiceBean(UtxoAccountsThread.class), 15, 1, TimeUnit.SECONDS);
}
Aggregations