commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject [math] caching factory / object instances
Date Sat, 05 Jun 2004 23:07:51 GMT
Currently, we have code like the following at various places in [math]
TDistribution tDistribution =

Ken Geis pointed out that at least the way newInstance() is implemented 
now, this is expensive and inefficient 

  One way to solve the immediate problem would be to have the enclosing 
class (e.g. TTestImpl) cache the factory instance (or even the 
distribution instance).  A better solution might be to have 
DistributionFactory do the caching and expose a getInstance() method.  I 
think Stephen suggested something like this in his API review.

I opened a bug report 
( to track this 
issue and I would like to address it consistently throughout [math]. Are 
there any objections to replacing the XxFactory.newInstance() methods with 
getInstance() methods that return cached instances?  Is there any reason 
that we should *not* do this?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message