From de9443436f8eeed557b01a135bfa8d3f506b0a37 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 13 Mar 2015 20:30:33 +0000 Subject: [PATCH] CE-14 some todo's --- .../map/ClientWiredStatelessChronicleMap.java | 3 --- .../net/openhft/chronicle/map/MapWireHandler.java | 14 +++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/ClientWiredStatelessChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ClientWiredStatelessChronicleMap.java index 0942bed63..78eec9c49 100644 --- a/src/main/java/net/openhft/chronicle/map/ClientWiredStatelessChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ClientWiredStatelessChronicleMap.java @@ -308,11 +308,8 @@ class ClientWiredStatelessChronicleMap implements ChronicleMap, Clon if (wire.bytes().remaining() < wire.bytes().capacity() * 0.5) break OUTER; - } - - } finally { hub.writeSocket(hub.outWire()); hub.outBytesLock().unlock(); diff --git a/src/main/java/net/openhft/chronicle/map/MapWireHandler.java b/src/main/java/net/openhft/chronicle/map/MapWireHandler.java index 705ca947a..ed32a6e48 100644 --- a/src/main/java/net/openhft/chronicle/map/MapWireHandler.java +++ b/src/main/java/net/openhft/chronicle/map/MapWireHandler.java @@ -236,7 +236,6 @@ class MapWireHandler implements WireHandler, Consumer { return; } - if (EventId.remoteIdentifier.contentEquals(methodName)) { this.remoteIdentifier = inWire.read(result).int8(); return; @@ -253,16 +252,19 @@ class MapWireHandler implements WireHandler, Consumer { } if (containsKey.contentEquals(methodName)) { + // todo remove the toByteArray(..) write(b -> outWire.write(result).bool(b.delegate.containsKey(toByteArray(inWire, arg1)))); return; } if (containsValue.contentEquals(methodName)) { + // todo remove the toByteArray(..) write(b -> outWire.write(result).bool(b.delegate.containsValue(toByteArray(inWire, arg1)))); return; } if (get.contentEquals(methodName)) { + // todo remove the toByteArray(..) writeValueUsingDelegate(map -> map.get(toByteArray(inWire, arg1))); return; } @@ -293,11 +295,10 @@ class MapWireHandler implements WireHandler, Consumer { // todo fix this this is a hack to get to work for now. - // todo may use somehting like : + // todo may use something like : // todo bytesMap.replace(reader, reader, timestamp, identifier()); - - VanillaChronicleMap map = bytesMap.delegate; + final VanillaChronicleMap map = bytesMap.delegate; byte[] result = (byte[]) map.replace( toByteArray(inWire, arg1), toByteArray(inWire, arg2)); @@ -329,6 +330,7 @@ class MapWireHandler implements WireHandler, Consumer { // todo call bytesMap.putIfAbsent(reader, reader, timestamp, identifier()); writeValueFromBytes(b -> { + // todo remove the toByteArray(..) byte[] key = MapWireHandler.this.toByteArray(inWire, arg1); byte[] value = MapWireHandler.this.toByteArray(inWire, arg2); return ((Map) b.delegate).putIfAbsent(key, value); @@ -381,6 +383,7 @@ class MapWireHandler implements WireHandler, Consumer { } + // todo remove private byte[] toByteArray(net.openhft.lang.io.Bytes bytes) { if (bytes == null || bytes.remaining() == 0) return new byte[]{}; @@ -393,6 +396,7 @@ class MapWireHandler implements WireHandler, Consumer { return result; } + // todo remove private byte[] toBytes(WireKey fieldName) { final Wire wire = inWire; @@ -452,7 +456,7 @@ class MapWireHandler implements WireHandler, Consumer { for (; ; ) { hasNext = inWire.read(Fields.hasNext).bool(); - + // todo remove toBytes() collectData.put(toBytes(arg1), toBytes(arg2)); if (!hasNext) {