1 21 22 package org.apache.derbyTesting.unitTests.util; 23 24 import org.apache.derby.iapi.services.monitor.Monitor; 25 import org.apache.derby.iapi.services.sanity.SanityManager; 26 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 27 import org.apache.derby.iapi.services.property.PropertyUtil; 28 29 import org.apache.derby.iapi.services.stream.InfoStreams; 30 31 37 public class MsgTrace implements Runnable { 38 public static final String 42 DELAY_PARAM_NAME = "derby.memoryTrace.bombDelay"; 43 44 public static final String 45 RING_BUFFER_SIZE_PARAM_NAME = "derby.memoryTrace.ringBufferSize"; 46 47 private static MsgTrace singleton = null; 48 long bombDelay; int ringBufferSize; 50 HeaderPrintWriter output; 52 53 private MsgTrace() { 54 55 output = Monitor.getMonitor().getSystemStreams().stream(); 56 57 bombDelay = PropertyUtil.getSystemInt(DELAY_PARAM_NAME, 30 * 60); bombDelay *= 1000; 59 60 ringBufferSize = PropertyUtil.getSystemInt(RING_BUFFER_SIZE_PARAM_NAME, 99); 61 62 64 Thread t = new Thread (this); 65 t.setDaemon(true); 66 t.start(); 67 } 68 69 public static void traceString(String msg) { 70 if (singleton == null) 71 singleton = new MsgTrace(); 72 singleton.trace(msg); 73 } 74 75 private void trace(String msg) { 76 } 82 83 public void run() { 84 try { Thread.sleep(bombDelay); } catch (InterruptedException ie) {} 85 86 88 System.exit(1); 89 } 90 } 91 | Popular Tags |