use of org.aion.evtmgr.impl.es.EventExecuteService in project aion by aionnetwork.
the class ApiAion method startES.
protected void startES(String thName) {
ees = new EventExecuteService(100_000, thName, Thread.MIN_PRIORITY, LOG);
ees.setFilter(setEvtfilter());
ees.start(new EpApi());
}
use of org.aion.evtmgr.impl.es.EventExecuteService in project aion by aionnetwork.
the class AionPendingStateImpl method init.
public void init(final AionBlockchainImpl blockchain) {
this.blockchain = blockchain;
this.transactionStore = blockchain.getTransactionStore();
this.evtMgr = blockchain.getEventMgr();
this.pendingTxCache = new PendingTxCache(CfgAion.inst().getTx().getCacheMax());
this.pendingState = repository.startTracking();
ees = new EventExecuteService(1000, "EpPS", Thread.MAX_PRIORITY, LOG);
ees.setFilter(setEvtFilter());
regBlockEvents();
IHandler blkHandler = this.evtMgr.getHandler(2);
if (blkHandler != null) {
blkHandler.eventCallback(new EventCallback(ees, LOG));
}
ees.start(new EpPS());
}
use of org.aion.evtmgr.impl.es.EventExecuteService in project aion by aionnetwork.
the class AionPoW method init.
/**
* Initializes this instance.
*
* @param blockchain
* Aion blockchain instance
* @param pendingState
* List of Aion transactions
* @param eventMgr
* Event manager
*/
public void init(IAionBlockchain blockchain, IPendingState<AionTransaction> pendingState, IEventMgr eventMgr) {
if (initialized.compareAndSet(false, true)) {
this.blockchain = blockchain;
this.pendingState = pendingState;
this.eventMgr = eventMgr;
this.syncMgr = SyncMgr.inst();
setupHandler();
ees = new EventExecuteService(100_000, "EpPow", Thread.NORM_PRIORITY, LOG);
ees.setFilter(setEvtFilter());
registerCallback();
ees.start(new EpPOW());
new Thread(() -> {
while (!shutDown.get()) {
try {
Thread.sleep(100);
long now = System.currentTimeMillis();
if (now - lastUpdate.get() > 3000 && newPendingTxReceived.compareAndSet(true, false) || now - lastUpdate.get() > 10000) {
// fallback, when
// we never
// received any
// events
createNewBlockTemplate();
}
} catch (InterruptedException e) {
break;
}
}
}, "pow").start();
}
}
Aggregations