Re: Make ComponentRenderer implement AutoCloseable?
Guten Tag Sven Meier, am Sonntag, 24. Mai 2020 um 23:18 schrieben Sie: > ComponentRender#destroy() destroys the application, there's not much > more to it. That's the important part, because otherwise one gets a memory leak when having multiple applications, because they are stored in "Application.applicationKeyToApplication". > So auto-closing i.e. destroying the renderer after each render might > lead people into the wrong direction. Then the following sentence in the docs should make more clear that if to call "destroy" or not depends on the lifecycle of the app, not the renderer: > Note: For performance reasons instances can and should be reused, be > sure to call {@link #destroy()} when they are no longer needed. This reads like it depends on the instances of the renderer to me, but then one couldn't reuse apps at all, because they are always destroyed. How do I destroy an application without "ComponentRenderer#destroy", when the app really should be reused by multiple renderers? I only see "Application.internalDestroy", which explicitly warns me to not use it. "ComponentRenderer.destroy" looked like the only official way to cleanup to me. Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
Re: Make ComponentRenderer implement AutoCloseable?
Hi Thorsten, ComponentRender#destroy() destroys the application, there's not much more to it. In most cases you will want to reuse the application for performance reasons. A specific application can even be used as constructor argument, which might be the main web application that you don't want to be destroyed prematurely. So auto-closing i.e. destroying the renderer after each render might lead people into the wrong direction. Have fun Sven On 24.05.20 16:28, Thorsten Schöning wrote: Hi all, I'm using Wicket as a template engine to render reports in some backend with various different output formats. Everything is based on "ComponentRenderer", though, and that introduced a large memory leak in my case. Root cause simply was that I forgot to call "destroy". So how about implementing AutoCloseable by that class? In most IDEs that would have at least triggered a warning. Mit freundlichen Grüßen, Thorsten Schöning
Make ComponentRenderer implement AutoCloseable?
Hi all, I'm using Wicket as a template engine to render reports in some backend with various different output formats. Everything is based on "ComponentRenderer", though, and that introduced a large memory leak in my case. Root cause simply was that I forgot to call "destroy". So how about implementing AutoCloseable by that class? In most IDEs that would have at least triggered a warning. Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow