diff --git a/src/main/java/net/openhft/chronicle/hash/ChecksumEntry.java b/src/main/java/net/openhft/chronicle/hash/ChecksumEntry.java index c55e2a5f8..1ed32abb9 100644 --- a/src/main/java/net/openhft/chronicle/hash/ChecksumEntry.java +++ b/src/main/java/net/openhft/chronicle/hash/ChecksumEntry.java @@ -29,8 +29,9 @@ public interface ChecksumEntry { * Re-computes and stores checksum for the entry. This method shouldn't be called before * or after ordinary operations like {@link MapAbsentEntry#doInsert(Data)}, {@link * MapEntry#doReplaceValue(Data)}: it is performed automatically underneath. Call this method, - * only when value bytes was updated directly, for example though Chronicle-Value-generated - * interface. + * only when value bytes was updated directly, for example though flyweight implementation of + * a value + * interface. */ void updateChecksum(); diff --git a/src/main/java/net/openhft/chronicle/hash/locks/InterProcessLock.java b/src/main/java/net/openhft/chronicle/hash/locks/InterProcessLock.java index 8daaad693..c77eebe44 100644 --- a/src/main/java/net/openhft/chronicle/hash/locks/InterProcessLock.java +++ b/src/main/java/net/openhft/chronicle/hash/locks/InterProcessLock.java @@ -37,7 +37,7 @@ import java.util.concurrent.locks.Lock; * thread is beneficial form performance point-of-view, e. g. fields of the on-heap * {@code InterProcessLock} object shouldn't be {@code volatile}. * - *

Locks is inter-process, hence it cannot afford to wait for acquisition infinitely, because + *

Lock is inter-process, hence it cannot afford to wait for acquisition infinitely, because * it would be too dead-lock prone. {@link #lock()} throws {@code RuntimeException} after some * finite time. * diff --git a/src/main/java/net/openhft/chronicle/hash/replication/AcceptanceDecision.java b/src/main/java/net/openhft/chronicle/hash/replication/AcceptanceDecision.java deleted file mode 100644 index 5610d8a5f..000000000 --- a/src/main/java/net/openhft/chronicle/hash/replication/AcceptanceDecision.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2015 higherfrequencytrading.com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package net.openhft.chronicle.hash.replication; - -import net.openhft.chronicle.hash.ChronicleHash; -import net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy; -import net.openhft.chronicle.map.replication.MapRemoteOperations; -import net.openhft.chronicle.set.replication.SetRemoteOperations; - -/** - * Decision, if {@link MapRemoteOperations remote modification operation} should be accepted - * or discarded. Used in {@link DefaultEventualConsistencyStrategy}. - */ -public enum AcceptanceDecision { - /** - * Acceptance decision -- the remote modification operation is applied to the local - * {@link ChronicleHash} state. - */ - ACCEPT, - - /** - * Discard decision -- the remote modification operation is rejected. - */ - DISCARD -} 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 fd790db78..2a3981de2 100644 --- a/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java +++ b/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java @@ -21,9 +21,6 @@ import net.openhft.chronicle.hash.ChronicleHashBuilder; import net.openhft.chronicle.map.replication.MapRemoteOperations; import net.openhft.chronicle.set.replication.SetRemoteOperations; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.ACCEPT; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.DISCARD; - /** * Specifies the default eventual consistency strategy for {@link ChronicleHashBuilder#replication( * byte) replicated} {@link ChronicleHash}es: @@ -53,8 +50,25 @@ public final class DefaultEventualConsistencyStrategy { boolean shouldAccept = remoteTimestamp > originTimestamp || (remoteTimestamp == originTimestamp && context.remoteIdentifier() <= entry.originIdentifier()); - return shouldAccept ? ACCEPT : DISCARD; + return shouldAccept ? AcceptanceDecision.ACCEPT : AcceptanceDecision.DISCARD; } private DefaultEventualConsistencyStrategy() {} + + /** + * Decision, if {@link MapRemoteOperations remote modification operation} should be accepted + * or discarded. Used in {@link DefaultEventualConsistencyStrategy}. + */ + public enum AcceptanceDecision { + /** + * Acceptance decision -- the remote modification operation is applied to the local + * {@link ChronicleHash} state. + */ + ACCEPT, + + /** + * Discard decision -- the remote modification operation is rejected. + */ + DISCARD + } } diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/StatefulCopyable.java b/src/main/java/net/openhft/chronicle/hash/serialization/StatefulCopyable.java index 41b4b7fb8..b38af1688 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/StatefulCopyable.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/StatefulCopyable.java @@ -54,7 +54,7 @@ public interface StatefulCopyable> { /** * Creates a copy of this marshaller, with independent state. The current state itself shouldn't * be copied (it could be "clear" in the copy), only "configuration" of the instance, on which - * {@code copy()} is called, should be inherited in the copy (e. g. the class of object + * {@code copy()} is called, should be inherited in the copy (e. g. the class of objects * serialized). So, {@code copy()} should be transitive, i. e. {@code marshaller.copy()} and * {@code marshaller.copy().copy()} should result to identical instances. * diff --git a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java index 4dad860b3..971549cd4 100644 --- a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java +++ b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java @@ -48,7 +48,7 @@ import static net.openhft.chronicle.map.Replica.ModificationIterator; /** * @author Rob Austin. */ -public final class ChannelProvider implements Closeable { +final class ChannelProvider implements Closeable { private static final Logger LOG = LoggerFactory.getLogger(ChannelProvider.class.getName()); static final Map implMapping = new IdentityHashMap<>(); diff --git a/src/main/java/net/openhft/chronicle/map/OldDeletedEntriesCleanup.java b/src/main/java/net/openhft/chronicle/map/OldDeletedEntriesCleanup.java index a243c76fd..6d437a7f4 100644 --- a/src/main/java/net/openhft/chronicle/map/OldDeletedEntriesCleanup.java +++ b/src/main/java/net/openhft/chronicle/map/OldDeletedEntriesCleanup.java @@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import java.util.function.Predicate; -public class OldDeletedEntriesCleanup implements Runnable, Closeable, Predicate { +class OldDeletedEntriesCleanup implements Runnable, Closeable, Predicate { private static final Logger LOG = LoggerFactory.getLogger(OldDeletedEntriesCleanup.class); private final ReplicatedChronicleMap map; diff --git a/src/main/java/net/openhft/chronicle/map/replication/MapRemoteOperations.java b/src/main/java/net/openhft/chronicle/map/replication/MapRemoteOperations.java index 6f1f3dd1a..79c22c3a8 100644 --- a/src/main/java/net/openhft/chronicle/map/replication/MapRemoteOperations.java +++ b/src/main/java/net/openhft/chronicle/map/replication/MapRemoteOperations.java @@ -24,8 +24,8 @@ import net.openhft.chronicle.map.ChronicleMapBuilder; import net.openhft.chronicle.map.MapAbsentEntry; import net.openhft.chronicle.map.MapEntryOperations; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.ACCEPT; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.DISCARD; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.ACCEPT; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.DISCARD; import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.decideOnRemoteModification; /** diff --git a/src/main/java/net/openhft/chronicle/set/replication/SetRemoteOperations.java b/src/main/java/net/openhft/chronicle/set/replication/SetRemoteOperations.java index b69c67423..9bea427a6 100644 --- a/src/main/java/net/openhft/chronicle/set/replication/SetRemoteOperations.java +++ b/src/main/java/net/openhft/chronicle/set/replication/SetRemoteOperations.java @@ -19,8 +19,8 @@ package net.openhft.chronicle.set.replication; import net.openhft.chronicle.hash.replication.ReplicableEntry; import net.openhft.chronicle.set.SetAbsentEntry; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.ACCEPT; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.DISCARD; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.ACCEPT; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.DISCARD; import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.decideOnRemoteModification; public interface SetRemoteOperations { diff --git a/src/test/java/net/openhft/chronicle/set/SetRemoteOperationsTest.java b/src/test/java/net/openhft/chronicle/set/SetRemoteOperationsTest.java index 3462b7c51..ed71d7231 100644 --- a/src/test/java/net/openhft/chronicle/set/SetRemoteOperationsTest.java +++ b/src/test/java/net/openhft/chronicle/set/SetRemoteOperationsTest.java @@ -32,8 +32,8 @@ import java.net.InetSocketAddress; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.ACCEPT; -import static net.openhft.chronicle.hash.replication.AcceptanceDecision.DISCARD; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.ACCEPT; +import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.AcceptanceDecision.DISCARD; import static net.openhft.chronicle.hash.replication.DefaultEventualConsistencyStrategy.decideOnRemoteModification; import static org.junit.Assert.assertEquals;