incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r897809 - in /incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates: AbstractIBMSPIBasedDumpInitiatorDelegate.java JavaDumpDelegate.java XMLDumpWriter.java
Date Mon, 11 Jan 2010 09:27:55 GMT
Author: spoole
Date: Mon Jan 11 09:27:54 2010
New Revision: 897809

URL: http://svn.apache.org/viewvc?rev=897809&view=rev
Log:
updated trigger delegates to support new JDump code yet to be committed

Removed:
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/XMLDumpWriter.java
Modified:
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/AbstractIBMSPIBasedDumpInitiatorDelegate.java
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java

Modified: incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/AbstractIBMSPIBasedDumpInitiatorDelegate.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/AbstractIBMSPIBasedDumpInitiatorDelegate.java?rev=897809&r1=897808&r2=897809&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/AbstractIBMSPIBasedDumpInitiatorDelegate.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/AbstractIBMSPIBasedDumpInitiatorDelegate.java
Mon Jan 11 09:27:54 2010
@@ -19,7 +19,6 @@
 import javax.tools.diagnostics.vm.DumpDescriptor;
 import javax.tools.diagnostics.vm.DumpHandle;
 import javax.tools.diagnostics.vm.DumpInitiatorDelegate;
-import javax.tools.diagnostics.vm.spi.DumpInitiatorCapabilities;
 
 /**
  * Dump Delegate for IBM JVMs using the com.ibm.jvm.Dump API Note that

Modified: incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java?rev=897809&r1=897808&r2=897809&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
Mon Jan 11 09:27:54 2010
@@ -15,14 +15,23 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Method;
 
 import javax.tools.diagnostics.vm.DumpDescriptor;
 import javax.tools.diagnostics.vm.DumpHandle;
 import javax.tools.diagnostics.vm.DumpInitiatorDelegate;
 import javax.tools.diagnostics.vm.spi.DumpInitiatorCapabilities;
 
+/**
+ * Delegate class which uses reflection to determine if the Kato 
+ * JDump is available
+ * 
+ *
+ */
 public class JavaDumpDelegate implements DumpInitiatorDelegate {
 
+	private Method dumpMethod = null;
+	
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -31,16 +40,34 @@
 
 	private boolean createDump(DumpDescriptor copy) throws IOException {
 
-		File dumpFile=new File("dump.kato");
-		XMLDumpWriter writer=new XMLDumpWriter();
-		writer.write(dumpFile);
-		return true;
+		File dumpFile=new File("kato.jdump");
+		Object[] data=new Object[]{dumpFile,copy};
+		try {
+			return (Boolean) dumpMethod.invoke(null, data);
+			
+		} catch (Exception e) {
+			throw new IOException("dump failed", e);
+		}
+		
 	
 		
 	}
 
 	public boolean available() {
-		return true;
+		try {
+			// does class exist?
+			Class clazz = Class.forName("org.apache.kato.jdump.trigger.JDumpTrigger");
+			// store the dump method for later use
+			dumpMethod = clazz.getMethod("triggerDump", new Class[]{DumpDescriptor.class,File.class});
+			return true;
+
+		} catch(ClassNotFoundException cnfe) {
+			return false;
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
 	}
 
 	@Override
@@ -75,6 +102,6 @@
 
 	@Override
 	public String getDumpType() {
-		return "dump.kato";
+		return "kato.jdump";
 	}
 }
\ No newline at end of file



Mime
View raw message