HCOLL-366 Changed this method from recursive to use iteration. No longer shows up as a problem. Also reduce the maximum depth from 16K to 1K.

This commit is contained in:
Peter Lawrey
2015-06-11 14:46:41 +01:00
parent cf71c97112
commit e6582b0a39
2 changed files with 10 additions and 7 deletions
@@ -1368,8 +1368,8 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
final SearchState searchState = new SearchState();
private SegmentState(int depth) {
if (depth > (1 << 16))
throw new IllegalStateException("More than " + (1 << 16) +
if (depth > (1 << 10))
throw new IllegalStateException("More than " + (1 << 10) +
" nested ChronicleMap contexts are not supported. Very probable that you " +
"simply forgot to close context somewhere (recommended to use " +
"try-with-resources statement). " +
@@ -1383,9 +1383,14 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
used = true;
return this;
}
if (next != null)
return next.get();
return next = new SegmentState(depth + 1);
SegmentState ss;
for (ss = this; ss.next != null; ss = ss.next) {
if (!ss.used) {
used = true;
return ss;
}
}
return ss.next = new SegmentState(depth + 1);
}
@Override
@@ -20,7 +20,6 @@ package net.openhft.chronicle.map;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.Closeable;
@@ -40,7 +39,6 @@ import static org.junit.Assert.assertTrue;
*
* @author Rob Austin.
*/
@Ignore("TODO https://higherfrequencytrading.atlassian.net/browse/HCOLL-366")
public class TCPSocketReplicationTest {
static int s_port = 12050;