mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-119 for consistance renamed it to VanillaSharedReplicatedHashMap
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* Created by peter on 18/07/14.
|
||||
*/
|
||||
package net.openhft.chronicle.map;
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Higher Frequency Trading
|
||||
* <p/>
|
||||
* http://www.higherfrequencytrading.com
|
||||
* <p/>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.openhft.collections;
|
||||
|
||||
import net.openhft.chronicle.map.ChronicleMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Rob Austin.
|
||||
*/
|
||||
public class ChronicleReplicatedMap<K, V> extends VanillaSharedReplicatedMap<K, V> implements ChronicleMap<K, V> {
|
||||
|
||||
public ChronicleReplicatedMap(@NotNull SharedHashMapBuilder builder, @NotNull Class aClass, @NotNull Class aClass2) throws IOException {
|
||||
super(builder, aClass, aClass2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Higher Frequency Trading
|
||||
* <p/>
|
||||
* http://www.higherfrequencytrading.com
|
||||
* <p/>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.openhft.collections;
|
||||
|
||||
/**
|
||||
* @author Rob Austin.
|
||||
*/
|
||||
public interface ConcurrentHashMap2 {
|
||||
}
|
||||
@@ -297,8 +297,8 @@ public class SharedHashMapBuilder<K, V> implements Cloneable {
|
||||
if (identifier <= 0)
|
||||
throw new IllegalArgumentException("Identifier must be positive, " + identifier + " given");
|
||||
|
||||
final VanillaSharedReplicatedMap<K, V> result =
|
||||
new VanillaSharedReplicatedMap<K, V>(builder, kClass, vClass);
|
||||
final VanillaSharedReplicatedHashMap<K, V> result =
|
||||
new VanillaSharedReplicatedHashMap<K, V>(builder, kClass, vClass);
|
||||
|
||||
if (externalReplicatorBuilder != null)
|
||||
externalReplicator = applyExternalReplicator(result, externalReplicatorBuilder, kClass, vClass);
|
||||
@@ -617,7 +617,7 @@ public class SharedHashMapBuilder<K, V> implements Cloneable {
|
||||
|
||||
|
||||
<K, V> ExternalReplicator.AbstractExternalReplicator applyExternalReplicator
|
||||
(VanillaSharedReplicatedMap<K, V> map,
|
||||
(VanillaSharedReplicatedHashMap<K, V> map,
|
||||
ExternalReplicatorBuilder builder,
|
||||
Class<K> kClass,
|
||||
Class<V> vClass) {
|
||||
@@ -654,7 +654,7 @@ public class SharedHashMapBuilder<K, V> implements Cloneable {
|
||||
}
|
||||
|
||||
|
||||
<K, V> void applyUdpReplication(VanillaSharedReplicatedMap<K, V> result,
|
||||
<K, V> void applyUdpReplication(VanillaSharedReplicatedHashMap<K, V> result,
|
||||
UdpReplicatorBuilder udpReplicatorBuilder)
|
||||
throws IOException {
|
||||
|
||||
@@ -678,7 +678,7 @@ public class SharedHashMapBuilder<K, V> implements Cloneable {
|
||||
}
|
||||
|
||||
|
||||
<K, V> void applyTcpReplication(@NotNull VanillaSharedReplicatedMap<K, V> result,
|
||||
<K, V> void applyTcpReplication(@NotNull VanillaSharedReplicatedHashMap<K, V> result,
|
||||
@NotNull TcpReplicatorBuilder tcpReplicatorBuilder)
|
||||
throws IOException {
|
||||
|
||||
|
||||
+12
-12
@@ -80,13 +80,13 @@ import static net.openhft.lang.collection.DirectBitSet.NOT_FOUND;
|
||||
* @param <K> the entries key type
|
||||
* @param <V> the entries value type
|
||||
*/
|
||||
class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V>
|
||||
class VanillaSharedReplicatedHashMap<K, V> extends AbstractVanillaSharedHashMap<K, V>
|
||||
implements ChronicleMap<K, V>, ReplicaExternalizable<K, V>, EntryResolver<K, V>,
|
||||
Closeable {
|
||||
|
||||
static final int MAX_UNSIGNED_SHORT = Character.MAX_VALUE;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VanillaSharedReplicatedMap.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VanillaSharedReplicatedHashMap.class);
|
||||
private static final int LAST_UPDATED_HEADER_SIZE = (127 * 8);
|
||||
|
||||
// for file, jdbc and UDP replication
|
||||
@@ -102,9 +102,9 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
private final ModificationDelegator modificationDelegator;
|
||||
private int startOfModificationIterators;
|
||||
|
||||
public VanillaSharedReplicatedMap(@NotNull SharedHashMapBuilder builder,
|
||||
@NotNull Class<K> kClass,
|
||||
@NotNull Class<V> vClass) throws IOException {
|
||||
public VanillaSharedReplicatedHashMap(@NotNull SharedHashMapBuilder builder,
|
||||
@NotNull Class<K> kClass,
|
||||
@NotNull Class<V> vClass) throws IOException {
|
||||
super(builder, kClass, vClass);
|
||||
|
||||
this.timeProvider = builder.timeProvider();
|
||||
@@ -868,7 +868,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
final long entryTimestamp = entry.readLong();
|
||||
|
||||
if (entryTimestamp >= timeStamp &&
|
||||
entry.readByte() == VanillaSharedReplicatedMap.this.identifier())
|
||||
entry.readByte() == VanillaSharedReplicatedHashMap.this.identifier())
|
||||
callback.set(index, pos);
|
||||
}
|
||||
});
|
||||
@@ -887,7 +887,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
// we have to make sure that every calls notifies on remove,
|
||||
// so that the replicators can pick it up
|
||||
for (K k : keySet()) {
|
||||
VanillaSharedReplicatedMap.this.remove(k);
|
||||
VanillaSharedReplicatedHashMap.this.remove(k);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1022,7 +1022,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
throw new IllegalStateException("identifier can't be 0");
|
||||
}
|
||||
|
||||
if (remoteIdentifier == VanillaSharedReplicatedMap.this.identifier()) {
|
||||
if (remoteIdentifier == VanillaSharedReplicatedHashMap.this.identifier()) {
|
||||
// this may occur when working with UDP, as we will receive our own data
|
||||
return;
|
||||
}
|
||||
@@ -1134,7 +1134,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
public void onPut(SharedHashMap<K, V> map, Bytes entry, int metaDataBytes,
|
||||
boolean added, K key, V value, long pos, SharedSegment segment) {
|
||||
|
||||
assert VanillaSharedReplicatedMap.this == map :
|
||||
assert VanillaSharedReplicatedHashMap.this == map :
|
||||
"ModificationIterator.onPut() is called from outside of the parent map";
|
||||
try {
|
||||
nextListener.onPut(map, entry, metaDataBytes, added, key, value, pos, segment);
|
||||
@@ -1161,7 +1161,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
@Override
|
||||
public void onRemove(SharedHashMap<K, V> map, Bytes entry, int metaDataBytes,
|
||||
K key, V value, int pos, SharedSegment segment) {
|
||||
assert VanillaSharedReplicatedMap.this == map :
|
||||
assert VanillaSharedReplicatedHashMap.this == map :
|
||||
"ModificationIterator.onRemove() is called from outside of the parent map";
|
||||
try {
|
||||
nextListener.onRemove(map, entry, metaDataBytes, key, value, pos, segment);
|
||||
@@ -1255,7 +1255,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
public void onPut(SharedHashMap<K, V> map, Bytes entry, int metaDataBytes,
|
||||
boolean added, K key, V value, long pos, SharedSegment segment) {
|
||||
|
||||
assert VanillaSharedReplicatedMap.this == map :
|
||||
assert VanillaSharedReplicatedHashMap.this == map :
|
||||
"ModificationIterator.onPut() is called from outside of the parent map";
|
||||
|
||||
|
||||
@@ -1269,7 +1269,7 @@ class VanillaSharedReplicatedMap<K, V> extends AbstractVanillaSharedHashMap<K, V
|
||||
@Override
|
||||
public void onRemove(SharedHashMap<K, V> map, Bytes entry, int metaDataBytes,
|
||||
K key, V value, int pos, SharedSegment segment) {
|
||||
assert VanillaSharedReplicatedMap.this == map :
|
||||
assert VanillaSharedReplicatedHashMap.this == map :
|
||||
"ModificationIterator.onRemove() is called from outside of the parent map";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user