From 2928d18d11b4e4a0433a5eefd2309323d6542838 Mon Sep 17 00:00:00 2001 From: leventov Date: Sat, 26 Dec 2015 22:27:35 +0300 Subject: [PATCH] Fix the prev commit 02b2c90 for ChronicleSet --- .../hash/replication/DefaultEventualConsistencyStrategy.java | 4 ++-- .../chronicle/hash/replication/RemoteOperationContext.java | 2 ++ .../map/impl/stage/replication/ReplicationUpdate.java | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java b/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java index 75203469c..89e062b21 100644 --- a/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java +++ b/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java @@ -71,9 +71,9 @@ public final class DefaultEventualConsistencyStrategy { // lost. (This is almost a theoretical situation.) In this case, give advantage to fresh // entry updates to the "new" node. Entries with the same id and timestamp, bootstrapped // "back" from other nodes in the system, are discarded on this new node (this is the - // of the condition originIdentifier == thisReplica.identifier()). But those new updates + // of the condition originIdentifier == currentNodeIdentifier). But those new updates // should win on other nodes. - return originIdentifier == ((Replica) context.hash()).identifier() ? DISCARD : ACCEPT; + return originIdentifier == context.currentNodeIdentifier() ? DISCARD : ACCEPT; } private DefaultEventualConsistencyStrategy() {} diff --git a/src/main/java/net/openhft/chronicle/hash/replication/RemoteOperationContext.java b/src/main/java/net/openhft/chronicle/hash/replication/RemoteOperationContext.java index 32e577a8b..bbc754562 100644 --- a/src/main/java/net/openhft/chronicle/hash/replication/RemoteOperationContext.java +++ b/src/main/java/net/openhft/chronicle/hash/replication/RemoteOperationContext.java @@ -29,4 +29,6 @@ public interface RemoteOperationContext extends HashContext { byte remoteIdentifier(); long remoteTimestamp(); + + byte currentNodeIdentifier(); } diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/replication/ReplicationUpdate.java b/src/main/java/net/openhft/chronicle/map/impl/stage/replication/ReplicationUpdate.java index 5e18e0012..587f67711 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/replication/ReplicationUpdate.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/replication/ReplicationUpdate.java @@ -77,4 +77,9 @@ public abstract class ReplicationUpdate implements RemoteOperationContext checkOnEachPublicOperation.checkOnEachPublicOperation(); return innerRemoteIdentifier; } + + @Override + public byte currentNodeIdentifier() { + return mh.m().identifier(); + } }