java - Getting Dump from weblogic server programatically -


i have requirement need design small app contains button. when user clicks on that, connect corresponding weblogic server , mds dump zip file located in particular location downloaded user. need implement programmatically using java language , preferably using mbeans.

i new mbeans concept. can 1 me out on how figure out correct mbean access dump files , download them?

i have done this: here code:

public class heapgenerator {  private heapgenerator() {  }  private static final string hotspot_bean_name = "com.sun.management:type=hotspotdiagnostic"; private static long lastheapdumpgenrationtime ; // field store hotspot diagnostic mbean private static volatile hotspotdiagnosticmxbean hotspotmbean;  public static void generateheapdump(string filename, boolean live) {     // initialize hotspot diagnostic mbean     inithotspotmbean();     try {         file dumpfile = new file(filename);         if (dumpfile.exists()) {             dumpfile.delete();         }         hotspotmbean.dumpheap(filename, live);     } catch (runtimeexception re) {         throw re;     } catch (exception exp) {         throw new runtimeexception(exp);     } }  // initialize hotspot diagnostic mbean field private static void inithotspotmbean() {     if (hotspotmbean == null) {         synchronized (heapdumpgenerator.class) {             if (hotspotmbean == null) {                 hotspotmbean = gethotspotmbean();             }         }     } }  // hotspot diagnostic mbean // platform mbean server private static hotspotdiagnosticmxbean gethotspotmbean() {     try {         mbeanserver server = managementfactory.getplatformmbeanserver();         hotspotdiagnosticmxbean bean = managementfactory.newplatformmxbeanproxy(server, hotspot_bean_name, hotspotdiagnosticmxbean.class);         return bean;     } catch (runtimeexception re) {         throw re;     } catch (exception exp) {         throw new runtimeexception(exp);     } }  public static string generateheapdump() {     string filename = getfullheapdumpfilename();     generateheapdump(filename, true);     return filename; }  } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -