Merge remote-tracking branch 'origin/2.1' into 2.1

Conflicts:
	src/main/java/net/openhft/chronicle/map/TcpReplicator.java
This commit is contained in:
Rob Austin
2015-09-14 13:18:06 +01:00
60 changed files with 389 additions and 777 deletions
@@ -276,7 +276,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
*
* @param approxTime the approximate time in milliseconds
*/
void heartBeatMonitor(long approxTime) {
for (int i = activeKeys.nextSetBit(0); i >= 0; i = activeKeys.nextSetBit(i + 1)) {
try {
@@ -390,13 +389,11 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
private void quietClose(@NotNull final SelectionKey key, @NotNull final Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("", e);
// null check (Attached)key.attachment();
if (key.channel() != null && key.attachment() != null)
connectionListener.onDisconnect(((SocketChannel) key.channel()).socket().getInetAddress(),
((Attached) key.attachment()).remoteIdentifier);
closeEarlyAndQuietly(key.channel());
}
@@ -535,7 +532,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
final String localVersion = BuildVersion.version();
final String remoteVersion = attached.serverVersion;
if (!remoteVersion.equals(localVersion)) {
byte remoteIdentifier = attached.remoteIdentifier;
LOG.warn("DIFFERENT CHRONICLE-MAP VERSIONS : " +
@@ -764,7 +760,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
/**
* called when the selector receives a OP_READ message
*/
private void onRead(@NotNull final SelectionKey key,
final long approxTime) throws IOException {
@@ -1062,7 +1057,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
*/
class TcpSocketChannelEntryWriter {
@NotNull
private final EntryCallback entryCallback;
// if uncompletedWork is set ( not null ) , this must be completed before any further work
@@ -1150,8 +1144,8 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
/**
* writes all the entries that have changed, to the buffer which will later be written to
* TCP/IP
* @param modificationIterator a record of which entries have modification
*
* @param modificationIterator a record of which entries have modification
*/
void entriesToBuffer(@NotNull final Replica.ModificationIterator modificationIterator) throws InterruptedException {
@@ -1231,7 +1225,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
return len;
}
/**
* used to send an single zero byte if we have not send any data for up to the
* localHeartbeatInterval
@@ -1248,7 +1241,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
in().writeLong(localHeartbeatInterval);
}
public boolean doWork() {
return uncompletedWork != null && uncompletedWork.doWork(in());
}
@@ -1471,7 +1463,6 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
return null;
}
public long readRemoteHeartbeatIntervalFromBuffer() {
return (out.remaining() >= 8) ? out.readLong() : Long.MIN_VALUE;
}
@@ -1508,7 +1499,6 @@ class StatelessServerConnector<K, V> {
private final SerializationBuilder<V> valueSerializationBuilder;
private final int tcpBufferSize;
StatelessServerConnector(
@NotNull VanillaChronicleMap<K, ?, ?, V, ?, ?> map,
@NotNull final BufferResizer bufferResizer, int tcpBufferSize,
@@ -1539,7 +1529,6 @@ class StatelessServerConnector<K, V> {
int headerSize = reader.readInt();
reader.skip(headerSize);
// these methods don't return a result to the client or don't return a result to the
// client immediately
switch (event) {
@@ -1564,7 +1553,6 @@ class StatelessServerConnector<K, V> {
final long sizeLocation = reflectTransactionId(writer.in(), transactionId);
// these methods return a result
switch (event) {
@@ -1668,7 +1656,6 @@ class StatelessServerConnector<K, V> {
return null;
}
@Nullable
public Work mapForKey(@NotNull ByteBufferBytes reader, @NotNull TcpReplicator.TcpSocketChannelEntryWriter writer,
long sizeLocation) {
@@ -1773,11 +1760,9 @@ class StatelessServerConnector<K, V> {
return null;
}
@Nullable
private Work applicationVersion(@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer, final long sizeLocation) {
final long remaining = writer.in().remaining();
try {
String result = map.applicationVersion();
@@ -1792,11 +1777,9 @@ class StatelessServerConnector<K, V> {
return null;
}
@Nullable
private Work persistedDataVersion(@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer, final long sizeLocation) {
final long remaining = writer.in().remaining();
try {
String result = map.persistedDataVersion();
@@ -1820,7 +1803,7 @@ class StatelessServerConnector<K, V> {
writeException(writer, e);
writeSizeAndFlags(sizeLocation, true, writer.in());
writeSizeAndFlags(sizeLocation , true, writer.in());
return null;
}
@@ -2136,7 +2119,6 @@ class StatelessServerConnector<K, V> {
out.position(pos);
}
}
private void writeException(@NotNull TcpReplicator.TcpSocketChannelEntryWriter out, Throwable e) {