Java Reference
In-Depth Information
detecting a RuntimeException if the computation might succeed on a future attempt.
Memoizer also does not address cache expiration, but this could be accomplished by using
a subclass of FutureTask that associates an expiration time with each result and period-
ically scanning the cache for expired entries. (Similarly, it does not address cache eviction,
where old entries are removed to make room for new ones so that the cache does not consume
too much memory.)
With our concurrent cache implementation complete, we can now add real caching to the fac-
torizing servlet from Chapter 2 , as promised. Factorizer in Listing 5.20 uses Memoizer
to cache previously computed values efficiently and scalably.
Search WWH ::




Custom Search