@Test public void testOnMasterDisconnected() { listener = spy(listener); listener.onMasterDisconnected(); verify(listener, never()).releaseToken(); listener.holdToken.set(true); listener.onMasterDisconnected(); verify(listener, times(1)).releaseToken(); }
@Override public void onMasterDisconnected() { if (holdToken.compareAndSet(true, false)) { releaseToken(); } if (releaseTokenFuture != null && !releaseTokenFuture.isDone()) { releaseTokenFuture.cancel(true); releaseTokenFuture = null; } }
LeakyBucketBasedMasterReplicationListener implements RedisMasterReplication.RedisMasterReplicationObserver { @Override public void onMasterDisconnected() { if (holdToken.compareAndSet(true, false)) { releaseToken(); } if (releaseTokenFuture != null && !releaseTokenFuture.isDone()) { releaseTokenFuture.cancel(true); releaseTokenFuture = null; } } }
LeakyBucketBasedMasterReplicationListener implements RedisMasterReplication.RedisMasterReplicationObserver { @Override public void onMasterDisconnected() { if (holdToken.compareAndSet(true, false)) { releaseToken(); } if (releaseTokenFuture != null && !releaseTokenFuture.isDone()) { releaseTokenFuture.cancel(true); releaseTokenFuture = null; } } LeakyBucketBasedMasterReplicationListener(RedisMasterReplication redisMasterReplication,
                                                     RedisKeeperServer redisKeeperServer,
                                                     KeeperResourceManager resourceManager,
                                                     ScheduledExecutorService scheduled); }
LeakyBucketBasedMasterReplicationListener implements RedisMasterReplication.RedisMasterReplicationObserver { @Override public void onMasterDisconnected() { if (holdToken.compareAndSet(true, false)) { releaseToken(); } if (releaseTokenFuture != null && !releaseTokenFuture.isDone()) { releaseTokenFuture.cancel(true); releaseTokenFuture = null; } } LeakyBucketBasedMasterReplicationListener(RedisMasterReplication redisMasterReplication,
                                                     RedisKeeperServer redisKeeperServer,
                                                     KeeperResourceManager resourceManager,
                                                     ScheduledExecutorService scheduled); @Override void onMasterConnected(); @Override boolean canSendPsync(); @Override void onMasterDisconnected(); @Override void endWriteRdb(); @Override void onContinue(String requestReplId, String responseReplId); @Override void onFullSync(); @Override void reFullSync(); @Override void onDumpFinished(); @Override void onDumpFail(); @Override void beginWriteRdb(EofType eofType, long masterRdbOffset); }
LeakyBucketBasedMasterReplicationListener implements RedisMasterReplication.RedisMasterReplicationObserver { @Override public void onMasterDisconnected() { if (holdToken.compareAndSet(true, false)) { releaseToken(); } if (releaseTokenFuture != null && !releaseTokenFuture.isDone()) { releaseTokenFuture.cancel(true); releaseTokenFuture = null; } } LeakyBucketBasedMasterReplicationListener(RedisMasterReplication redisMasterReplication,
                                                     RedisKeeperServer redisKeeperServer,
                                                     KeeperResourceManager resourceManager,
                                                     ScheduledExecutorService scheduled); @Override void onMasterConnected(); @Override boolean canSendPsync(); @Override void onMasterDisconnected(); @Override void endWriteRdb(); @Override void onContinue(String requestReplId, String responseReplId); @Override void onFullSync(); @Override void reFullSync(); @Override void onDumpFinished(); @Override void onDumpFail(); @Override void beginWriteRdb(EofType eofType, long masterRdbOffset);  }