1 4 package com.tc.object.bytecode.hook.impl; 5 6 import com.tc.object.TCObject; 7 import com.tc.object.bytecode.Manageable; 8 9 public class Util { 10 11 private Util() { 12 } 14 15 public static void exit() { 16 exit(null); 17 } 18 19 public static void exit(Throwable t) { 20 if (t != null) { 21 t.printStackTrace(System.err); 22 System.err.flush(); 23 } 24 25 try { 26 Thread.sleep(500); 27 } catch (InterruptedException e) { 28 } 30 31 System.exit(1); 32 } 33 34 35 39 public static void resolveAllReferencesBeforeClone(Object toBeCloned) { 40 if (toBeCloned instanceof Manageable) { 41 TCObject tcObject = ((Manageable) toBeCloned).__tc_managed(); 42 if (tcObject != null) { 43 tcObject.resolveAllReferences(); 44 } 45 } 46 } 47 48 52 public static Object fixTCObjectReferenceOfClonedObject(Object original, Object clone) { 53 if (clone instanceof Manageable && original instanceof Manageable) { 54 Manageable mClone = (Manageable) clone; 55 Manageable mOriginal = (Manageable) original; 56 if (mClone.__tc_managed() != null && clone != original && mClone.__tc_managed() == mOriginal.__tc_managed()) { 57 mClone.__tc_managed(null); 59 } 60 } 61 return clone; 62 } 63 64 } 65 | Popular Tags |