01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.bytecode;
06:
07: import com.tc.object.TraversedReference;
08: import com.tc.object.appevent.NonPortableEventContext;
09:
10: import java.util.Collections;
11: import java.util.Set;
12:
13: /**
14: * Registry for non-distributable objects Loaded from boot jar by native classloader, singleton across the VM.
15: */
16: public class NonDistributableObjectRegistry /* implements TraverseTest */{
17:
18: {
19: // XXX: Most of the support for this class has been cleaned up. To wire this class back up,
20: // we need add back a way to let the DSO client use this a TraverseTest when walking the graph of
21: // newly shared objects. Additionally, you want the Set used internally to based on an IdentityWeakHashSet, not just
22: // a regular HashSet
23: if (true)
24: throw new UnsupportedOperationException();
25: }
26:
27: private static final NonDistributableObjectRegistry instance = new NonDistributableObjectRegistry();
28:
29: private Set nonDistributables = null;
30: private boolean added = false;
31:
32: public boolean isAdded() {
33: return added;
34: }
35:
36: public void setAdded() {
37: added = true;
38: }
39:
40: private NonDistributableObjectRegistry() {
41: nonDistributables = Collections
42: .unmodifiableSet(Collections.EMPTY_SET);
43:
44: // potential perfomance bottleneck
45: // nonDistributables = Collections.synchronizedSet(new IdentityWeakHashSet());
46: }
47:
48: public static NonDistributableObjectRegistry getInstance() {
49: return instance;
50: }
51:
52: public boolean shouldTraverse(Object obj) {
53: return obj != null && nonDistributables.contains(obj) == false;
54: }
55:
56: public Set getNondistributables() {
57: return nonDistributables;
58: }
59:
60: public void checkPortability(TraversedReference obj,
61: Class referringClass, NonPortableEventContext context) {
62: // never fails
63: }
64:
65: }
|