HCOLL-163 renamed channel replicator to channel provider

This commit is contained in:
Rob Austin
2014-10-13 19:03:43 +01:00
parent 02072f0e8a
commit 2aff512767
10 changed files with 90 additions and 72 deletions
@@ -17,7 +17,10 @@
package net.openhft.chronicle.map;
import org.junit.*;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.Closeable;
import java.io.IOException;
@@ -40,8 +43,8 @@ public class ChannelReplicationTest {
private ChronicleMap<Integer, CharSequence> map1b;
private ChronicleMap<Integer, CharSequence> map2b;
private ChannelReplicator channelReplicatorA;
private ChannelReplicator channelReplicatorB;
private ChannelProvider channelProviderA;
private ChannelProvider channelProviderB;
@Before
@@ -52,13 +55,13 @@ public class ChannelReplicationTest {
.of(8086, new InetSocketAddress("localhost", 8087))
.heartBeatInterval(1, SECONDS);
channelReplicatorA = new ChannelReplicatorBuilder((byte) 1, 1024)
.tcpReplication(tcpConfig)
.create();
channelProviderA = new ChannelProviderBuilder()
.replicators((byte) 1, tcpConfig)
.create();
map1a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorA.createChannel((short) 1))
.channel(channelProviderA.createChannel((short) 1))
.create(getPersistenceFile());
}
@@ -66,12 +69,12 @@ public class ChannelReplicationTest {
TcpReplicationConfig tcpConfig =
TcpReplicationConfig.of(8087).heartBeatInterval(1, SECONDS);
channelReplicatorB = new ChannelReplicatorBuilder((byte) 2, 1024).tcpReplication(tcpConfig)
channelProviderB = new ChannelProviderBuilder().replicators((byte) 2, tcpConfig)
.create();
map1b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorB.createChannel((short) 1))
.channel(channelProviderB.createChannel((short) 1))
.create(getPersistenceFile());
}
}
@@ -79,7 +82,7 @@ public class ChannelReplicationTest {
@After
public void tearDown() throws InterruptedException {
for (final Closeable closeable : new Closeable[]{channelReplicatorA, channelReplicatorB}) {
for (final Closeable closeable : new Closeable[]{channelProviderA, channelProviderB}) {
try {
closeable.close();
} catch (IOException e) {
@@ -94,13 +97,13 @@ public class ChannelReplicationTest {
map2b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorB.createChannel((short) 2))
.channel(channelProviderB.createChannel((short) 2))
.create(getPersistenceFile());
map2a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorA.createChannel((short) 2))
.channel(channelProviderA.createChannel((short) 2))
.create(getPersistenceFile());
map2a.put(1, "EXAMPLE-2");
@@ -43,8 +43,8 @@ public class PostClusterMapCreationTest {
private ChronicleMap<Integer, CharSequence> map1b;
private ChronicleMap<Integer, CharSequence> map2b;
private ChannelReplicator channelReplicatorA;
private ChannelReplicator channelReplicatorB;
private ChannelProvider channelProviderA;
private ChannelProvider channelProviderB;
public static File getPersistenceFile() {
String TMP = System.getProperty("java.io.tmpdir");
@@ -59,43 +59,43 @@ public class PostClusterMapCreationTest {
public void setup() throws IOException {
{
final TcpReplicationConfig tcpReplicationConfig = TcpReplicationConfig
final TcpReplicationConfig tcpConfig = TcpReplicationConfig
.of(8086, new InetSocketAddress("localhost", 8087))
.heartBeatInterval(1, SECONDS);
channelReplicatorA = new ChannelReplicatorBuilder((byte) 1, 1024)
.tcpReplication(tcpReplicationConfig).create();
channelProviderA = new ChannelProviderBuilder()
.replicators((byte) 1, tcpConfig).create();
// this is how you add maps after the custer is created
map1a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorA.createChannel((short) 1))
.channel(channelProviderA.createChannel((short) 1))
.create(getPersistenceFile());
map2a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorA.createChannel((short) 2))
.channel(channelProviderA.createChannel((short) 2))
.create(getPersistenceFile());
}
{
final TcpReplicationConfig tcpReplicationConfig = TcpReplicationConfig
final TcpReplicationConfig tcpConfig = TcpReplicationConfig
.of(8087, new InetSocketAddress("localhost", 8086))
.heartBeatInterval(1, SECONDS);
channelReplicatorB = new ChannelReplicatorBuilder((byte) 2, 1024)
.tcpReplication(tcpReplicationConfig).create();
channelProviderB = new ChannelProviderBuilder()
.replicators((byte) 2, tcpConfig).create();
// this is how you add maps after the custer is created
map1b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorB.createChannel((short) 1))
.channel(channelProviderB.createChannel((short) 1))
.create(getPersistenceFile());
map2b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorB.createChannel((short) 2))
.channel(channelProviderB.createChannel((short) 2))
.create(getPersistenceFile());
}
@@ -105,7 +105,7 @@ public class PostClusterMapCreationTest {
@After
public void tearDown() throws InterruptedException {
for (final Closeable closeable : new Closeable[]{channelReplicatorA, channelReplicatorB}) {
for (final Closeable closeable : new Closeable[]{channelProviderA, channelProviderB}) {
try {
closeable.close();
} catch (IOException e) {
@@ -41,8 +41,8 @@ public class SingleMapClusterTest {
private ChronicleMap<Integer, CharSequence> map1b;
private ChannelReplicator channelReplicatorA;
private ChannelReplicator channelReplicatorB;
private ChannelProvider channelProviderA;
private ChannelProvider channelProviderB;
public static File getPersistenceFile() {
String TMP = System.getProperty("java.io.tmpdir");
@@ -60,12 +60,12 @@ public class SingleMapClusterTest {
.of(8086, new InetSocketAddress("localhost", 8087))
.heartBeatInterval(1, SECONDS);
channelReplicatorA = new ChannelReplicatorBuilder((byte) 1, 1024)
.tcpReplication(tcpReplicationConfig).create();
channelProviderA = new ChannelProviderBuilder()
.replicators((byte) 1, tcpReplicationConfig).create();
// this is how you add maps after the custer is created
map1a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.channel(channelReplicatorA.createChannel((short) 1))
.channel(channelProviderA.createChannel((short) 1))
.create(getPersistenceFile());
}
@@ -75,11 +75,12 @@ public class SingleMapClusterTest {
.of(8087, new InetSocketAddress("localhost", 8086))
.heartBeatInterval(1, SECONDS);
channelReplicatorB = new ChannelReplicatorBuilder((byte) 2, 1024)
.tcpReplication(tcpReplicationConfig).create();
channelProviderB = new ChannelProviderBuilder()
.replicators((byte) 2, tcpReplicationConfig).create();
// this is how you add maps after the custer is created
map1b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.channel(channelReplicatorB.createChannel((short) 1))
.channel(channelProviderB.createChannel((short) 1))
.entries(1000)
.create(getPersistenceFile());
}
@@ -88,7 +89,7 @@ public class SingleMapClusterTest {
@After
public void tearDown() throws InterruptedException {
for (final Closeable closeable : new Closeable[]{channelReplicatorA, channelReplicatorB}) {
for (final Closeable closeable : new Closeable[]{channelProviderA, channelProviderB}) {
try {
closeable.close();
} catch (IOException e) {