git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3735 6c8d7289-2bf4-0310-a012-ef5d649a1542

pull/1/head
orbiter 18 years ago
parent 3c5ff7f735
commit b3f97b5c38

@ -152,7 +152,7 @@ public class CrawlProfileEditor_p {
prop.put("edit_entries_" + count + "_readonly_label", ee.label);
prop.put("edit_entries_" + count + "_readonly_type", ee.type);
if (ee.type == eentry.BOOLEAN) {
prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.parseBoolean((String)val) ? 1 : 0);
prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.getBoolean((String)val) ? 1 : 0);
} else {
prop.put("edit_entries_" + count + "_readonly_type_value", val);
}

@ -1,11 +1,16 @@
// kelondroException.java
// -----------------------
// part of The Kelondro Database
// (C) by Michael Peter Christen; mc@anomic.de
// first published on http://www.anomic.de
// Frankfurt, Germany, 2005
// last major change: 12.04.2005
// (C) 2005 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
// first published 12.04.2005 on http://yacy.net
//
// This is a part of YaCy, a peer-to-peer based web search engine
//
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
// $LastChangedRevision: 1986 $
// $LastChangedBy: orbiter $
//
// LICENSE
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@ -19,25 +24,6 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Using this software in any meaning (reading, learning, copying, compiling,
// running) means that you agree that the Author(s) is (are) not responsible
// for cost, loss of data or any harm that may be caused directly or indirectly
// by usage of this softare or this documentation. The usage of this software
// is on your own risk. The installation and usage (starting/running) of this
// software may allow other people or application to access your computer and
// any attached devices and is highly dependent on the configuration of the
// software which must be done by the user of the software; the author(s) is
// (are) also not responsible for proper configuration and usage of the
// software, even if provoked by documentation provided together with
// the software.
//
// Any changes to this file according to the GPL as documented in the file
// gpl.txt aside this file in the shipment you received can be done to the
// lines that follows this copyright notice here, but changes must not be
// done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such.
package de.anomic.kelondro;

@ -173,13 +173,65 @@ public class kelondroRowCollection {
return this.rowdef;
}
private static final Object[] arraydepot = new Object[]{new byte[0]};
private final void ensureSize(int elements) {
int needed = elements * rowdef.objectsize();
if (chunkcache.length >= needed) return;
byte[] newChunkcache = new byte[(int) (needed * growfactor)]; // increase space
System.arraycopy(chunkcache, 0, newChunkcache, 0, chunkcache.length);
chunkcache = newChunkcache;
newChunkcache = null;
long neededRAM = (long) (needed * growfactor);
long availableRAM = serverMemory.available();
//if ((safemode) && (neededRAM > availableRAM)) throw new kelondroMemoryProtectionException("rowCollection temporary chunkcache", neededRAM, availableRAM);
if (neededRAM > availableRAM) {
// go into safe mode: use the arraydepot
synchronized (arraydepot) {
if (((byte[]) arraydepot[0]).length >= neededRAM) {
System.out.println("ensureSize case 1");
// use the depot to increase the chunkcache
byte[] newChunkcache = (byte[]) arraydepot[0];
System.arraycopy(chunkcache, 0, newChunkcache, 0, chunkcache.length);
// safe the chunkcache for later use in arraydepot
arraydepot[0] = chunkcache;
chunkcache = newChunkcache;
newChunkcache = null;
} else {
System.out.println("ensureSize case 2");
// this is the critical part: we need more RAM.
// do a buffering using the arraydepot
byte[] buffer0 = (byte[]) arraydepot[0];
byte[] buffer1 = new byte[chunkcache.length - buffer0.length];
// first copy the previous chunkcache to the two buffers
System.arraycopy(chunkcache, 0, buffer0, 0, buffer0.length);
System.arraycopy(chunkcache, buffer0.length, buffer1, 0, buffer1.length);
// then free the previous chunkcache and replace it with a new array at target size
chunkcache = null; // hand this over to GC
chunkcache = new byte[(int) neededRAM];
System.arraycopy(buffer0, 0, chunkcache, 0, buffer0.length);
System.arraycopy(buffer1, 0, chunkcache, buffer0.length, buffer1.length);
// then move the bigger buffer into the arraydepot
if (buffer0.length > buffer1.length) {
arraydepot[0] = buffer0;
} else {
arraydepot[1] = buffer1;
}
buffer0 = null;
buffer1 = null;
}
}
} else {
// there is enough memory available
byte[] newChunkcache = new byte[(int) neededRAM]; // increase space
System.arraycopy(chunkcache, 0, newChunkcache, 0, chunkcache.length);
// safe the chunkcache for later use in arraydepot
synchronized (arraydepot) {
if (((byte[]) arraydepot[0]).length < chunkcache.length) {
System.out.println("ensureSize case 0");
arraydepot[0] = chunkcache;
}
}
chunkcache = newChunkcache;
newChunkcache = null;
}
}
/*
private static final Object[] arraydepot = new Object[]{new byte[0]};

@ -1,14 +1,14 @@
// serverMemory.java
// -------------------------------------------
// (C) by Michael Peter Christen; mc@anomic.de
// first published on http://www.anomic.de
// Frankfurt, Germany, 2005
// Created 22.09.2005
// (C) 2005 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
// first published 22.09.2005 on http://yacy.net
//
// $LastChangedDate: 2005-09-21 16:21:45 +0200 (Wed, 21 Sep 2005) $
// $LastChangedRevision: 763 $
// $LastChangedBy: orbiter $
//
// LICENSE
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@ -22,25 +22,6 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Using this software in any meaning (reading, learning, copying, compiling,
// running) means that you agree that the Author(s) is (are) not responsible
// for cost, loss of data or any harm that may be caused directly or indirectly
// by usage of this softare or this documentation. The usage of this software
// is on your own risk. The installation and usage (starting/running) of this
// software may allow other people or application to access your computer and
// any attached devices and is highly dependent on the configuration of the
// software which must be done by the user of the software; the author(s) is
// (are) also not responsible for proper configuration and usage of the
// software, even if provoked by documentation provided together with
// the software.
//
// Any changes to this file according to the GPL as documented in the file
// gpl.txt aside this file in the shipment you received can be done to the
// lines that follows this copyright notice here, but changes must not be
// done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such.
package de.anomic.server;

Loading…
Cancel
Save