1 22 23 package org.aspectj.debugger.request; 24 25 import com.sun.jdi.event.*; 26 import org.aspectj.debugger.base.*; 27 28 public class ThreadTextPrintingRequest extends TextPrintingRequest implements ThreadListener { 29 30 public final static int START = 0x01; 31 public final static int DEATH = 0x10; 32 public final static int START_OR_DEATH = 0x11; 33 34 protected int mode; 35 36 public ThreadTextPrintingRequest(Debugger debugger, int mode, String text) { 37 super(debugger, text); 38 if (mode < START || mode > START_OR_DEATH) { 39 throw new IllegalArgumentException 40 ("mode:" + mode + " where " + START + "<=mode<=" + START_OR_DEATH); 41 } 42 this.mode = mode; 43 } 44 45 public Object go() throws NoVMException, DebuggerException { 46 debugger.addThreadListener(this); 47 return text; 48 } 49 50 public void threadDeathEvent(ThreadDeathEvent e) { 51 if ((mode & START) != 0) print(); 52 } 53 54 public void threadStartEvent(ThreadStartEvent e) { 55 if ((mode & DEATH) != 0) print(); 56 } 57 } 58 | Popular Tags |