BlockingCache
implementation ran for almost a year
on a very busy application before finally getting overwhelmed. It was
using notifyAll()
, and once the load on the cache got
very high indeed, the threads started spending most of their time
stampeding to the object lock and very little time doing anything else.
The result was that server threads went to 1500 and server output
dropped to almost nothing.At present ehcache-constructs contains:
In addition For JDK1.2 and JDK 1.3, ehcache requires:
SimpleLog
. This enables
ehcache to use logging infrastructures compatible with Java versions
from JDK1.2 to JDK5. It does create a dependency on Apache Commons
Logging, however many projects, including Hibernate, share the same
dependency.WARN
level in log4J
and the WARNING
level for JDK1.4 logging. 1. cvs
-d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ehcache login 2. cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ehcache co ehcache-constructs |
private BlockingCache blockingCache; private PageInfo processRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { final String key = calculateKey(request); PageInfo pageInfo = (PageInfo) blockingCache.get(key); if (pageInfo == null) { try { //Page is not cached - build the response, cache it, and send to client pageInfo = buildPage(request, response, chain); blockingCache.put(key, pageInfo); return pageInfo } catch (final Throwable throwable) { // Must unlock the cache if the above fails blockingCache.put(key, null); throw new Exception("Could not build cached page.", throwable); } } |