commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roytman, Alex" <Roytm...@peacetech.com>
Subject RE: [Pool] Re: Sharing eviction threads
Date Sat, 02 Nov 2002 00:14:33 GMT
Thank you very much for clarifications. 

I will think about it a little bit more. I do not particulary like introducing this extra
interface so may be it is good idea after all to leave timer implementation to pool consumers
outside of pool component itself. 

Do you think Jdbc2ConnectionPool should also be JDK 1.2.x compatible given that tomcat 4.1
already requires jdk 1.3

Alex


-----Original Message-----
From: Rodney Waldhoff [mailto:rwaldhoff@apache.org]
Sent: Friday, November 01, 2002 6:47 PM
To: Jakarta Commons Developers List
Subject: RE: [Pool] Re: Sharing eviction threads


On Fri, 1 Nov 2002, Roytman, Alex wrote:

> BTW how strong is 1.2.x support requirement. AFAIK virtually every vendor
> have 1.3 or later now except small devices.

I have production pool/dbcp deployments running on JDK 1.2, at
least for the time being, so I personally would be disappointed at having
to fork for that.

Having 1.3 as a compile-time, but not run-time, dependancy seems
acceptable.  I haven't looked in detail at your attachements, but it seems
like extending Generic[Keyed]ObjectPool with a Timer/TimerTask supporting
implementation would be one simple way to do this.  E.g., something more
or less like:

public class SharedEvictorGenericObjectPool extends GenericObjectPool {
  private static Timer _timer = null;

  public static void startTimer() {
     if(null == _timer) {
       _timer = new Timer(true);
     }
  }

  public static void stopTimer() {
     if(null != _timer) { _timer.cancel(); }
     _timer = null;
  }

  protected void startEvictor(long timeBetweenRuns) {
    startTimer();
    _timer.schedule(new EvictionTimerTask(this),timeBetweenRuns);
  }

}

where startEvictor is a method extracted in GenericObjectPool to
start/stop the evictor thread and EvictionTimerTask is just that--a
TimerTask that invokes evict().  (I supsect you've got something more
interesting in mind than a sharing the Timer via a static variable, but I
hope you get the idea.)

> I will have complete working sample of Jdbc2ConnectionPool
> working in conjunction with TimerService along with tomcat
> sample context in few days. I will post it to the list
>
> I am not familiar with how apache process works.
> What should be my next step?

Just what you said, get something you're happy with an post it to the list
(see http://jakarta.apache.org/site/bugs.html for some detail on putting
together a [PATCH] message if you want.)

> Thank you
>
> Alex
>


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


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


Mime
View raw message