hudson.util
Class HeapSpaceStringConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
      extended by hudson.util.HeapSpaceStringConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.ConverterMatcher, com.thoughtworks.xstream.converters.SingleValueConverter

public class HeapSpaceStringConverter
extends com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter

Up to XStream 1.3 the default StringConverter in XStream used String.intern(), which stressed the (rather limited) PermGen space with a large XML file. Since XStream 1.3 it use a WeakHashMap cache to always use the same String instances, but this has also major problems with a single long living XStream instance (as we have in Jenkins) See http://jira.codehaus.org/browse/XSTR-604

Use this to avoid that (instead those strings will now be allocated to the heap space.)

Author:
Kohsuke Kawaguchi

Constructor Summary
HeapSpaceStringConverter()
           
 
Method Summary
 boolean canConvert(Class type)
           
 Object fromString(String str)
           
 
Methods inherited from class com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeapSpaceStringConverter

public HeapSpaceStringConverter()
Method Detail

canConvert

public boolean canConvert(Class type)
Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
Specified by:
canConvert in class com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter

fromString

public Object fromString(String str)
Specified by:
fromString in interface com.thoughtworks.xstream.converters.SingleValueConverter
Specified by:
fromString in class com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter


Copyright © 2004-2013. All Rights Reserved.