avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@dff.st>
Subject Re: [RT] pooling vs. release
Date Thu, 01 Aug 2002 17:03:40 GMT
On Thursday 01 August 2002 17:32, Peter Royal wrote:
> On Thursday 01 August 2002 11:23 am, Torsten Curdt wrote:
> > ...but I was more thinking non-limited pools that exists only to reduce
> > object creations. Wouldn't it make sense there?
>
> Berin's comments explain that one better than I...
>
> > Thinking about limited pools... would it be cool to have a fall-back
> > mechanism? Just a week ago it took me quite some time find out that a
> > component did not release a jdbc connection.
> >
> > With this fallback mechanism I could immediatly have found in the log
> > file something like "WARN: releasing unused component..." without testing
> > the pool against it's limit.
>
> this is a pilfered idea i read somewhere else.. maybe even on this list...

must have missed that one...

> 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..

You mean modifing the e.g. the Connection implementation? This would work for 
a connection since it has it's close() methode which could remove the 
exception again.

The problem is that the Poolable needs to know about it's state (in 
use/released) to throw an Exception on finalization.

Is there something that is definitly is called when a component is looked up 
or released? One could mime it with compose/dispose I guess...

Maybe one should always implement Poolables like this?

public class myclass implements Poolable, Composable, Disposable {
  private boolean released = true;

  public void compose(..) {
    released = false;
  }

  public void dispose(..) {
    released = true;
  }

  protected void finalize() {
    if (!released) throw new UnreleasedComponentException("..");
  }
}

But this may be a misuse of the current lifecycle interfaces...

What do you guys think?
--
Torsten

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message