> From: Peter Royal [mailto:[EMAIL PROTECTED]] 
> 
> when a Connection is gotten from the pool, create a new 
> Exception but don't 
> throw it. If a connection is gotten from the pool, used, and 
> then not closed, 
> throw that exception upon finalization (which you should be 
> able to force by 
> shutting the system down).
> 
> .. thats the rough idea..

That was pretty much exactly what I did in MicroContainer - 
if you tried to release a component twice, or forgot to
release it, it would print out a stack trace via an Exception.
Basically "You did not release the component you had obtained
here: (stack trace)", or "You have already released the component 
here: (stack trace) that you obtained here: (stack trace)". A very 
useful thing (I think), so I can testify to the goodness of Peter's tip.

Just one thing: Finalizers are not run on exit by default
(although this does not make Peter's suggestion less useful):

    java.lang 
    Class System

    runFinalizersOnExit
    
    public static void runFinalizersOnExit(boolean value)

    Deprecated. This method is inherently unsafe. It may result 
    in finalizers being called on live objects while other 
    threads are concurrently manipulating those objects, resulting 
    in erratic behavior or deadlock. 

    Enable or disable finalization on exit; doing so specifies 
    that the finalizers of all objects that have finalizers that 
    have not yet been automatically invoked are to be run before 
    the Java runtime exits. By default, finalization on exit is
disabled. 

    If there is a security manager, its checkExit method is first 
    called with 0 as its argument to ensure the exit is allowed. 
    This could result in a SecurityException.

/LS


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to