On Tue, 2006-01-24 at 14:34 +0000, sebb wrote:
> On 24/01/06, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> > On Tue, 2006-01-24 at 13:10 +0000, sebb wrote:
> > > On 23/01/06, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> > > > On Mon, 2006-01-23 at 19:47 +0000, sebb wrote:
> > > > > Might be useful to add a finalizer which logs a warning if the Manager
> > > > > has not been shut down properly?
> > > > >
> > > > > Sebastian
> > > > >
> > > >
> > > > Sebastian,
> > > > There are situations where such a warning would be inappropriate.
> > > > Consider the case of HttpClient being used as a singleton. We might,
> > >
> > > Not sure I understand what you mean here - surely even a singleton
> > > needs to be closed properly?
> >
> > Probably not, as long as the connection manager is meant to be active
> > for the whole lifespan of the JVM process
> 
> I see - it would perhaps be annoying to see the message in this case.
> 
> Can one distinguish GC occurring JVM shutdown from regular GC?
> If so, one could just warn if a regular GC occurred.

I am afraid not. The only mechanism I am aware of is the shutdown hook,
but it all gets way to ugly to my liking. I still do think a simple
static 'unclean shutdown' counter should suffice. If, say, 500th
connection managers gets GC-ed without having been properly shut down,
something is definitely wrong and a big juicy warning is certainly due.

Oleg

> 
> > The real trouble with the connection managers is their reliance on the
> > garbage collector to close persistent connections rather the fact that
> > connection managers necessarily need to be shut down. The existing
> > connection managers work fine as long as one does not do something
> > exceptionally silly, such as creating a new connection manager per
> > request in a tight loop, which in no time results in thousands of
> > connection managers waiting to be GC-ed, each holding on open
> > connection.
> >
> > Hope that explains it.
> 
> Yes, thanks.
> 
> >
> > Oleg
> >
> > >
> > > > however, run a simple static counter of how many connection managers
> > > > have been GC-ed without having been properly shut down and start
> > > > printing warnings beyond a certain threshold in order to circumvent the
> > > > problem.
> > > >
> > >
> > > OK.
> > >
> 
> ---------------------------------------------------------------------
> 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