mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-85 HCOLL-142 JLANG-29 Featured serializers
This commit is contained in:
@@ -66,14 +66,14 @@ public class Builder {
|
||||
.create(getPersistenceFile());
|
||||
}
|
||||
|
||||
static MapProvider<ReplicatedChronicleMap<Integer, Integer>> newShmIntInt(
|
||||
static MapProvider<ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?>> newShmIntInt(
|
||||
int size, final ArrayBlockingQueue<byte[]> input,
|
||||
final ArrayBlockingQueue<byte[]> output,
|
||||
final byte localIdentifier, byte externalIdentifier) throws IOException {
|
||||
|
||||
Replicator queue = QueueReplicator.of(localIdentifier, externalIdentifier, input, output);
|
||||
final ReplicatedChronicleMap<Integer, Integer> result =
|
||||
(ReplicatedChronicleMap<Integer, Integer>) ChronicleMapBuilder
|
||||
final ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?> result =
|
||||
(ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?>) ChronicleMapBuilder
|
||||
.of(Integer.class, Integer.class)
|
||||
.entries(size)
|
||||
.addReplicator(queue)
|
||||
@@ -88,10 +88,10 @@ public class Builder {
|
||||
if (q == null)
|
||||
throw new AssertionError();
|
||||
final QueueReplicator finalQ = q;
|
||||
return new MapProvider<ReplicatedChronicleMap<Integer, Integer>>() {
|
||||
return new MapProvider<ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?>>() {
|
||||
|
||||
@Override
|
||||
public ReplicatedChronicleMap<Integer, Integer> getMap() {
|
||||
public ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?> getMap() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -514,21 +514,15 @@ public class ChronicleMapTest {
|
||||
for (int j = 1; j <= 3; j++) {
|
||||
for (int i = 0; i < entries; i++) {
|
||||
CharSequence userCS = getUserCharSequence(i);
|
||||
if (i * 9876 == 829682760) {
|
||||
System.out.println(1);
|
||||
}
|
||||
|
||||
if (j > 1) {
|
||||
if (i == 1) {
|
||||
System.out.println(1);
|
||||
}
|
||||
assertNotNull(userCS.toString(), map.getUsing(userCS, value));
|
||||
} else {
|
||||
map.acquireUsing(userCS, value);
|
||||
}
|
||||
if (i >= 1)
|
||||
assertTrue(userCS.toString(), map.containsKey(getUserCharSequence(1)));
|
||||
assertEquals(j - 1, value.getValue());
|
||||
assertEquals(userCS.toString(), j - 1, value.getValue());
|
||||
|
||||
value.addAtomicValue(1);
|
||||
|
||||
@@ -1174,23 +1168,23 @@ public class ChronicleMapTest {
|
||||
.entrySize(10);
|
||||
builder.entryAndValueAlignment(NO_ALIGNMENT);
|
||||
testOversizeEntriesPutRemoveReplace(
|
||||
(VanillaChronicleMap<CharSequence, CharSequence>)
|
||||
(VanillaChronicleMap<CharSequence, ?, ?, CharSequence, ?, ?>)
|
||||
builder.create(getPersistenceFile())
|
||||
);
|
||||
builder.entryAndValueAlignment(Alignment.OF_4_BYTES);
|
||||
testOversizeEntriesPutRemoveReplace(
|
||||
(VanillaChronicleMap<CharSequence, CharSequence>)
|
||||
(VanillaChronicleMap<CharSequence, ?, ?, CharSequence, ?, ?>)
|
||||
builder.create(getPersistenceFile())
|
||||
);
|
||||
builder.entryAndValueAlignment(OF_8_BYTES);
|
||||
testOversizeEntriesPutRemoveReplace(
|
||||
(VanillaChronicleMap<CharSequence, CharSequence>)
|
||||
(VanillaChronicleMap<CharSequence, ?, ?, CharSequence, ?, ?>)
|
||||
builder.create(getPersistenceFile())
|
||||
);
|
||||
}
|
||||
|
||||
public void testOversizeEntriesPutRemoveReplace(
|
||||
VanillaChronicleMap<CharSequence, CharSequence> map) {
|
||||
VanillaChronicleMap<CharSequence, ?, ?, CharSequence, ?, ?> map) {
|
||||
String key = "k";
|
||||
String oversizedKey = "oversized key";
|
||||
String value = "v";
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.chronicle.map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -33,10 +33,10 @@ public class MultiMapTimeBaseReplicationTest {
|
||||
|
||||
private Replica.ModificationIterator segmentModificationIterator2;
|
||||
private Replica.ModificationIterator segmentModificationIterator1;
|
||||
private Builder.MapProvider<ReplicatedChronicleMap<Integer, Integer>> mapP1;
|
||||
private Builder.MapProvider<ReplicatedChronicleMap<Integer, Integer>> mapP2;
|
||||
private ReplicatedChronicleMap<Integer, Integer> map2;
|
||||
private ReplicatedChronicleMap<Integer, Integer> map1;
|
||||
private Builder.MapProvider<ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?>> mapP1;
|
||||
private Builder.MapProvider<ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?>> mapP2;
|
||||
private ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?> map2;
|
||||
private ReplicatedChronicleMap<Integer, ?, ?, Integer, ?, ?> map1;
|
||||
|
||||
|
||||
private ArrayBlockingQueue<byte[]> map1ToMap2;
|
||||
|
||||
@@ -37,7 +37,7 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TCPSocketReplicationBootStrapTests {
|
||||
|
||||
private ReplicatedChronicleMap<Integer, CharSequence> map1;
|
||||
private ReplicatedChronicleMap<Integer, ?, ?, CharSequence, ?, ?> map1;
|
||||
private ChronicleMap<Integer, CharSequence> map2;
|
||||
|
||||
@Test
|
||||
@@ -89,8 +89,8 @@ public class TCPSocketReplicationBootStrapTests {
|
||||
map1 = newTcpSocketShmIntString((byte) 1, 8079, new InetSocketAddress("localhost", 8076));
|
||||
ChronicleMapBuilder<Integer, CharSequence> map2aBuilder =
|
||||
newTcpSocketShmBuilder(Integer.class, CharSequence.class, (byte) 2, 8076);
|
||||
final ReplicatedChronicleMap<Integer, CharSequence> map2a =
|
||||
(ReplicatedChronicleMap<Integer, CharSequence>)
|
||||
final ReplicatedChronicleMap<Integer, ?, ?, CharSequence, ?, ?> map2a =
|
||||
(ReplicatedChronicleMap<Integer, ?, ?, CharSequence, ?, ?>)
|
||||
map2aBuilder.create(getPersistenceFile());
|
||||
|
||||
map2a.put(10, "EXAMPLE-10"); // this will be the last time that map1 go an update from map2
|
||||
|
||||
Reference in New Issue
Block a user