Reduced method overloading in VanillaChronicleMap

This commit is contained in:
leventov
2014-12-22 03:59:28 +07:00
parent a65d6e8c0e
commit ae88a27fbd
2 changed files with 11 additions and 10 deletions
@@ -1543,7 +1543,7 @@ class StatelessServerConnector<K, V> {
private Work removeWithValue(Bytes reader, @NotNull Bytes writer, final long sizeLocation,
long timestamp, byte id) {
try {
writer.writeBoolean(map.removeWithValue(reader));
writer.writeBoolean(map.removeBytesEntry(reader));
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1638,7 +1638,7 @@ class StatelessServerConnector<K, V> {
@Nullable
private Work containsKey(Bytes reader, @NotNull Bytes writer, final long sizeLocation) {
try {
writer.writeBoolean(map.containsKey(reader));
writer.writeBoolean(map.containsBytesKey(reader));
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1664,7 +1664,7 @@ class StatelessServerConnector<K, V> {
private Work get(Bytes reader, TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation, long transactionId) {
try {
map.get(reader, writer);
map.getBytes(reader, writer);
} catch (Throwable e) {
return sendException(writer.in(), sizeLocation, e);
}
@@ -1694,7 +1694,7 @@ class StatelessServerConnector<K, V> {
@SuppressWarnings("SameReturnValue")
@Nullable
private Work remove(Bytes reader, long timestamp, byte id) {
map.removeKeyAsBytes(reader);
map.removeBytesKeyWithoutOutput(reader);
return null;
}
@@ -1702,7 +1702,7 @@ class StatelessServerConnector<K, V> {
private Work remove(Bytes reader, TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation, long timestamp, byte id) {
try {
map.remove(reader, writer);
map.removeBytesKeyOutputPrevValue(reader, writer);
} catch (Throwable e) {
return sendException(writer.in(), sizeLocation, e);
}
@@ -583,7 +583,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
return lookupUsing(key, usingValue, true);
}
final void get(Bytes key, TcpReplicator.TcpSocketChannelEntryWriter output) {
final void getBytes(Bytes key, TcpReplicator.TcpSocketChannelEntryWriter output) {
ThreadLocalCopies copies = SegmentState.getCopies(null);
SegmentState segmentState = SegmentState.get(copies);
ReadValueToOutputBytes readValueToOutputBytes = segmentState.readValueToOutputBytes;
@@ -1145,7 +1145,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
metaKeyInterop.size(keyInterop, key));
}
final boolean containsKey(Bytes key) {
final boolean containsBytesKey(Bytes key) {
return containsKey(null,
DelegatingMetaBytesInterop.<Bytes, BytesInterop<Bytes>>instance(),
BytesBytesInterop.INSTANCE,
@@ -1301,7 +1301,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
keyIdentity(), this, expectedValue, valueIdentity(), this, removeReturnsNull);
}
final void removeKeyAsBytes(Bytes key) {
final void removeBytesKeyWithoutOutput(Bytes key) {
ThreadLocalCopies copies = SegmentState.getCopies(null);
SegmentState segmentState = SegmentState.get(copies);
ReadValueToBytes readValueToLazyBytes = segmentState.readValueToLazyBytes;
@@ -1314,7 +1314,8 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
outputValueBytesToInstance, readValueToLazyBytes, true);
}
final void remove(Bytes key, TcpReplicator.TcpSocketChannelEntryWriter output) {
final void removeBytesKeyOutputPrevValue(Bytes key,
TcpReplicator.TcpSocketChannelEntryWriter output) {
ThreadLocalCopies copies = SegmentState.getCopies(null);
SegmentState segmentState = SegmentState.get(copies);
ReadValueToOutputBytes readValueToOutputBytes = segmentState.readValueToOutputBytes;
@@ -1328,7 +1329,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
}
// for boolean remove(Object key, Object value);
final boolean removeWithValue(Bytes entry) {
final boolean removeBytesEntry(Bytes entry) {
ThreadLocalCopies copies = SegmentState.getCopies(null);
SegmentState segmentState = SegmentState.get(copies);
long keySize = keySizeMarshaller.readSize(entry);