X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fcache%2FCachedObject.java;h=87feaf0e003f957d0f3310071fae9aab47c4cac4;hb=3a6e2ead110ac7944f60f449b4a68d27b67fc19e;hp=3d200b5ad38d1ba9818c9d4c3d53ebb11f85eaf0;hpb=233b206571da3d744844bac769e04733112b9dd1;p=utils 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 3d200b5a..87feaf0e 100644 --- a/support/general/src/main/java/org/wamblee/cache/CachedObject.java +++ b/support/general/src/main/java/org/wamblee/cache/CachedObject.java @@ -12,23 +12,24 @@ * 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 org.apache.log4j.Logger; - import java.io.Serializable; +import java.util.logging.Level; +import java.util.logging.Logger; /** - * Represents a cached object. The object is either retrieved from the cache if - * the cache has it, or a call back is invoked to get the object (and put it in - * the cache). + * Represents a cached object identified by the key it has in a certain + * {@link Cache}. The object is either retrieved from the cache if the cache has + * it, or a call back is invoked to get the object (and put it in the cache). * * @author Erik Brakkee * */ public class CachedObject { - private static final Logger LOGGER = Logger.getLogger(CachedObject.class); + private static final Logger LOGGER = Logger.getLogger(CachedObject.class + .getName()); /** * Cache to use. @@ -40,6 +41,16 @@ 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. * * @param aObjectKey * Id of the object in the cache. * * @return Object, must be non-null. */ - Value getObject(Key aObjectKey); + Value getObject(Key aObjectKey) throws Exception; } }