mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-25 15:10:18 +01:00
Wallet: Short-circuit runnable creation if executor is SAME_THREAD
This commit is contained in:
parent
b8a1976422
commit
8e58839d81
1 changed files with 10 additions and 6 deletions
|
@ -3229,6 +3229,9 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
|
||||||
private void queueOnTransactionConfidenceChanged(final Transaction tx) {
|
private void queueOnTransactionConfidenceChanged(final Transaction tx) {
|
||||||
checkState(lock.isHeldByCurrentThread());
|
checkState(lock.isHeldByCurrentThread());
|
||||||
for (final ListenerRegistration<WalletEventListener> registration : eventListeners) {
|
for (final ListenerRegistration<WalletEventListener> registration : eventListeners) {
|
||||||
|
if (registration.executor == Threading.SAME_THREAD) {
|
||||||
|
registration.listener.onTransactionConfidenceChanged(this, tx);
|
||||||
|
} else {
|
||||||
registration.executor.execute(new Runnable() {
|
registration.executor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -3237,6 +3240,7 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void maybeQueueOnWalletChanged() {
|
private void maybeQueueOnWalletChanged() {
|
||||||
// Don't invoke the callback in some circumstances, eg, whilst we are re-organizing or fiddling with
|
// Don't invoke the callback in some circumstances, eg, whilst we are re-organizing or fiddling with
|
||||||
|
|
Loading…
Add table
Reference in a new issue