are you sure the image data is stored in the session?

we have RenderedDynamicImageResource<-DefaultButtonImageResource

in RenderedDynamicImageResource we have

private transient SoftReference imageData;

so the field is transient and on top of that is a softreference. so first of
it shouldnt make it into httpsession, and second it should be gced when
memory runs short. are you observing this memory usage through a profiler?
try to force gc and see if the memory drops.

another way to optimize it is to do this:
ResourceReference reference = new ResourceReference(resourceKey) {
  protected newResource() {
        return new DefaultButtonImageResource(text);
  }
}

Image image = Image(name, reference);

that way you are lazily creating resources

and if you want to optimize even further you can create a wrapper around the
default button resource and register it as a shared resource. this wrapper
would read the text off the url and pass it on to the default button
resource. this way you dont even need to use Image, a much simpler custom
class will do since all it has to do is set the src attr to the proper url.

-igor





On 1/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi All!

I have noticed that ResourceReferences to DefaultButtonImageResources are
stored inside a pagemap and this is stored in users sessions. Is this the
usual behaviour of wicket or can I tune it? My current session size depends
mostly on size of all used Images which are factoried as ResourceReferences.

My code flow looks like this:

DefaultButtonImageResource button = new DefaultButtonImageResource(text);
ResourceReference reference = new ResourceReference(resourceKey, button);
Image image = Image(name, reference);

and now some code from my page class:

private List<Image> activeButtons = new LinkedList<Image>();
activeButtons.add(image):

Why is it necessary to store the whole image within the pagemap? May be I
am doing someting wrong, do I?

Thank you very much for any help.

I have currently running my application succesfully on glassfish.
Everything is great, the final prblem is only the size of pagemaps which
mostly consist of image data.

Maciej


_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to