You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently CompositeEthereumListener invokes all defined listeners on any occurred event which is pretty inefficient. It also impacts on memory consumption.
Possible fix: drive listeners in a pub/sub fashion. It would also nice to have a possibility to define one-off listeners that are detached when a certain event has been caught.
Recap:
use pub/sub pattern to invoke listener only if it has a subscription to a certain event
provide a kind of evict() method that removes listener when current invocation is finished
make listener for one-off events like onSyncDone remove itself in automatic fashion
get rid of trace() and its usage all over the codebase
Example of listener with evict:
ethereum.addListener(new EthereumListenerAdapter() {
@Override
public void onPendingTransactionUpdate(TransactionReceipt txReceipt, PendingTransactionState state, Block block) {
if (FastByteComparisons.equal(depositTxHash, txReceipt.getTransaction().getHash()) &&
state == PendingTransactionState.INCLUDED) {
depositFuture.complete(txReceipt);
evict();
}
}
});
The text was updated successfully, but these errors were encountered:
Currently CompositeEthereumListener invokes all defined listeners on any occurred event which is pretty inefficient. It also impacts on memory consumption.
Possible fix: drive listeners in a pub/sub fashion. It would also nice to have a possibility to define one-off listeners that are detached when a certain event has been caught.
Recap:
evict()
method that removes listener when current invocation is finishedonSyncDone
remove itself in automatic fashionExample of listener with evict:
The text was updated successfully, but these errors were encountered: