KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > impl > FaultingManagedObjectReference


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.objectserver.impl;
6
7 import com.tc.object.ObjectID;
8 import com.tc.objectserver.core.api.ManagedObject;
9
10 import gnu.trove.TLinkable;
11
12 public class FaultingManagedObjectReference implements ManagedObjectReference {
13
14   private final ObjectID id;
15   private boolean inProgress;
16   private boolean processPending;
17
18   public FaultingManagedObjectReference(ObjectID id) {
19     this.id = id;
20     this.inProgress = true;
21   }
22
23   public boolean isFaultingInProgress() {
24     return inProgress;
25   }
26
27   public void faultingComplete() {
28     this.inProgress = false;
29   }
30
31   public boolean getProcessPendingOnRelease() {
32     return this.processPending;
33   }
34
35   public void setProcessPendingOnRelease(boolean b) {
36     this.processPending = b;
37   }
38
39   public void setRemoveOnRelease(boolean removeOnRelease) {
40     // NOP
41
}
42
43   public boolean isRemoveOnRelease() {
44     return true;
45   }
46
47   public void markReference() {
48     // This Object is always referenced.
49
}
50
51   public void unmarkReference() {
52     // This Object is always referenced.
53
}
54
55   public boolean isReferenced() {
56     return true;
57   }
58
59   public boolean isNew() {
60     return false;
61   }
62
63   public ManagedObject getObject() {
64     throw new AssertionError JavaDoc("This should never be called");
65   }
66
67   public ObjectID getObjectID() {
68     return id;
69   }
70
71   public void markAccessed() {
72     // NOP
73
}
74
75   public void clearAccessed() {
76     // NOP
77
}
78
79   public boolean recentlyAccessed() {
80     return true;
81   }
82
83   public int accessCount(int factor) {
84     return 0;
85   }
86
87   public TLinkable getNext() {
88     // this object should never go into the cache
89
return null;
90   }
91
92   public TLinkable getPrevious() {
93     // this object should never go into the cache
94
return null;
95   }
96
97   public void setNext(TLinkable linkable) {
98     // this object should never go into the cache
99
throw new AssertionError JavaDoc("This should never be called");
100   }
101
102   public void setPrevious(TLinkable linkable) {
103     // this object should never go into the cache
104
throw new AssertionError JavaDoc("This should never be called");
105   }
106
107   public boolean canEvict() {
108     return false;
109   }
110
111   public String JavaDoc toString() {
112     return "FaultingManagedObjectReference [ " + id + " inProgress : " + inProgress + " processPending : "
113            + processPending + " ]";
114   }
115
116 }
117
Popular Tags