mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add jconsole plugin
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package com.alibaba.druid.support.jconsole;
|
||||
|
||||
public class DruidDataSourcePanel extends DruidPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.alibaba.druid.support.jconsole;
|
||||
|
||||
public class DruidDriverPanel extends DruidPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.druid.support.jconsole;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.sun.tools.jconsole.JConsoleContext;
|
||||
|
||||
public class DruidPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected Object doInBackground(JConsoleContext context) throws Exception {
|
||||
doInBackground(context.getMBeanServerConnection());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void doInBackground(MBeanServerConnection conn) throws Exception {
|
||||
System.out.println("doInBackground");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.alibaba.druid.support.jconsole;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
import com.sun.tools.jconsole.JConsolePlugin;
|
||||
|
||||
public class DruidPlugin extends JConsolePlugin {
|
||||
|
||||
private final Map<String, JPanel> tabs = new LinkedHashMap<String, JPanel>();
|
||||
|
||||
public DruidPlugin(){
|
||||
tabs.put("Druid-Driver", new DruidDriverPanel());
|
||||
tabs.put("Druid-DataSource", new DruidDataSourcePanel());
|
||||
tabs.put("Druid-SQL", new DruidSQLPanel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, JPanel> getTabs() {
|
||||
return tabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwingWorker<?, ?> newSwingWorker() {
|
||||
SwingWorker<?, ?> worer = new SwingWorker<Object, Object>() {
|
||||
|
||||
@Override
|
||||
protected Object doInBackground() throws Exception {
|
||||
return DruidPlugin.this.doInBackground();
|
||||
}
|
||||
};
|
||||
|
||||
return worer;
|
||||
}
|
||||
|
||||
protected Object doInBackground() throws Exception {
|
||||
for (JPanel panel : tabs.values()) {
|
||||
((DruidPanel) panel).doInBackground(this.getContext());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.druid.support.jconsole;
|
||||
|
||||
|
||||
public class DruidSQLPanel extends DruidPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user