001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.objectserver.impl;
006:
007: import com.tc.object.ObjectID;
008: import com.tc.objectserver.core.api.ManagedObject;
009:
010: import gnu.trove.TLinkable;
011:
012: public class FaultingManagedObjectReference implements
013: ManagedObjectReference {
014:
015: private final ObjectID id;
016: private boolean inProgress;
017:
018: public FaultingManagedObjectReference(ObjectID id) {
019: this .id = id;
020: this .inProgress = true;
021: }
022:
023: public boolean isFaultingInProgress() {
024: return inProgress;
025: }
026:
027: public void faultingFailed() {
028: this .inProgress = false;
029: }
030:
031: public void setRemoveOnRelease(boolean removeOnRelease) {
032: // NOP
033: }
034:
035: public boolean isRemoveOnRelease() {
036: return true;
037: }
038:
039: public void markReference() {
040: // This Object is always referenced.
041: }
042:
043: public void unmarkReference() {
044: // This Object is always referenced.
045: }
046:
047: public boolean isReferenced() {
048: return inProgress;
049: }
050:
051: public boolean isNew() {
052: return false;
053: }
054:
055: public ManagedObject getObject() {
056: throw new AssertionError("This should never be called");
057: }
058:
059: public ObjectID getObjectID() {
060: return id;
061: }
062:
063: public void markAccessed() {
064: // NOP
065: }
066:
067: public void clearAccessed() {
068: // NOP
069: }
070:
071: public boolean recentlyAccessed() {
072: return true;
073: }
074:
075: public int accessCount(int factor) {
076: return 0;
077: }
078:
079: public TLinkable getNext() {
080: // this object should never go into the cache
081: return null;
082: }
083:
084: public TLinkable getPrevious() {
085: // this object should never go into the cache
086: return null;
087: }
088:
089: public void setNext(TLinkable linkable) {
090: // this object should never go into the cache
091: throw new AssertionError("This should never be called");
092: }
093:
094: public void setPrevious(TLinkable linkable) {
095: // this object should never go into the cache
096: throw new AssertionError("This should never be called");
097: }
098:
099: public boolean canEvict() {
100: return false;
101: }
102:
103: public String toString() {
104: return "FaultingManagedObjectReference [ " + id
105: + " inProgress : " + inProgress + " ]";
106: }
107:
108: }
|