|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NeedsRefreshException.java | - | 60% | 66,7% | 62,5% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright (c) 2002-2007 by OpenSymphony | |
| 3 | * All rights reserved. | |
| 4 | */ | |
| 5 | package com.opensymphony.oscache.base; | |
| 6 | ||
| 7 | /** | |
| 8 | * This exception is thrown when retrieving an item from cache and it is | |
| 9 | * 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 | 0 | public NeedsRefreshException(String message, Object cacheContent) { |
| 32 | 0 | super(message); |
| 33 | 0 | this.cacheContent = cacheContent; |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Create a NeedsRefreshException | |
| 38 | */ | |
| 39 | 4565219 | public NeedsRefreshException(Object cacheContent) { |
| 40 | 4565219 | super(); |
| 41 | 4565219 | this.cacheContent = cacheContent; |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * Retrieve current object in the cache | |
| 46 | */ | |
| 47 | 60 | public Object getCacheContent() { |
| 48 | 60 | return cacheContent; |
| 49 | } | |
| 50 | ||
| 51 | } |
|
||||||||||