@Test public void testShouldReplicate() { GroupMember member = new GroupMember(new NodeEndpoint("A", "localhost", 2333)); member.setReplicatingState(new ReplicatingState(10)); Assert.assertTrue(member.shouldReplicate(1000)); member.replicateNow(); Assert.assertFalse(member.shouldReplicate(1000)); Assert.assertTrue(member.shouldReplicate(0)); member.stopReplicating(); Assert.assertTrue(member.shouldReplicate(1000)); }
boolean shouldReplicate(long readTimeout) { ReplicatingState replicatingState = ensureReplicatingState(); return !replicatingState.isReplicating() || System.currentTimeMillis() - replicatingState.getLastReplicatedAt() >= readTimeout; }
GroupMember { boolean shouldReplicate(long readTimeout) { ReplicatingState replicatingState = ensureReplicatingState(); return !replicatingState.isReplicating() || System.currentTimeMillis() - replicatingState.getLastReplicatedAt() >= readTimeout; } }
GroupMember { boolean shouldReplicate(long readTimeout) { ReplicatingState replicatingState = ensureReplicatingState(); return !replicatingState.isReplicating() || System.currentTimeMillis() - replicatingState.getLastReplicatedAt() >= readTimeout; } GroupMember(NodeEndpoint endpoint);   GroupMember(NodeEndpoint endpoint, ReplicatingState replicatingState, boolean major); }
GroupMember { boolean shouldReplicate(long readTimeout) { ReplicatingState replicatingState = ensureReplicatingState(); return !replicatingState.isReplicating() || System.currentTimeMillis() - replicatingState.getLastReplicatedAt() >= readTimeout; } GroupMember(NodeEndpoint endpoint);   GroupMember(NodeEndpoint endpoint, ReplicatingState replicatingState, boolean major); @Override String toString(); }
GroupMember { boolean shouldReplicate(long readTimeout) { ReplicatingState replicatingState = ensureReplicatingState(); return !replicatingState.isReplicating() || System.currentTimeMillis() - replicatingState.getLastReplicatedAt() >= readTimeout; } GroupMember(NodeEndpoint endpoint);   GroupMember(NodeEndpoint endpoint, ReplicatingState replicatingState, boolean major); @Override String toString();  }