Author: toad
Date: 2009-04-03 16:52:01 +0000 (Fri, 03 Apr 2009)
New Revision: 26458
Modified:
trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
Log:
Revert and explain
Modified: trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2009-04-03 16:48:41 UTC (rev 26457)
+++ trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2009-04-03 16:52:01 UTC (rev 26458)
@@ -725,11 +725,15 @@
* @param context
*/
private void innerGotAllMetadata(ObjectContainer container,
ClientContext context) {
+ /** COR-1582: We have to carefully avoid activating any hashmap
to depth 2,
+ * however we cannot afford the memory to activate everything
to max depth in
+ * advance. It looks like activating the hashmap at the top to
depth 2, and
+ * then activating the sub-maps to depth 2 as well, works... */
+ if(persistent()) {
+ container.activate(putHandlersByName, 2); // depth 2 to
load elements
+ }
if(logMINOR) Logger.minor(this, "Got all metadata");
HashMap<String, Object> namesToByteArrays = new HashMap<String,
Object>();
- // We'll end up committing it all anyway, and hash maps in hash
maps can cause
- // *severe* problems (see COR-1582), so activate to max depth
first.
- if(persistent()) container.activate(putHandlersByName,
Integer.MAX_VALUE);
namesToByteArrays(putHandlersByName, namesToByteArrays,
container);
if(defaultName != null) {
Metadata meta = (Metadata)
namesToByteArrays.get(defaultName);
@@ -1040,7 +1044,8 @@
}
} else if(o instanceof HashMap) {
HashMap<String,Object> subMap = new
HashMap<String,Object>();
- // Already activated
+ if(persistent())
+ container.activate(o, 2); // Depth 1
doesn't load the elements...
namesToByteArrays.put(name, subMap);
if(logMINOR)
Logger.minor(this, "Putting hashmap
into base metadata: "+name+" size "+((HashMap)o).size()+" active = "+container
== null ? "null" : Boolean.toString(container.ext().isActive(o)));
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs