tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: java.lang.OutOfMemoryError: Java heap space
Date Thu, 08 Oct 2009 20:33:16 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

A correction to my code:

On 10/8/2009 4:22 PM, Christopher Schultz wrote:
> public class SoftReferenceFilter
>   implements Filter
> {

This class needs two additional methods:

      public void init(FilterChain chain) { }
      public void destroy() { }

>     // Here's where the magic happens
>     public Object getAttribute(String key)
>     {
>       Object o = super.getAttribute(key); // Get the stored object

This should be:

        Object o = _base.getAttribute(key);

>     public Object setAttribute(String key, Object value)
>     {
>       // Wrap the value in a SoftReference if appropriate
>       if(key.startsWith("foto") && null != value)
>         value = new SoftReference(value);
> 
>       super.setAttribute(key, value);

This should be:

        _base.setAttribute(key, value);

Not too bad for code typed directly into an email message.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrOTIwACgkQ9CaO5/Lv0PAgoACgoAZOVSzVhSOwD893/qC/YtZ/
57MAnApZ064qpwt15QzMuEswaU3KFxMY
=nno+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message