DOC-14 Stateless Client : enhancing the synchronous writes so we don't need a thread local client for each thread

This commit is contained in:
Rob Austin
2014-11-24 08:29:44 +00:00
parent 5fb243e301
commit a5fe252478
7 changed files with 92 additions and 21 deletions
@@ -37,6 +37,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.SocketChannel;
import java.util.*;
import java.util.concurrent.Future;
import static java.nio.ByteBuffer.allocateDirect;
import static net.openhft.chronicle.map.AbstractChannelReplicator.SIZE_OF_SIZE;
@@ -392,6 +393,10 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable {
return blockingFetch(writeEventAnSkip(LONG_SIZE)).readLong();
}
public synchronized Future<V> getLater(K key) {
throw new UnsupportedOperationException();
}
public synchronized V get(Object key) {
final long sizeLocation = writeEventAnSkip(GET);
@@ -951,8 +956,6 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable {
private Bytes blockingFetch(long timeoutTime, long transactionId) throws IOException {
// bytes.buffer().position(0);
// the number of bytes in the response
final int size = receive(SIZE_OF_SIZE, timeoutTime).readInt();
@@ -979,7 +982,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable {
", does not match the expected transaction-id=" + transactionId);
if (isException) {
Throwable throwable = (Throwable) bytes.readObject();
Throwable throwable = (Throwable) bytes.readObject();
try {
Field stackTrace = Throwable.class.getDeclaredField("stackTrace");
stackTrace.setAccessible(true);