commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <rwaldh...@apache.org>
Subject RE: [Pool] Re: Sharing eviction threads
Date Fri, 01 Nov 2002 23:46:48 GMT
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>


Mime
View raw message