Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java @ 1030:c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
gnv-artifacts/trunk@1067 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 06 May 2010 08:32:56 +0000 |
parents | 4bae3081eb1e |
children | 04967dc9c83f |
comparison
equal
deleted
inserted
replaced
1029:a5e0384fe464 | 1030:c07d9f9a738c |
---|---|
499 */ | 499 */ |
500 protected AttributedPoint2ds getResult(String uuid, CallContext callContext) | 500 protected AttributedPoint2ds getResult(String uuid, CallContext callContext) |
501 throws StateException | 501 throws StateException |
502 { | 502 { |
503 CacheFactory cf = CacheFactory.getInstance(); | 503 CacheFactory cf = CacheFactory.getInstance(); |
504 String key = getHash(); | 504 String key = getHash(uuid); |
505 | 505 |
506 if (cf.isInitialized()) { | 506 if (cf.isInitialized()) { |
507 log.debug("Using cache - key: " + key); | |
507 net.sf.ehcache.Element value = cf.getCache().get(key); | 508 net.sf.ehcache.Element value = cf.getCache().get(key); |
508 if (value != null) { | 509 if (value != null) { |
509 return (AttributedPoint2ds)value.getObjectValue(); | 510 log.debug("Found element in cache."); |
510 } | 511 return (AttributedPoint2ds)value.getObjectValue(); |
511 } | 512 } |
512 | 513 } |
514 | |
515 log.debug("Not using cache or element not found."); | |
513 AttributedPoint2ds result = produceResult(callContext); | 516 AttributedPoint2ds result = produceResult(callContext); |
514 | 517 |
515 if (result != null && cf.isInitialized()) { | 518 if (result != null && cf.isInitialized()) { |
516 cf.getCache().put(new net.sf.ehcache.Element(key, result)); | 519 cf.getCache().put(new net.sf.ehcache.Element(key, result)); |
517 } | 520 } |