1. I would recommend to use a connection pool, e.g. 'bonecp', 'c3p0' or 'dbcp' 
instead of a single connection. Using a single connection that stays connected 
to the db is a bad thing. You usually have to restart your web application when 
the database gets restarted (or goes offline for some time).
2. You can manage the lifetime of your pool using a web application factory, 
too. Use org.apache.wicket.protocol.http.IDestroyableWebApplicationFactory 
instead of org.apache.wicket.protocol.http.IWebApplicationFactory to handle 
destruction of the resource in method 
IDestroyableWebApplicationFactory#destroy().

Am 26.07.2011 um 08:21 schrieb Martin Grigorov:

> org.apache.wicket.Application.onDestroy()
> 
> On Tue, Jul 26, 2011 at 4:34 AM, eugenebalt <[email protected]> wrote:
>> To clarify, this is not per-request, it should be per-application.
>> 
>> I have a static Connection object in my WebApplication, and it's used for
>> all transactions in the app. I construct it initially in the init(), and was
>> just wondering where to close the Connection at the end of the app.
>> 
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/How-to-Catch-WebApplication-s-Destroy-tp3694556p3694614.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to