1 4 package com.tctest; 5 6 import com.tc.object.TCObject; 7 import com.tc.object.bytecode.TransparentAccess; 8 9 import java.util.Map ; 10 11 public class UnInstrumentedObject implements TransparentAccess { 12 private long longValue; 13 private boolean booleanValue; 14 private UnInstrumentedObject objectValue; 15 private UnInstrumentedObject objectValue1; 16 private UnInstrumentedObject objectValue2; 17 private Object object = new Object (); 18 public Object lock = new Object (); 19 private boolean protect = false; 20 private final Object protectLock = new Object (); 21 22 public UnInstrumentedObject(boolean sub) { 23 this.longValue = System.currentTimeMillis(); 24 this.booleanValue = System.currentTimeMillis() % 2 == 0; 25 if (sub) { 26 this.objectValue = new UnInstrumentedObject(false); 27 this.objectValue1 = new UnInstrumentedObject(false); 28 this.objectValue2 = new UnInstrumentedObject(false); 29 } 30 } 31 32 public void setValues() { 33 this.longValue = System.currentTimeMillis(); 34 this.booleanValue = System.currentTimeMillis() % 2 == 0; 35 36 this.objectValue = new UnInstrumentedObject(false); 37 this.objectValue1 = new UnInstrumentedObject(false); 38 this.objectValue2 = new UnInstrumentedObject(false); 39 } 40 41 public void accessValues() { 42 if (object == null) { 43 System.out.println("blah"); 44 } 45 46 myMethod(longValue, booleanValue, objectValue, objectValue1, objectValue2); 47 if (objectValue != null) { 48 synchronized (getLock()) { 49 objectValue.accessValues(); 50 } 51 synchronized (getLock()) { 52 objectValue1.accessValues(); 53 } 54 synchronized (getLock()) { 55 objectValue2.accessValues(); 56 } 57 } 58 } 59 60 81 public void makeUnProtected() { 82 protect = false; 83 84 } 85 86 public void makeProtected() { 87 protect = true; 88 synchronized (protectLock) { 89 protectLock.notify(); 90 } 91 } 92 93 public boolean isProtected() { 94 return this.protect; 95 } 96 97 public Object getLock() { 98 return lock; 99 } 100 101 private void myMethod(long longValue2, boolean booleanValue2, UnInstrumentedObject o, UnInstrumentedObject o1, 102 UnInstrumentedObject o2) { 103 } 105 106 public void __tc_getallfields(Map map) { 107 } 109 110 public void __tc_setfield(String name, Object value) { 111 } 113 114 public void __tc_managed(TCObject t) { 115 } 117 118 public TCObject __tc_managed() { 119 return null; 120 } 121 122 public Object __tc_getmanagedfield(String name) { 123 return null; 124 125 } 126 127 public void __tc_setmanagedfield(String name, Object value) { 128 130 } 131 } 132 | Popular Tags |