Good point. It could be part of the contract that the listener code does not keep a reference to the event. I could also just remove the option from the interface. Actually, I see very little value in the onRemove event anyway. I mainly put it there for consistency.
> -----Original Message----- > From: Henri Yandell [mailto:[EMAIL PROTECTED] > Sent: Friday, February 28, 2003 2:13 PM > To: Jakarta Commons Developers List > Subject: Re: [POOL] Pool listeners > > > > I was just copying your idea of copying the JDK :) > > Another one: > > Make the Pool be the Source of the PoolEvent. > For certain events, I would expect to be able to also get the > object added, changed etc. I'm unsure about removed as that > might cause issues with the worry below. > > One worry: > > WeakReferences etc. I imagine there needs to be a bit of > focus on making sure the listener system doesn't screw up the > concept of a pool which uses weak-references for its keys. > > [bear in mind, i have no early clue what the [pool] code > looks like, so I might be shooting in the wind] > > Hen > > On Fri, 28 Feb 2003, David Graham wrote: > > > I just suggested PoolListenerAdaptor but I like your PoolAdaptor > > better. > > > > David > > > > > > > > >From: Henri Yandell <[EMAIL PROTECTED]> > > >Reply-To: "Jakarta Commons Developers List" > > ><[EMAIL PROTECTED]> > > >To: Jakarta Commons Developers List > <[EMAIL PROTECTED]> > > >Subject: Re: [POOL] Pool listeners > > >Date: Fri, 28 Feb 2003 15:00:44 -0500 (EST) > > > > > > > > >Also a PoolAdaptor. > > > > > >On Fri, 28 Feb 2003, David Graham wrote: > > > > > > > I would make PoolListener more closely match the Java listener > > > > style. > > >That > > > > is: > > > > 1. PoolListener extends java.util.EventListener > > > > > > > > 2. The methods accept an event object that extends > > > > java.util.EventObject (maybe call it PoolEvent). > > > > > > > > 3. The methods shouldn't throw Exception. They should throw > > > > specific exception types or non at all. > > > > > > > > I like the concept. > > > > > > > > David > > > > > > > > > > > > > > > > > > > > >From: "Quinton McCombs" <[EMAIL PROTECTED]> > > > > >Reply-To: "Jakarta Commons Developers List" > > > > ><[EMAIL PROTECTED]> > > > > >To: <[EMAIL PROTECTED]> > > > > >Subject: [POOL] Pool listeners > > > > >Date: Fri, 28 Feb 2003 13:19:48 -0600 > > > > > > > > > >I am working on a patch to allow listeners to be added > to pools > > > > >that will receive notifications on various events. > Does anyone > > > > >object to having this functionality included? > > > > > > > > > >Here is the design - > > > > > > > > > >I was thinking about adding support for a PoolListener > interface > > > > >for > > >the > > > > >pool component. Object which implement this interface > could be > > > > >added > > >to > > > > >any ObjectPool or KeyedObjectPool. The listener would be > > > > >notified on the following events: > > > > > > > > > >- An object is borrowed from the pool > > > > >- An object is returned to the pool > > > > >- An new object is created and added to the pool > > > > >- An object is removed from the pool > > > > > > > > > >addListener(PoolListener) would be defined in ObjectPool and > > > > >KeyedObjectPool. It would be implemented in > BaseObjectPool and > > > > >BaseKeyedObjectPool. Also in the previous two Base* classes, > > > > >protected methods would be added to handle sending out the > > > > >notifications to the list of listeners. > > > > > > > > > >public interface PoolListener > > > > >{ > > > > > /** > > > > > * Executed immediatedly before an object is > returned from > > > > >the > > >pool. > > > > > * > > > > > * @param obj The object being returned > > > > > * @throws Exception generic exception > > > > > */ > > > > > void onBorrow(Object obj) throws Exception; > > > > > > > > > > /** > > > > > * Executed immediately after an object is > returned to the pool. > > > > > * > > > > > * @param obj the object being returned > > > > > * @throws Exception generic exception > > > > > */ > > > > > void onReturn(Object obj) throws Exception; > > > > > > > > > > /** > > > > > * Executed immediately after a new object is created but > > > > > before > > >it > > > > > * is added to the pool. > > > > > * > > > > > * @param obj the newly created object > > > > > * @throws Exception generic exception > > > > > */ > > > > > void onCreate(Object obj) throws Exception; > > > > > > > > > > /** > > > > > * Executed when an object is removed from the pool. > > > > > * > > > > > * @param obj The object being removed. > > > > > * @throws Exception generic exception > > > > > */ > > > > > void onDestroy(Object obj) throws Exception; > > > > > > > > > > >----------------------------------------------------------------- > > > > >---- > > > > >To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > >For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > _________________________________________________________________ > > > > Tired of spam? Get advanced junk mail protection with MSN 8. > > > > http://join.msn.com/?page=features/junkmail > > > > > > > > > > > > > ------------------------------------------------------------------ > > > > --- > > > > 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] > > > > > > _________________________________________________________________ > > Help STOP SPAM with the new MSN 8 and get 2 months FREE* > > http://join.msn.com/?page=features/junkmail > > > > > > > --------------------------------------------------------------------- > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
