01: /*
02: * Copyright (c) 2002-2007 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base;
06:
07: /**
08: * This exception is thrown when retrieving an item from cache and it is
09: * expired.
10: * Note that for fault tolerance purposes, it is possible to retrieve the
11: * current cached object from the exception.
12: *
13: * <p>January, 2004 - The OSCache developers are aware of the fact that throwing
14: * an exception for a perfect valid situation (cache miss) is design smell. This will
15: * be removed in the near future, and other means of refreshing the cache will be
16: * provided.</p>
17: *
18: * @author <a href="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a>
19: * @version $Revision: 433 $
20: */
21: public final class NeedsRefreshException extends Exception {
22:
23: /**
24: * Current object in the cache
25: */
26: private Object cacheContent = null;
27:
28: /**
29: * Create a NeedsRefreshException
30: */
31: public NeedsRefreshException(String message, Object cacheContent) {
32: super (message);
33: this .cacheContent = cacheContent;
34: }
35:
36: /**
37: * Create a NeedsRefreshException
38: */
39: public NeedsRefreshException(Object cacheContent) {
40: super ();
41: this .cacheContent = cacheContent;
42: }
43:
44: /**
45: * Retrieve current object in the cache
46: */
47: public Object getCacheContent() {
48: return cacheContent;
49: }
50:
51: }
|