@Test void shouldNotOverwriteCurrentSyncWhenChainsUpdatedButNoBetterChainAvailable() { ignoreFuture(startFinalizedSync()); verify(sync).syncToChain(targetChain); onTargetChainsUpdated(); verifyNoMoreInteractions(sync); }
public void onTargetChainsUpdated() { eventThread.checkOnEventThread(); final boolean currentlySyncing = isSyncActive(); final Optional<InProgressSync> newSync = selectNewSyncTarget(currentlySyncing); if (newSync.isEmpty() && currentlySyncing) { return; } if (!currentlySyncing && newSync.isPresent()) { notifySubscribers(true); } currentSync = newSync; }
SyncController { public void onTargetChainsUpdated() { eventThread.checkOnEventThread(); final boolean currentlySyncing = isSyncActive(); final Optional<InProgressSync> newSync = selectNewSyncTarget(currentlySyncing); if (newSync.isEmpty() && currentlySyncing) { return; } if (!currentlySyncing && newSync.isPresent()) { notifySubscribers(true); } currentSync = newSync; } }
SyncController { public void onTargetChainsUpdated() { eventThread.checkOnEventThread(); final boolean currentlySyncing = isSyncActive(); final Optional<InProgressSync> newSync = selectNewSyncTarget(currentlySyncing); if (newSync.isEmpty() && currentlySyncing) { return; } if (!currentlySyncing && newSync.isPresent()) { notifySubscribers(true); } currentSync = newSync; } SyncController(
      final EventThread eventThread,
      final Executor subscriberExecutor,
      final RecentChainData recentChainData,
      final ChainSelector finalizedTargetChainSelector,
      final ChainSelector nonfinalizedTargetChainSelector,
      final Sync sync); }
SyncController { public void onTargetChainsUpdated() { eventThread.checkOnEventThread(); final boolean currentlySyncing = isSyncActive(); final Optional<InProgressSync> newSync = selectNewSyncTarget(currentlySyncing); if (newSync.isEmpty() && currentlySyncing) { return; } if (!currentlySyncing && newSync.isPresent()) { notifySubscribers(true); } currentSync = newSync; } SyncController(
      final EventThread eventThread,
      final Executor subscriberExecutor,
      final RecentChainData recentChainData,
      final ChainSelector finalizedTargetChainSelector,
      final ChainSelector nonfinalizedTargetChainSelector,
      final Sync sync); void onTargetChainsUpdated(); boolean isSyncActive(); SyncingStatus getSyncStatus(); long subscribeToSyncChanges(final SyncSubscriber subscriber); void unsubscribeFromSyncChanges(final long subscriberId); }
SyncController { public void onTargetChainsUpdated() { eventThread.checkOnEventThread(); final boolean currentlySyncing = isSyncActive(); final Optional<InProgressSync> newSync = selectNewSyncTarget(currentlySyncing); if (newSync.isEmpty() && currentlySyncing) { return; } if (!currentlySyncing && newSync.isPresent()) { notifySubscribers(true); } currentSync = newSync; } SyncController(
      final EventThread eventThread,
      final Executor subscriberExecutor,
      final RecentChainData recentChainData,
      final ChainSelector finalizedTargetChainSelector,
      final ChainSelector nonfinalizedTargetChainSelector,
      final Sync sync); void onTargetChainsUpdated(); boolean isSyncActive(); SyncingStatus getSyncStatus(); long subscribeToSyncChanges(final SyncSubscriber subscriber); void unsubscribeFromSyncChanges(final long subscriberId);  }