if(VM_HardwarePerformanceMonitors.verbose>=1) VM.sysWriteln("VM_TraceWriter.thresholdReached() notifyExit flush current buffer ", hpm.getNameOfCurrentBuffer()); byte[] buffer = hpm.getCurrentBuffer(); int    index  = hpm.getCurrentIndex(); writeFileOutputStream(buffer, index); closeFileOutputStream();
return;
  public void run() {    initialize();    while (true) {      passivate(); // wait until externally scheduled to run      if (notifyExit == true) {	// Only called once from producer when notify exit occurs.	// Flush current buffer	if(VM_HardwarePerformanceMonitors.verbose>=1)	  VM.sysWriteln("VM_TraceWriter.thresholdReached() notifyExit flush current buffer ",			hpm.getNameOfCurrentBuffer());	byte[] buffer = hpm.getCurrentBuffer();	int    index  = hpm.getCurrentIndex();	writeFileOutputStream(buffer, index);	closeFileOutputStream();      } else {	try {	  thresholdReached();       // we've been scheduled; do our job!	} catch (Exception e) {	  e.printStackTrace();	  VM.sysFail("Exception in VM_ConsumerThread "+this);	}      }    }   }