From 7d3754ca3d757ef89241cdbd679f82941e64cfc6 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 31 Jul 2010 17:32:56 +0000 Subject: [PATCH] --- .../java/org/wamblee/cache/CachedObject.java | 20 ++++++------ .../java/org/wamblee/cache/ComputedValue.java | 31 ++++++++++--------- .../main/java/org/wamblee/cache/EhCache.java | 6 ++-- .../java/org/wamblee/cache/ForeverCache.java | 2 +- .../java/org/wamblee/cache/ZeroCache.java | 2 +- .../java/org/wamblee/cache/package-info.java | 2 +- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/support/general/src/main/java/org/wamblee/cache/CachedObject.java b/support/general/src/main/java/org/wamblee/cache/CachedObject.java index 7ec87534..da86298d 100644 --- a/support/general/src/main/java/org/wamblee/cache/CachedObject.java +++ b/support/general/src/main/java/org/wamblee/cache/CachedObject.java @@ -79,10 +79,10 @@ public class CachedObject { /** - * Gets the object. Called when the object is not in the cache. - * In case computation fails, an exception should be thrown to ensure that the last - * known value will be used. + * Gets the object. Called when the object is not in the cache. In case + * computation fails, an exception should be thrown to ensure that the + * last known value will be used. * * @param aObjectKey * Id of the object in the cache. diff --git a/support/general/src/main/java/org/wamblee/cache/ComputedValue.java b/support/general/src/main/java/org/wamblee/cache/ComputedValue.java index 24bbe5b0..4acafe6a 100644 --- a/support/general/src/main/java/org/wamblee/cache/ComputedValue.java +++ b/support/general/src/main/java/org/wamblee/cache/ComputedValue.java @@ -63,7 +63,7 @@ public class ComputedValue { private Computation computedValue; private Boolean busy; - private T value; + private T value; /** * Constructs the compute guard @@ -77,7 +77,7 @@ public class ComputedValue { lock = aLock; computedValue = aComputation; busy = false; - value = null; + value = null; } /** @@ -122,24 +122,27 @@ public class ComputedValue { return value; } } - + /** - * Gets the currently cached value. No recomputation is performed. - * @return Cached value. + * Gets the currently cached value. No recomputation is performed. + * + * @return Cached value. */ - public T getCached() { - synchronized(lock) { - return value; + public T getCached() { + synchronized (lock) { + return value; } - + } - + /** - * Sets the value explicitly. - * @param aValue value to set. + * Sets the value explicitly. + * + * @param aValue + * value to set. */ - public void set(T aValue) { - synchronized(lock) { + public void set(T aValue) { + synchronized (lock) { value = aValue; } } diff --git a/support/general/src/main/java/org/wamblee/cache/EhCache.java b/support/general/src/main/java/org/wamblee/cache/EhCache.java index 9c32dda8..795a95b4 100644 --- a/support/general/src/main/java/org/wamblee/cache/EhCache.java +++ b/support/general/src/main/java/org/wamblee/cache/EhCache.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.cache; import net.sf.ehcache.Cache; @@ -20,7 +20,6 @@ import net.sf.ehcache.CacheException; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; - import org.wamblee.io.InputResource; import java.io.IOException; @@ -36,7 +35,8 @@ import java.util.logging.Logger; */ public class EhCache implements org.wamblee.cache.Cache { - private static final Logger LOGGER = Logger.getLogger(EhCache.class.getName()); + private static final Logger LOGGER = Logger.getLogger(EhCache.class + .getName()); /** * EH Cache manager. diff --git a/support/general/src/main/java/org/wamblee/cache/ForeverCache.java b/support/general/src/main/java/org/wamblee/cache/ForeverCache.java index aa2331fd..82b75f7f 100644 --- a/support/general/src/main/java/org/wamblee/cache/ForeverCache.java +++ b/support/general/src/main/java/org/wamblee/cache/ForeverCache.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.cache; import java.io.Serializable; diff --git a/support/general/src/main/java/org/wamblee/cache/ZeroCache.java b/support/general/src/main/java/org/wamblee/cache/ZeroCache.java index d748e2a4..c2b3c678 100644 --- a/support/general/src/main/java/org/wamblee/cache/ZeroCache.java +++ b/support/general/src/main/java/org/wamblee/cache/ZeroCache.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.cache; import java.io.Serializable; diff --git a/support/general/src/main/java/org/wamblee/cache/package-info.java b/support/general/src/main/java/org/wamblee/cache/package-info.java index 540a1c54..bfec950d 100644 --- a/support/general/src/main/java/org/wamblee/cache/package-info.java +++ b/support/general/src/main/java/org/wamblee/cache/package-info.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ /** * This package provides an interface for a cache together with several implementations. * The main interfaces and classes are: -- 2.31.1