Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…&p=16389#p16389

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6172 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 4, 2009
1 parent 0f3246e commit 16efcd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/de/anomic/kelondro/blob/HeapReader.java
Expand Up @@ -148,7 +148,7 @@ private void initIndexReadFromHeap() throws IOException {
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;
Expand Down
11 changes: 6 additions & 5 deletions source/de/anomic/kelondro/index/HandleMap.java
Expand Up @@ -43,6 +43,7 @@
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;

Expand Down Expand Up @@ -288,8 +289,8 @@ public synchronized void close() {
* @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();
Expand All @@ -314,9 +315,9 @@ public static class initDataConsumer implements Callable<HandleMap> {
private Future<HandleMap> result;
private boolean sortAtEnd;

public initDataConsumer(HandleMap map, int bufferCount) {
public initDataConsumer(HandleMap map) {
this.map = map;
cache = new ArrayBlockingQueue<entry>(bufferCount);
cache = new LinkedBlockingQueue<entry>();
sortAtEnd = false;
}

Expand All @@ -338,7 +339,7 @@ public void consume(final byte[] key, final long l) {
}

/**
* 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) {
Expand Down

0 comments on commit 16efcd0

Please sign in to comment.