added a Null check for - modificationNotifier != null

This commit is contained in:
Rob Austin
2015-05-28 19:15:47 +01:00
parent b031effdff
commit 48362f031a
3 changed files with 10 additions and 14 deletions
+1 -1
View File
@@ -59,7 +59,7 @@
<dependency>
<groupId>net.openhft</groupId>
<artifactId>lang</artifactId>
<version>6.6.7</version>
<version>6.6.7-SNAPSHOT</version>
</dependency>
</dependencies>
@@ -1432,7 +1432,6 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
}
/**
* used to merge multiple segments and positions into a single index used by the bit map
*
@@ -1447,12 +1446,14 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
public void onPut(long pos, SharedSegment segment) {
changes.set(combine(segment.getIndex(), pos));
modificationNotifier.onChange();
if (modificationNotifier != null)
modificationNotifier.onChange();
}
public void onRemove(long pos, SharedSegment segment) {
changes.set(combine(segment.getIndex(), pos));
modificationNotifier.onChange();
if (modificationNotifier != null)
modificationNotifier.onChange();
}
/**
@@ -1,26 +1,20 @@
package net.openhft.chronicle.map;
import org.junit.Assert;
import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.TimeUnit;
/**
* Created by khoxsey on 5/22/15.
*/
public class ReplicateProxyMapUpdatedViaSharedMemoryTest {
/**
* test 2 maps on one server ( one that replicates vai TCP/IP and one that just shares memory )
* can connect to a remote map
* connect to a remote map
* @throws IOException
* @throws InterruptedException
*/
@Test
@Test(timeout = 10000)
public void testReplicateProxyMapUpdatedViaSharedMemory() throws IOException, InterruptedException {
ChronicleMap<String, String> server1 = null;
@@ -33,7 +27,8 @@ public class ReplicateProxyMapUpdatedViaSharedMemoryTest {
server1 = ChronicleMapBuilder.of(String.class, String.class)
.replication((byte) 1).createPersistedTo(tempFile);
TcpTransportAndNetworkConfig serverConfig = TcpTransportAndNetworkConfig.of(7077);
TcpTransportAndNetworkConfig serverConfig = TcpTransportAndNetworkConfig.of(7077)
.heartBeatInterval(500, TimeUnit.MILLISECONDS);
replicationMap = ChronicleMapBuilder.of(String.class, String.class)
.replication((byte) 1, serverConfig).createPersistedTo(tempFile);
}