01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.objectserver.managedobject;
05:
06: import com.tc.object.ObjectID;
07:
08: import java.io.IOException;
09: import java.io.ObjectInput;
10: import java.util.Map;
11:
12: /**
13: * This class represents Maps that can handle partial collections in the L1 side. Currently supported classses are
14: * HashMap, LinkedHashMap, Hashtable and Properties. This class should eventually go away once we support partial
15: * collections to all maps.
16: */
17: public class PartialMapManagedObjectState extends MapManagedObjectState {
18:
19: protected PartialMapManagedObjectState(long classID, Map map) {
20: super (classID, map);
21: }
22:
23: public PartialMapManagedObjectState(ObjectInput in)
24: throws IOException {
25: super (in);
26: }
27:
28: public void addObjectReferencesTo(ManagedObjectTraverser traverser) {
29: traverser
30: .addRequiredObjectIDs(getObjectReferencesFrom(references
31: .keySet()));
32: traverser
33: .addReachableObjectIDs(getObjectReferencesFrom(references
34: .values()));
35: }
36:
37: protected void addBackReferenceForValue(BackReferences includeIDs,
38: ObjectID value, ObjectID map) {
39: // Not adding to the backreference so the we dont force the server to do a prefetch on apply
40: return;
41: }
42:
43: public byte getType() {
44: return PARTIAL_MAP_TYPE;
45: }
46:
47: static MapManagedObjectState readFrom(ObjectInput in)
48: throws IOException, ClassNotFoundException {
49: if (false) {
50: // This is added to make the compiler happy. For some reason if I have readFrom() method throw
51: // ClassNotFoundException in LinkedHashMapManagedObjectState, it shows as an error !!
52: throw new ClassNotFoundException();
53: }
54: return new PartialMapManagedObjectState(in);
55: }
56: }
|