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;
06:
07: import com.tc.object.bytecode.Clearable;
08: import com.tc.util.Assert;
09:
10: import java.lang.ref.ReferenceQueue;
11:
12: public class TCObjectLogical extends TCObjectImpl {
13:
14: public TCObjectLogical(ReferenceQueue queue, ObjectID id,
15: Object peer, TCClass tcc) {
16: super (queue, id, peer, tcc);
17: }
18:
19: public void logicalInvoke(int method, String methodName,
20: Object[] parameters) {
21: this .markAccessed();
22: getObjectManager().getTransactionManager().logicalInvoke(this ,
23: method, methodName, parameters);
24: }
25:
26: protected boolean isEvictable() {
27: Object peer;
28: if ((peer = getPeerObject()) instanceof Clearable) {
29: return ((Clearable) peer).isEvictionEnabled();
30: } else {
31: return false;
32: }
33: }
34:
35: protected int clearReferences(Object pojo, int toClear) {
36: if (!(pojo instanceof Clearable)) {
37: Assert
38: .fail("TCObjectLogical.clearReferences expected Clearable but got "
39: + (pojo == null ? "null" : pojo.getClass()
40: .getName()));
41: }
42: Clearable clearable = (Clearable) pojo;
43: return clearable.__tc_clearReferences(toClear);
44: }
45:
46: }
|