HCOLL-218 ReplicatedChronicleMapTest appears to use too much resources. reduced resources used by this test - ( plus a few other changes )

This commit is contained in:
Rob Austin
2014-11-26 13:38:43 +00:00
parent b747788152
commit 8f80aaa1b8
4 changed files with 55 additions and 33 deletions
@@ -126,7 +126,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable
}
@Override
void process() throws IOException {
void processEvent() throws IOException {
try {
final InetSocketAddress serverInetSocketAddress = new InetSocketAddress(replicationConfig
.serverPort());
@@ -175,18 +175,22 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable
if (keys.length == 0)
continue;
try {
for (int i = 0; i< keys.length && keys[i] != null; i++) {
final SelectionKey key = keys[i];
try {
processKey(approxTime, key);
} catch (BufferUnderflowException e) {
if (!isClosed)
LOG.error("", e);
}
for (int i = 0; ; i++) {
final SelectionKey key = keys[i];
if (key == null)
break;
try {
processKey(approxTime, key);
} catch (BufferUnderflowException e) {
if (!isClosed)
LOG.error("", e);
}
} finally {
for (int i = 0; i< keys.length && keys[i] != null; i++) {
keys[i] = null;
}
}
}
@@ -207,7 +211,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable
} catch (Exception e) {
LOG.error("", e);
} finally {
selectedKeys = null;
if (LOG.isDebugEnabled())
LOG.debug("closing name=" + name);
if (!isClosed) {