/
CostException.java
58 lines (51 loc) · 1.51 KB
/
CostException.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package org.dcache.poolmanager;
import diskCacheV111.util.MissingResourceCacheException;
import org.dcache.poolmanager.SelectedPool;
/**
* Exception thrown when cost constraints have been exceeded
* during pool selection.
*/
public class CostException extends MissingResourceCacheException
{
private static final long serialVersionUID = 2554467702494555943L;
private final SelectedPool _pool;
private final boolean _shouldFallBack;
private final boolean _shouldTryAlternatives;
public CostException(String message, SelectedPool pool,
boolean shouldFallBack,
boolean shouldTryAlternatives)
{
super(message);
_pool = pool;
_shouldFallBack = shouldFallBack;
_shouldTryAlternatives = shouldTryAlternatives;
}
/**
* Returns a pool for the operation that threw the exception.
*
* The pool exceeds cost constraints, but is otherwise a valid
* pool for the operation. May return null.
*
*/
public SelectedPool getPool()
{
return _pool;
}
/**
* Indicates if the caller should fallback to lower priority
* links. Such links may not exist and in such cases fallback
* is not possible.
*/
public boolean shouldFallBack()
{
return _shouldFallBack;
}
/**
* Whether the caller should try staging or replication
* instead.
*/
public boolean shouldTryAlternatives()
{
return _shouldTryAlternatives;
}
}