mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
ensure that we close() on interupt
This commit is contained in:
@@ -257,7 +257,9 @@ final class TcpReplicator<K, V> extends AbstractChannelReplicator implements Clo
|
||||
LOG.debug("onWrite - " + name);
|
||||
onWrite(key, approxTime);
|
||||
}
|
||||
} catch (BufferUnderflowException | InterruptedException | IOException |
|
||||
} catch (InterruptedException e) {
|
||||
quietClose(key, e);
|
||||
} catch (BufferUnderflowException | IOException |
|
||||
ClosedSelectorException | CancelledKeyException e) {
|
||||
if (!isClosed)
|
||||
quietClose(key, e);
|
||||
|
||||
@@ -355,25 +355,27 @@ public class CHMUseCasesTest {
|
||||
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
|
||||
public void testByteArrayArrayValue() throws ExecutionException, InterruptedException, IOException {
|
||||
|
||||
int valueSize = 10;
|
||||
for (int i=0; i < 10000; i++) {
|
||||
int valueSize = 10;
|
||||
|
||||
char[] expected = new char[valueSize];
|
||||
Arrays.fill(expected, 'X');
|
||||
char[] expected = new char[valueSize];
|
||||
Arrays.fill(expected, 'X');
|
||||
|
||||
ChronicleMapBuilder<byte[], byte[][]> builder = ChronicleMapBuilder
|
||||
.of(byte[].class, byte[][].class);
|
||||
ChronicleMapBuilder<byte[], byte[][]> builder = ChronicleMapBuilder
|
||||
.of(byte[].class, byte[][].class);
|
||||
|
||||
try (ChronicleMap<byte[], byte[][]> map = newInstance(builder)) {
|
||||
byte[] bytes1 = "value1".getBytes();
|
||||
byte[] bytes2 = "value2".getBytes();
|
||||
byte[][] value = {bytes1, bytes2};
|
||||
map.put("Key".getBytes(), value);
|
||||
try (ChronicleMap<byte[], byte[][]> map = newInstance(builder)) {
|
||||
byte[] bytes1 = "value1".getBytes();
|
||||
byte[] bytes2 = "value2".getBytes();
|
||||
byte[][] value = {bytes1, bytes2};
|
||||
map.put("Key".getBytes(), value);
|
||||
|
||||
assertEquals(value, map.get("Key".getBytes()));
|
||||
mapChecks();
|
||||
assertEquals(value, map.get("Key".getBytes()));
|
||||
mapChecks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user