Thursday, January 26, 2006

aw3 pool and cache

Well, I've got some fast code working, but its only pool and cache.

Pool is a mechanism for reference counting. Something Python does for you, but in Java, if you want to avoid spending too much time in GC, you gotta do it yourself. I took the lazy way out here and made aw3.pool.Poolable a base class. And aw3.pool.Factory is a generic component factory which also maintains the pool of recycled components--'cause you also want to avoid creating new objects.

http://agilewiki.org/aw3/pool/

In the cache package, we've got Cachable, Cache and CacheMonitor. CacheMonitor is just a helper class for Cache. Cachable is a base class for cachable components (and extends Poolable). And Cache is a generic component cache manager which extends Factory.

http://agilewiki.org/aw3/cache/

A lot of work, but not to much to show for it. But at least I'm back to Java. And speed seems OK--my test loop runs about 10 Lack (10,00,000) a second. (Thats a million for you folk not in India.)

Usage note: when you fetch a component from the pool or cache, its reference count has already been incremented for you--remember to decriment it!.

I'll note that there is still some cleanup (and javadocs) left to do before I move on to wdb.

Bill

0 Comments:

Post a Comment

<< Home