mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
fixed an issue, around sending exceptions back to the stateless client from the server
This commit is contained in:
@@ -1818,12 +1818,16 @@ class StatelessServerConnector<K, V> {
|
||||
@Nullable
|
||||
private Work sendException(@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer,
|
||||
long sizeLocation, @NotNull Throwable e) {
|
||||
|
||||
LOG.error("cause by remote stateless client call", e);
|
||||
|
||||
// move the position to ignore any bytes written so far
|
||||
writer.in().position(sizeLocation + HEADER_SIZE);
|
||||
|
||||
writeException(writer, e);
|
||||
|
||||
writeSizeAndFlags(sizeLocation + SIZE_OF_TRANSACTION_ID, true, writer.in());
|
||||
writeSizeAndFlags(sizeLocation, true, writer.in());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.openhft.lang.io.ByteBufferBytes;
|
||||
import net.openhft.lang.io.Bytes;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -208,6 +207,32 @@ public class StatelessClientTest {
|
||||
}
|
||||
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void testLotsOfPuts() throws IOException, InterruptedException {
|
||||
int port = s_port++;
|
||||
|
||||
final int size = 10000;
|
||||
|
||||
try (ChronicleMap<Integer, CharSequence> serverMap = ChronicleMapBuilder
|
||||
.of(Integer.class, CharSequence.class)
|
||||
.entries(100)
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(port))
|
||||
.create()) {
|
||||
try (ChronicleMap<Integer, CharSequence> statelessMap = localClient(port)) {
|
||||
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
statelessMap.put(i, "hello");
|
||||
}
|
||||
|
||||
assertEquals(statelessMap.size(), size);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testBufferOverFlowPutAllAndKeySet() throws IOException, InterruptedException {
|
||||
int port = 10 + s_port++;
|
||||
|
||||
Reference in New Issue
Block a user