diff --git a/source/de/anomic/kelondro/blob/HeapReader.java b/source/de/anomic/kelondro/blob/HeapReader.java index 8c617cdfb..67605a859 100644 --- a/source/de/anomic/kelondro/blob/HeapReader.java +++ b/source/de/anomic/kelondro/blob/HeapReader.java @@ -148,7 +148,7 @@ public class HeapReader { Log.logInfo("HeapReader", "generating index for " + heapFile.toString() + ", " + (file.length() / 1024 / 1024) + " MB. Please wait."); this.free = new Gap(); - HandleMap.initDataConsumer indexready = HandleMap.asynchronusInitializer(keylength, this.ordering, 8, 0, Math.max(10, (int) (Runtime.getRuntime().freeMemory() / (10 * 1024 * 1024))), 100000); + HandleMap.initDataConsumer indexready = HandleMap.asynchronusInitializer(keylength, this.ordering, 8, 0, Math.max(10, (int) (Runtime.getRuntime().freeMemory() / (10 * 1024 * 1024)))); byte[] key = new byte[keylength]; int reclen; long seek = 0; diff --git a/source/de/anomic/kelondro/index/HandleMap.java b/source/de/anomic/kelondro/index/HandleMap.java index fa101f3ad..c5f9005cb 100644 --- a/source/de/anomic/kelondro/index/HandleMap.java +++ b/source/de/anomic/kelondro/index/HandleMap.java @@ -43,6 +43,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -288,8 +289,8 @@ public class HandleMap implements Iterable { * @param bufferSize * @return */ - public static initDataConsumer asynchronusInitializer(final int keylength, final ByteOrder objectOrder, int idxbytes, final int space, final int expectedspace, int bufferSize) { - initDataConsumer initializer = new initDataConsumer(new HandleMap(keylength, objectOrder, idxbytes, space, expectedspace), bufferSize); + public static initDataConsumer asynchronusInitializer(final int keylength, final ByteOrder objectOrder, int idxbytes, final int space, final int expectedspace) { + initDataConsumer initializer = new initDataConsumer(new HandleMap(keylength, objectOrder, idxbytes, space, expectedspace)); ExecutorService service = Executors.newSingleThreadExecutor(); initializer.setResult(service.submit(initializer)); service.shutdown(); @@ -314,9 +315,9 @@ public class HandleMap implements Iterable { private Future result; private boolean sortAtEnd; - public initDataConsumer(HandleMap map, int bufferCount) { + public initDataConsumer(HandleMap map) { this.map = map; - cache = new ArrayBlockingQueue(bufferCount); + cache = new LinkedBlockingQueue(); sortAtEnd = false; } @@ -338,7 +339,7 @@ public class HandleMap implements Iterable { } /** - * to signal the initialization thread that no more entries will be sublitted with consumer() + * to signal the initialization thread that no more entries will be submitted with consumer() * this method must be called. The process will not terminate if this is not called before. */ public void finish(boolean sortAtEnd) {