1 19 20 package org.apache.excalibur.instrument.manager.http; 21 22 import java.io.IOException ; 23 import java.io.PrintWriter ; 24 import java.util.Map ; 25 26 import org.apache.excalibur.instrument.manager.http.server.HTTPRedirect; 27 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 28 import org.apache.excalibur.instrument.manager.InstrumentSampleDescriptor; 29 import org.apache.excalibur.instrument.manager.NoSuchInstrumentSampleException; 30 31 37 public class HTMLGCHandler 38 extends AbstractHTMLHandler 39 { 40 43 49 public HTMLGCHandler( DefaultInstrumentManager manager, 50 InstrumentManagerHTTPConnector connector ) 51 { 52 super( "/gc.html", manager, connector ); 53 } 54 55 58 65 public void doGet( String path, Map parameters, PrintWriter out ) 66 throws IOException 67 { 68 long oldMemory = getMemory(); 69 70 System.gc(); 71 72 long newMemory = getMemory(); 73 74 throw new HTTPRedirect( 75 "instrument-manager.html?oldMemory=" + oldMemory + "&newMemory=" + newMemory ); 76 } 77 78 81 private long getMemory() 82 { 83 Runtime rt = Runtime.getRuntime(); 84 return rt.totalMemory() - rt.freeMemory(); 85 } 86 } 87 88 | Popular Tags |