- public ValueType get() {
- ValueType object = (ValueType)_cache.get(_objectKey); // the used cache is thread safe.
- if ( object == null ) {
- // synchronize the computation to make sure that the object is only computed
- // once when multiple concurrent threads detect that the entry must be
- // recomputed.
- synchronized (this) {
- object = (ValueType)_cache.get(_objectKey);
- if ( object == null ) {
- // No other thread did a recomputation so we must do this now.
- LOGGER.debug("Refreshing cache for '" + _objectKey + "'");
- object = _computation.getObject(_objectKey);
- _cache.put(_objectKey, object);
- }
+ public ValueType get() {
+ ValueType object = (ValueType) _cache.get(_objectKey); // the used
+ // cache is
+ // thread safe.
+ if (object == null) {
+ // synchronize the computation to make sure that the object is only
+ // computed
+ // once when multiple concurrent threads detect that the entry must
+ // be
+ // recomputed.
+ synchronized (this) {
+ object = (ValueType) _cache.get(_objectKey);
+ if (object == null) {
+ // No other thread did a recomputation so we must do this
+ // now.
+ LOGGER.debug("Refreshing cache for '" + _objectKey + "'");
+ object = _computation.getObject(_objectKey);
+ _cache.put(_objectKey, object);
+ }