Commits

Colin Gordon committed 03d4ad7 Draft

initial commit, most of the way through annotating JVMMonitor

Comments (0)

Files changed (501)

Add a comment to this file

jvmmonitor-read-only/.log.txt.swp

Binary file added.

jvmmonitor-read-only/analyze.sh

+#!/bin/bash
+export PATH=~/research/guitypes/checker/binary:$PATH
+
+CHECKER=/homes/gws/csgordon/research/guitypes/checker/dist/lib/guitypes-`date "+%Y%m%d"`.jar
+
+CFJARS="/homes/gws/csgordon/research/guitypes/checker/binary/jsr308-all.jar"
+
+JARS=
+
+#ECLIPSEJARS="/usr/lib/eclipse/plugins/org.eclipse.ui.navigator_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.ide_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.ui_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.core_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.navigator.resources_3.4.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.debug.core_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.debug.ui_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.resources_3.7.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.swt_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jface_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.commands_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.workbench_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.runtime_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.osgi_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.common_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.jobs_3.5.100.dist.jar:/usr/lib/ecliplse/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.0.dist/runtime_registry_compatibility.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.registry_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.preferences_3.4.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.contenttype_3.4.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.app_1.3.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.forms_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.net_1.2.100.dist.jar"
+ECLIPSEJARS="/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.debug_3.7.0.dist/jdimodel.jar:`ls /usr/lib/eclipse/plugins/*.jar /usr/lib/eclipse/dropins/jdt/plugins/*.jar | tr "\n" :`:/homes/gws/csgordon/research/experiments/timed/jvmmonitor/jvmmonitor-read-only/org.jvmmonitor.ui/lib/org.swtchart_0.8.0.v20120301.jar"
+
+
+
+DEBUG= #"-AprintErrorStack -Afilenames -Ashowchecks" #-Alint=debugSpew"
+ERRS=9999
+
+COMMAND="javac -encoding ISO-8859-1 -J-Xbootclasspath/p:$CFJARS -Xmaxerrs $ERRS -cp $CHECKER:$ECLIPSEJARS -processor guitypes.checkers.GUIEffectsChecker $DEBUG"
+
+echo $COMMAND
+
+JAVAFILES=`find . -name "*.java"`
+#echo $JAVAFILES
+
+#if [ -e $CHECKER ];
+#then
+#    find . -name '*.java' | xargs $COMMAND;
+#else
+    pushd ~/research/guitypes/checker && ant dist && popd && find . -name '*.java' | xargs $COMMAND;
+#fi
+
+
+#

jvmmonitor-read-only/brief.sh

+#!/bin/bash
+./analyze.sh &> log.txt; tail -n 2 log.txt

jvmmonitor-read-only/log.txt

+javac -encoding ISO-8859-1 -J-Xbootclasspath/p:/homes/gws/csgordon/research/guitypes/checker/binary/jsr308-all.jar -Xmaxerrs 9999 -cp /homes/gws/csgordon/research/guitypes/checker/dist/lib/guitypes-20120601.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.debug_3.7.0.dist/jdimodel.jar:/usr/lib/eclipse/dropins/jdt/plugins/junit4.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.ant.launching_1.0.100.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.ant.ui_3.5.100.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.apt.core_3.3.500.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.apt.pluggable.core_1.0.400.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.apt.ui_3.3.300.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.compiler.apt_1.0.400.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.compiler.tool_1.0.100.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.core_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.core.manipulation_1.4.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.debug.ui_3.6.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.doc.user_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.junit_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.junit4.runtime_1.1.200.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.junit.core_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.junit.runtime_3.4.300.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.launching_3.6.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.eclipse.jdt.ui_3.7.0.dist.jar:/usr/lib/eclipse/dropins/jdt/plugins/org.hamcrest.core_1.1.0.jar:/usr/lib/eclipse/plugins/com.ibm.icu_4.4.2.v20110208.jar:/usr/lib/eclipse/plugins/com.jcraft.jsch_0.1.42.jar:/usr/lib/eclipse/plugins/javax.servlet_2.5.0.v200806031605.jar:/usr/lib/eclipse/plugins/javax.servlet.jsp_2.0.0.v200806031607.jar:/usr/lib/eclipse/plugins/org.apache.commons.codec_1.4.0.jar:/usr/lib/eclipse/plugins/org.apache.commons.el_1.0.0.v200806031608.jar:/usr/lib/eclipse/plugins/org.apache.commons.httpclient_3.1.0.jar:/usr/lib/eclipse/plugins/org.apache.commons.logging_1.0.4.v20080605-1930.jar:/usr/lib/eclipse/plugins/org.apache.jasper_5.5.26.jar:/usr/lib/eclipse/plugins/org.apache.lucene_2.9.1.dist.jar:/usr/lib/eclipse/plugins/org.apache.lucene.analysis_2.9.4.jar:/usr/lib/eclipse/plugins/org.apache.lucene.core_2.9.4.jar:/usr/lib/eclipse/plugins/org.eclipse.ant.core_3.2.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.compare_3.5.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.compare.core_3.5.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.boot_3.1.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.commands_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.contenttype_3.4.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.databinding_1.4.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.databinding.beans_1.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.databinding.observable_1.4.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.databinding.property_1.4.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.expressions_3.4.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.externaltools_1.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.filebuffers_3.5.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.filesystem_1.3.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.jobs_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.net_1.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.resources_3.7.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.runtime_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.runtime.compatibility_3.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.core.variables_3.2.500.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.cvs_1.1.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.debug.core_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.debug.ui_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf_3.1.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.filetransfer_5.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.identity_3.1.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ecf.ssl_1.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.app_1.3.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.common_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.concurrent_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.ds_1.3.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.event_1.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.http.jetty_2.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.http.registry_1.1.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.http.servlet_1.1.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.initializer_1.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.console_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.core_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.director_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.director.app_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.directorywatcher_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.engine_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.extensionlocation_1.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.metadata_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.operations_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.publisher_1.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.ql_2.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.reconciler.dropins_1.1.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.repository_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.repository.tools_2.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.ui_2.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.ui.importexport_1.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.ui.sdk_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.ui.sdk.scheduler_1.0.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.updatechecker_1.1.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.p2.updatesite_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.preferences_3.4.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.registry_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.security_1.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.security.ui_1.1.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.equinox.util_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.help_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.help.appserver_3.1.400.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.help.base_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.help.ui_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.help.webapp_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jface_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jface.databinding_1.5.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jface.text_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jsch.core_1.1.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.jsch.ui_1.1.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ltk.core.refactoring_3.5.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ltk.ui.refactoring_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.osgi_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.osgi.services_3.3.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.osgi.util_3.2.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.platform.doc.user_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.rcp_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.search_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.swt_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.team.core_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.team.cvs.core_3.3.400.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.team.cvs.ssh2_3.2.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.team.cvs.ui_3.3.400.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.team.ui_3.6.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.text_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.browser_3.3.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.cheatsheets_3.4.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.console_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.editors_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.externaltools_3.2.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.forms_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.ide_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.ide.application_1.0.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.intro_3.4.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.navigator_3.5.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.navigator.resources_3.4.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.net_1.2.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.presentations.r21_3.2.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.views_3.6.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.workbench_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.update.configurator_3.3.100.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.update.core_3.2.500.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.update.scheduler_3.2.300.dist.jar:/usr/lib/eclipse/plugins/org.eclipse.update.ui_3.2.300.dist.jar:/usr/lib/eclipse/plugins/org.mortbay.jetty.server_6.1.24.jar:/usr/lib/eclipse/plugins/org.mortbay.jetty.util_6.1.24.jar:/usr/lib/eclipse/plugins/org.sat4j.core_2.3.0.WHEEZY.jar:/usr/lib/eclipse/plugins/org.sat4j.pb_2.3.0.WHEEZY.jar::/homes/gws/csgordon/research/experiments/timed/jvmmonitor/jvmmonitor-read-only/org.jvmmonitor.ui/lib/org.swtchart_0.8.0.v20120301.jar -processor guitypes.checkers.GUIEffectsChecker
+~/research/guitypes/checker ~/research/experiments/timed/jvmmonitor/jvmmonitor-read-only
+Buildfile: /homes/gws/csgordon/research/guitypes/checker/build.xml
+
+init:
+
+compile:
+[jsr308.javac] /homes/gws/csgordon/research/guitypes/checker/build.xml:40: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
+     [copy] Copying 1 file to /homes/gws/csgordon/research/guitypes/checker/build/guitypes/checkers
+
+dist:
+      [jar] Building jar: /homes/gws/csgordon/research/guitypes/checker/dist/lib/guitypes-20120601.jar
+
+BUILD SUCCESSFUL
+Total time: 0 seconds
+~/research/experiments/timed/jvmmonitor/jvmmonitor-read-only
+./org.jvmmonitor.tools/src/org/jvmmonitor/tools/Activator.java:17: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+public class Activator extends AbstractUIPlugin {
+       ^
+./org.jvmmonitor.tools/src/org/jvmmonitor/tools/Activator.java:30: error: Calling a method with UIEffect effect from a context limited to PolyUIEffect effects.
+        super.start(context);
+                   ^
+./org.jvmmonitor.tools/src/org/jvmmonitor/tools/Activator.java:39: error: Calling a method with UIEffect effect from a context limited to PolyUIEffect effects.
+        super.stop(context);
+                  ^
+./org.jvmmonitor.core/src/org/jvmmonitor/internal/core/MBeanServer.java:1003: error: incompatible types.
+            mxBean = newPlatformMXBeanProxy(connection, mxBeanName, mxBeanClass);
+                                                                    ^
+  found   : @AlwaysSafe Class<? extends @AlwaysSafe Object>
+  required: @AlwaysSafe Class<@AlwaysSafe Object>
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/RefreshJob.java:50: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        refreshModel(monitor);
+                    ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/editors/AbstractDumpEditor.java:192: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IResourceChangeListener.resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)).
+        public void resourceChanged(IResourceChangeEvent event) {
+                    ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/memory/HeapHistogramPage.java:170: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)).
+    public void propertyChange(PropertyChangeEvent event) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/memory/DumpHprofAction.java:151: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                if (isMemoryAnalyzerInstalled() && fileStore != null) {
+                                             ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/AbstractJvmPropertySection.java:209: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IJvmModelChangeListener.jvmModelChanged(org.jvmmonitor.core.JvmModelEvent)).
+    public void jvmModelChanged(final JvmModelEvent e) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/AbstractSashForm.java:79: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe ISashForm.setOrientation(org.jvmmonitor.internal.ui.actions.ToggleOrientationAction.Orientation)).
+    public void setOrientation(Orientation orientation) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:128: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)).
+    @SafeEffect public void propertyChange(PropertyChangeEvent event) {
+                            ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:130: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                || getViewer().getTree().isDisposed()) {
+                                                   ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:130: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                || getViewer().getTree().isDisposed()) {
+                                      ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:130: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                || getViewer().getTree().isDisposed()) {
+                            ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:139: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        setColumns(columnsString);
+                  ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:140: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        configureTree();
+                     ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/AbstractFilteredTree.java:141: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        getViewer().refresh();
+                 ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/editors/CpuDumpEditor.java:139: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe ICpuModelChangeListener.modelChanged(org.jvmmonitor.core.cpu.CpuModelEvent)).
+            @UIEffect public void modelChanged(CpuModelEvent event) {
+                                  ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/overview/OverviewSection.java:287: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+            super(section);
+                 ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/overview/OverviewLabelProvider.java:16: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+public class OverviewLabelProvider extends LabelProvider implements
+       ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/thread/ThreadFilteredTree.java:117: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)).
+    public void propertyChange(PropertyChangeEvent event) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/TimelineChart.java:100: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)).
+    public void propertyChange(PropertyChangeEvent event) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/actions/AbstractClearAction.java:42: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                return doRun(monitor);
+                            ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/NewChartAction.java:120: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+            super(shell, "", null, new ArrayList<MBeanAttribute>(), jvm, true); //$NON-NLS-1$
+                 ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/AttributeSelectionDialog.java:202: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                        .getSelection();
+                                     ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/AttributeSelectionDialog.java:204: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                        .getFirstElement();
+                                        ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/AttributeSelectionDialog.java:206: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    attribute.setRgb(selector.getColorValue());
+                                                           ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/ConfigureChartDialog.java:475: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                        .getSelection();
+                                     ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/ConfigureChartDialog.java:477: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                        .getFirstElement();
+                                        ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/timeline/ConfigureChartDialog.java:479: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    attribute.setRgb(selector.getColorValue());
+                                                           ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/HotSpotsTabPage.java:83: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    refresh();
+                           ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/HotSpotsComparator.java:47: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+    public HotSpotsComparator(ColumnType columnType) {
+                                                     ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/CallTreeTabPage.java:82: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    refresh();
+                           ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/CallerCalleeTabPage.java:95: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe ICpuModelChangeListener.modelChanged(org.jvmmonitor.core.cpu.CpuModelEvent)).
+            @UIEffect public void modelChanged(CpuModelEvent event) {
+                                  ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/CallTreeFilteredTree.java:32: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        super(parent, actionBars);
+             ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/PackageLabelProvider.java:17: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+public class PackageLabelProvider extends LabelProvider {
+       ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/cpu/actions/ConfigureCpuProfilerAction.java:118: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                return doConfigure(monitor, dialog);
+                                  ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/NotificationFilteredTree.java:152: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)).
+    public void propertyChange(PropertyChangeEvent event) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/SubscribeAction.java:76: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                setEnabled(enabled);
+                          ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/SubscribeAction.java:78: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    setChecked(jvm.getMBeanServer().getMBeanNotification()
+                              ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/OperationsContentProvider.java:16: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+public class OperationsContentProvider extends ArrayContentProvider {
+       ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/InvokeDialog.java:467: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    doInvoke();
+                            ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/InvokeDialog.java:469: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    setMessage(NLS.bind(Messages.mBeanOperationFailedLabel,
+                              ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/InvokeDialog.java:473: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    setMessage(NLS.bind(Messages.mBeanOperationFailedLabel,
+                              ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/InvokeDialog.java:477: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    setMessage(NLS.bind(Messages.mBeanOperationFailedLabel,
+                              ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/properties/mbean/InvokeDialog.java:481: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                setMessage(NLS.bind(Messages.mBeanOperationSucceededLabel,
+                          ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/views/DeleteAction.java:75: error: incompatible types.
+        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), this);
+                                                                        ^
+  found   : @UI DeleteAction
+  required: @AlwaysSafe IAction
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/views/RenameAction.java:62: error: incompatible types.
+        actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), this);
+                                                                        ^
+  found   : @UI RenameAction
+  required: @AlwaysSafe IAction
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/views/JvmTreeViewer.java:131: error: An method override may only be @UI if it overrides an @UI method (overriding @AlwaysSafe IJvmModelChangeListener.jvmModelChanged(org.jvmmonitor.core.JvmModelEvent)).
+    public void jvmModelChanged(final JvmModelEvent e) {
+                ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/internal/ui/views/StartMonitoringAction.java:109: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+                    if (!jvm.isConnected() && isEnabled()) {
+                                                       ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:21: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+public class Activator extends AbstractUIPlugin {
+       ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:34: error: Calling a method with UIEffect effect from a context limited to PolyUIEffect effects.
+        super.start(context);
+                   ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:43: error: Calling a method with UIEffect effect from a context limited to PolyUIEffect effects.
+        super.stop(context);
+                  ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:65: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        return imageDescriptorFromPlugin(PLUGIN_ID, path);
+                                        ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:108: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        IDialogSettings settings = getDialogSettings();
+                                                    ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:109: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+        IDialogSettings section = settings.getSection(sectionName);
+                                                     ^
+./org.jvmmonitor.ui/src/org/jvmmonitor/ui/Activator.java:111: error: Calling a method with UIEffect effect from a context limited to SafeEffect effects.
+            section = settings.addNewSection(sectionName);
+                                            ^
+57 errors

jvmmonitor-read-only/org.jvmmonitor.agent/.classpath

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

jvmmonitor-read-only/org.jvmmonitor.agent/.project

+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.jvmmonitor.agent</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

jvmmonitor-read-only/org.jvmmonitor.agent/META-INF/MANIFEST.MF

+Manifest-Version: 1.0
+Premain-Class: org.jvmmonitor.internal.agent.Agent
+Agent-Class: org.jvmmonitor.internal.agent.Agent
+Can-Retransform-Classes: true

jvmmonitor-read-only/org.jvmmonitor.agent/build.jardesc

+<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
+<jardesc>
+    <jar path="org.jvmmonitor.core/lib/jvmmonitor-agent.jar"/>
+    <options buildIfNeeded="true" compress="true" descriptionLocation="/org.jvmmonitor.agent/build.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
+    <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
+    <selectedProjects/>
+    <manifest generateManifest="false" manifestLocation="/org.jvmmonitor.agent/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+        <sealing sealJar="false">
+            <packagesToSeal/>
+            <packagesToUnSeal/>
+        </sealing>
+    </manifest>
+    <selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
+        <javaElement handleIdentifier="=org.jvmmonitor.agent/src"/>
+        <folder path="/org.jvmmonitor.agent/META-INF"/>
+    </selectedElements>
+</jardesc>

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/Agent.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved. 
+ * 
+ * This code is distributed under the terms of the Eclipse Public License v1.0
+ * which is available at http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jvmmonitor.internal.agent;
+
+import java.lang.instrument.Instrumentation;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.List;
+import java.util.jar.JarFile;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * The agent class that is loaded to the target JVM. The manifest file in agent
+ * jar file has attributes <tt>Premain-Class</tt> and <tt>Agent-Class</tt> for
+ * this class.
+ */
+@SuppressWarnings("nls")
+public class Agent {
+
+    /**
+     * The method that is invoked by system before main method is invoked, if
+     * the option <tt>-javaagent</tt> is specified for JVM arguments.
+     * <p>
+     * The typical use case is to profile Java application on remote host where
+     * eclipse is not available.
+     * 
+     * @param agentArgs
+     *            The agent arguments specified at the option
+     *            <tt>-javaagent</tt>. For this agent, nothing will be given
+     * @param inst
+     *            The instrumentation service
+     */
+    public static void premain(String agentArgs, Instrumentation inst) {
+        try {
+            init(getAgentJar(), inst);
+        } catch (Throwable t) {
+            logError(t, Messages.CANNOT_REGISTER_CPU_PROFILER_MXBEAN);
+        }
+    }
+
+    /**
+     * The method that is invoked by system if agent is loaded via
+     * <tt>VirtualMachine.loadAgent(String, String)</tt>.
+     * 
+     * @param options
+     *            The options given by loadAgent(). For this agent, the agent
+     *            jar file path will be given
+     * 
+     * @param inst
+     *            The instrumentation service
+     */
+    public static void agentmain(String options, Instrumentation inst) {
+        try {
+            init(options, inst);
+        } catch (Throwable t) {
+            logError(t, Messages.CANNOT_REGISTER_CPU_PROFILER_MXBEAN);
+        }
+    }
+
+    /**
+     * Logs the info message.
+     * 
+     * @param format
+     *            The format for info message
+     * @param args
+     *            The arguments for the format
+     */
+    protected static void logInfo(String format, Object... args) {
+        Logger.getLogger(Constants.LOGGER_NAME).fine(
+                String.format(format, args));
+    }
+
+    /**
+     * Logs the error message.
+     * 
+     * @param t
+     *            The exception
+     * @param format
+     *            The format for error message
+     * @param args
+     *            The arguments for the format
+     */
+    protected static void logError(Throwable t, String format, Object... args) {
+        Logger.getLogger(Constants.LOGGER_NAME).log(Level.SEVERE,
+                String.format(format, args), t);
+    }
+
+    /**
+     * Initialize the agent.
+     * 
+     * @param agentJar
+     *            The path for agent jar file
+     * @param inst
+     *            The instrumentation service
+     * @throws Throwable
+     */
+    private static void init(String agentJar, Instrumentation inst)
+            throws Throwable {
+        inst.appendToBootstrapClassLoaderSearch(new JarFile(agentJar));
+
+        if (registerMXBeans(inst)) {
+            logInfo(Messages.AGENT_LOADED);
+        } else {
+            logInfo(Messages.AGENT_ALREADY_LOADED);
+        }
+    }
+
+    /**
+     * Gets the agent jar file from input arguments.
+     * 
+     * @return The agent jar file
+     */
+    private static String getAgentJar() {
+        RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
+        List<String> arguments = runtimeMXBean.getInputArguments();
+        for (String argument : arguments) {
+            if (argument.contains(Constants.JAVA_AGENT_OPTION)) {
+                return argument.replace(Constants.JAVA_AGENT_OPTION, "");
+            }
+        }
+        throw new IllegalStateException();
+    }
+
+    /**
+     * Registers the MXBeans.
+     * 
+     * @param inst
+     *            The instrumentation
+     * @return <tt>true</tt> if registered, and <tt>false</tt> if nothing was
+     *         done since MBeans had already been registered.
+     * @throws Throwable
+     */
+    private static boolean registerMXBeans(Instrumentation inst)
+            throws Throwable {
+        boolean agentLoaded = false;
+
+        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        ObjectName profilerObjectName = new ObjectName(
+                CpuBciProfilerMXBean.PROFILER_MXBEAN_NAME);
+        ObjectName dataTransferObjectName = new ObjectName(
+                DataTransferMXBean.DATA_TRANSFER_MXBEAN_NAME);
+        ObjectName swtResourceMonitorObjectName = new ObjectName(
+                SWTResourceMonitorMXBean.SWT_RESOURCE_MONITOR_MXBEAN_NAME);
+
+        if (!server.isRegistered(profilerObjectName)) {
+            CpuBciProfilerMXBeanImpl profiler = new CpuBciProfilerMXBeanImpl(
+                    inst);
+            server.registerMBean(profiler, profilerObjectName);
+            agentLoaded = true;
+        }
+
+        if (!server.isRegistered(dataTransferObjectName)) {
+            DataTransferMXBeanImpl dataTransfer = new DataTransferMXBeanImpl();
+            server.registerMBean(dataTransfer, dataTransferObjectName);
+            agentLoaded = true;
+        }
+
+        if (!server.isRegistered(swtResourceMonitorObjectName)) {
+            SWTResourceMonitorMXBeanImpl swtResourceMonitor = new SWTResourceMonitorMXBeanImpl(
+                    inst);
+            if (swtResourceMonitor.isSuppoted()) {
+                server.registerMBean(swtResourceMonitor,
+                        swtResourceMonitorObjectName);
+            }
+            agentLoaded = true;
+        }
+
+        return agentLoaded;
+    }
+}

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/ClassFileTransformerImpl.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved. 
+ * 
+ * This code is distributed under the terms of the Eclipse Public License v1.0
+ * which is available at http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jvmmonitor.internal.agent;
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.security.ProtectionDomain;
+import java.util.Set;
+
+import org.jvmmonitor.internal.agent.asm.ClassAdapter;
+import org.jvmmonitor.internal.agent.asm.ClassReader;
+import org.jvmmonitor.internal.agent.asm.ClassWriter;
+
+/**
+ * The class file transformer to instrument byte-codes.
+ */
+@SuppressWarnings("nls")
+public class ClassFileTransformerImpl implements ClassFileTransformer {
+
+    /** The target classes to transform. */
+    private Set<Class<?>> targetClasses;
+
+    /** The transformed classes. */
+    private Set<Class<?>> transformedClasses;
+
+    /**
+     * The constructor.
+     * 
+     * @param targetClasses
+     *            The target classes to transform
+     * @param transformedClasses
+     *            The transformed classes
+     */
+    public ClassFileTransformerImpl(Set<Class<?>> targetClasses,
+            Set<Class<?>> transformedClasses) {
+        this.targetClasses = targetClasses;
+        this.transformedClasses = transformedClasses;
+    }
+
+    /*
+     * @see ClassFileTransformer#transform(ClassLoader, String, Class,
+     * ProtectionDomain, byte[])
+     */
+    @Override
+    public byte[] transform(ClassLoader loader, String className,
+            Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
+            byte[] classfileBuffer) throws IllegalClassFormatException {
+
+        if (!isProfiledClassLoader(loader)
+                || !matches(className, Config.getInstance().profiledPackages)
+                || matches(className, Config.getInstance().ignoredPackages)) {
+            return classfileBuffer;
+        }
+
+        /*
+         * Classes could be loaded after collecting targetClasses in
+         * CpuBciProfilerMXBeanImpl.setFilter(String, String)
+         */
+        targetClasses.add(classBeingRedefined);
+        transformedClasses.add(classBeingRedefined);
+        Agent.logInfo(Messages.INSTRUMENTED_CLASS, className);
+
+        ClassReader reader = new ClassReader(classfileBuffer);
+        ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+        ClassAdapter visitor = new ClassVisitorImpl(writer, className);
+        reader.accept(visitor, ClassReader.SKIP_DEBUG);
+
+        return writer.toByteArray();
+    }
+
+    /**
+     * Checks if the given class name matches with one of the packages list.
+     * 
+     * @param className
+     *            The class name (e.g. java/lang/String)
+     * @param packages
+     *            The packages
+     * @return <tt>true</tt> if the given class belongs to one of the packages
+     */
+    private static boolean matches(String className, Set<String> packages) {
+        if (packages.isEmpty()) {
+            return false;
+        }
+
+        String packageName;
+        if (className.contains("/")) {
+            packageName = className.substring(0, className.lastIndexOf('/'))
+                    .replace('/', '.');
+        } else if (className.startsWith("$")) {
+            return false; // e.g. $Proxy0
+        } else {
+            packageName = Constants.DEFAULT_PACKAGE;
+        }
+
+        for (String pkg : packages) {
+            if (pkg.endsWith("*")) {
+                if (packageName.concat(".").startsWith(
+                        pkg.substring(0, pkg.length() - 1))) {
+                    return true;
+                }
+            } else {
+                if (packageName.equals(pkg)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Gets the state indicating if the classes loaded by given class loader are
+     * profiled.
+     * 
+     * @param loader
+     *            The class loader
+     * @return <tt>true</tt> if the classes loaded by given class loader are
+     *         profiled
+     */
+    private static boolean isProfiledClassLoader(ClassLoader loader) {
+        if (Config.getInstance().profiledClassLoaders.isEmpty()) {
+            return true;
+        }
+
+        for (String classLoader : Config.getInstance().profiledClassLoaders) {
+            if (loader != null
+                    && loader.getClass().getName().equals(classLoader)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/ClassVisitorImpl.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved. 
+ * 
+ * This code is distributed under the terms of the Eclipse Public License v1.0
+ * which is available at http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jvmmonitor.internal.agent;
+
+import org.jvmmonitor.internal.agent.asm.ClassAdapter;
+import org.jvmmonitor.internal.agent.asm.ClassWriter;
+import org.jvmmonitor.internal.agent.asm.MethodVisitor;
+
+/**
+ * The class visitor.
+ */
+@SuppressWarnings("nls")
+public class ClassVisitorImpl extends ClassAdapter {
+
+    /** the class name */
+    private String className;
+
+    /**
+     * The constructor.
+     * 
+     * @param writer
+     *            the class visitor
+     * @param className
+     *            the class name
+     */
+    protected ClassVisitorImpl(ClassWriter writer, String className) {
+        super(writer);
+        this.className = className;
+    }
+
+    /*
+     * @see ClassAdapter#visitMethod(int, String, String, String, String[])
+     */
+    @Override
+    public MethodVisitor visitMethod(int access, String name, String desc,
+            String signature, String[] exceptions) {
+
+        MethodVisitor methodVisitor = super.visitMethod(access, name, desc,
+                signature, exceptions);
+
+        // attach the parameter descriptor (e.g. (JI)V) to method name
+        String qualifiedName = name + ((desc != null) ? desc : "");
+
+        return new MethodVisitorImpl(methodVisitor, className, qualifiedName);
+    }
+}

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/Config.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved. 
+ * 
+ * This code is distributed under the terms of the Eclipse protected License v1.0
+ * which is available at http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jvmmonitor.internal.agent;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * The profile configuration.
+ */
+@SuppressWarnings("nls")
+public class Config {
+
+    /** The separator. */
+    private final static String SEPARATOR = ",";
+
+    /** The flag for enabling profiler. */
+    private boolean profilerEnabled;
+
+    /** The flag for enabling automatic dump. */
+    private boolean autoDumpEnabled;
+
+    /** The output directory for dump file. */
+    private String dumpDir;
+
+    /** The list of ignored java packages. */
+    protected Set<String> ignoredPackages;
+
+    /** The list of profiled java packages. */
+    protected Set<String> profiledPackages;
+
+    /** The list of profiled class loaders. */
+    protected Set<String> profiledClassLoaders;
+
+    /** The shared instance of this class. */
+    private static Config config;
+
+    /**
+     * The constructor.
+     */
+    private Config() {
+        ignoredPackages = new LinkedHashSet<String>();
+        profiledPackages = new LinkedHashSet<String>();
+        profiledClassLoaders = new LinkedHashSet<String>();
+        load();
+    }
+
+    /**
+     * Gets the shared instance of this class.
+     * 
+     * @return The shared instance of this class
+     */
+    synchronized protected static Config getInstance() {
+        if (config == null) {
+            config = new Config();
+        }
+        return config;
+    }
+
+    /**
+     * Adds the elements into list.
+     * 
+     * @param list
+     *            The list to add elements
+     * @param string
+     *            The string of elements separated with comma
+     */
+    protected void addElements(Set<String> list, String string) {
+        if (string == null) {
+            return;
+        }
+
+        String[] elements = string.split(SEPARATOR);
+        if (elements != null && elements.length > 0) {
+            for (String element : elements) {
+                list.add(element.trim());
+            }
+        }
+    }
+
+    /**
+     * Gets the profiler enabled state.
+     * 
+     * @return <tt>true</tt> if profiler is enabled
+     */
+    protected boolean isProfilerEnabled() {
+        return profilerEnabled;
+    }
+
+    /**
+     * Sets the profiler enabled state.
+     * 
+     * @param enabled
+     *            <tt>true</tt> to enable profiler
+     */
+    protected void setProfilerEnabled(boolean enabled) {
+        this.profilerEnabled = enabled;
+    }
+
+    /**
+     * Gets the auto dump state.
+     * 
+     * @return true if auto dump is enabled
+     */
+    protected boolean isAutoDumpEnabled() {
+        return autoDumpEnabled;
+    }
+
+    /**
+     * Sets the auto dump state.
+     * 
+     * @param enabled
+     *            true to enable auto dump
+     */
+    protected void setAutoDumpEnabled(boolean enabled) {
+        this.autoDumpEnabled = enabled;
+    }
+
+    /**
+     * Gets the directory for dump file.
+     * 
+     * @return The dump directory
+     */
+    protected String getDumpDir() {
+        return dumpDir;
+    }
+
+    /**
+     * Sets the directory for dump file.
+     * 
+     * @param dir
+     *            The dump directory
+     */
+    protected void setDumpDir(String dir) {
+        dumpDir = dir;
+    }
+
+    /**
+     * Loads the configuration.
+     */
+    private void load() {
+        String fileName = System.getProperty(Constants.CONFIG_FILE_PROP_KEY);
+        if (fileName != null) {
+            setProperties(fileName);
+        }
+
+        profilerEnabled = System
+                .getProperty(Constants.DEFERRED_PROP_KEY,
+                        Boolean.TRUE.toString()).toLowerCase().trim()
+                .equals(Boolean.FALSE.toString());
+        autoDumpEnabled = System
+                .getProperty(Constants.DUMP_PROP_KEY, Boolean.FALSE.toString())
+                .toLowerCase().trim().equals(Boolean.TRUE.toString());
+
+        String outputDirStr = System.getProperty(Constants.DUMP_DIR_PROP_KEY,
+                getDefaultDir());
+        String ignoredPackagesStr = System
+                .getProperty(Constants.IGNORED_PACKAGES_PROP_KEY);
+        String profiledPackagesStr = System
+                .getProperty(Constants.PROFILED_PACKAGES_PROP_KEY);
+        String profiledClassLoadersStr = System
+                .getProperty(Constants.PROFILED_CLASSLOADER_PROP_KEY);
+
+        dumpDir = outputDirStr.trim();
+        if (!dumpDir.endsWith(File.separator)) {
+            dumpDir = dumpDir.concat(File.separator);
+        }
+        ignoredPackages.add("org.jvmmonitor.internal.agent.*");
+        if (ignoredPackagesStr != null) {
+            ignoredPackages.clear();
+            addElements(ignoredPackages, ignoredPackagesStr);
+        }
+        if (profiledPackagesStr != null) {
+            profiledPackages.clear();
+            addElements(profiledPackages, profiledPackagesStr);
+        }
+        if (profiledClassLoadersStr != null) {
+            profiledClassLoaders.clear();
+            addElements(profiledClassLoaders, profiledClassLoadersStr);
+        }
+    }
+
+    /**
+     * Gets the default directory for dump file.
+     * 
+     * @return The directory
+     */
+    private static String getDefaultDir() {
+        String dir = System.getProperty(Constants.USER_HOME_PROP_KEY);
+        if (dir != null) {
+            return dir;
+        }
+
+        dir = System.getProperty(Constants.USER_DIR_PROP_KEY);
+        if (dir != null) {
+            return dir;
+        }
+
+        return new File(".").getAbsolutePath();
+    }
+
+    /**
+     * Sets the properties with file.
+     * 
+     * @param fileName
+     *            name The properties with name
+     */
+    private static void setProperties(String fileName) {
+        if (fileName == null) {
+            return;
+        }
+
+        FileInputStream inputStream = null;
+        try {
+            inputStream = new FileInputStream(fileName);
+            Properties properties = new Properties();
+            properties.load(inputStream);
+            for (Entry<Object, Object> set : properties.entrySet()) {
+                System.setProperty((String) set.getKey(),
+                        (String) set.getValue());
+            }
+        } catch (FileNotFoundException e) {
+            Agent.logError(e, Messages.CANNOT_OPEN_CONFIG_FILE, fileName);
+        } catch (IOException e) {
+            Agent.logError(e, Messages.CANNOT_OPEN_CONFIG_FILE, fileName);
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                    // do nothing
+                }
+            }
+        }
+    }
+}

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/Constants.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved. 
+ * 
+ * This code is distributed under the terms of the Eclipse Public License v1.0
+ * which is available at http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jvmmonitor.internal.agent;
+
+/**
+ * The constants.
+ */
+@SuppressWarnings("nls")
+public class Constants {
+
+    /** The version. */
+    static final String VERSION = "3.8.0";
+
+    /** The logger name. */
+    static final String LOGGER_NAME = "org.jvmmonitor.agent";
+
+    /** The default package. */
+    static final String DEFAULT_PACKAGE = "<default>";
+
+    /** The key for CPU profiling properties file. */
+    static final String CONFIG_FILE_PROP_KEY = "jvmmonitor.config";
+
+    /** The key for agent jar. */
+    static final String AGENT_JAR_PROP_KEY = "jvmmonitor.agent.jar";
+
+    /** The key for deferred. */
+    static final String DEFERRED_PROP_KEY = "jvmmonitor.deferred";
+
+    /** The key for automatic dump file output.. */
+    static final String DUMP_PROP_KEY = "jvmmonitor.dump";
+
+    /** The key for dump file output directory. */
+    static final String DUMP_DIR_PROP_KEY = "jvmmonitor.dump.dir";
+
+    /** The key for ignored java packages. */
+    static final String IGNORED_PACKAGES_PROP_KEY = "jvmmonitor.ignored.packages";
+
+    /** The key for profiled java packages. */
+    static final String PROFILED_PACKAGES_PROP_KEY = "jvmmonitor.profiled.packages";
+
+    /** The key for profiled class loaders. */
+    static final String PROFILED_CLASSLOADER_PROP_KEY = "jvmmonitor.profiled.classloaders";
+
+    /** The key for user home directory. */
+    static final String USER_HOME_PROP_KEY = "user.home";
+
+    /** The key for current directory. */
+    static final String USER_DIR_PROP_KEY = "user.dir";
+
+    /** The CPU profiler class. */
+    static final String CLASS_CPU_PROFILER = "org/jvmmonitor/internal/agent/CpuBciProfiler";
+
+    /** The method CpuProfiler#stepInto. */
+    static final String METHOD_STEP_INTO = "stepInto";
+
+    /** The method CpuProfiler#stepReturn. */
+    static final String METHOD_STEP_RETURN = "stepReturn";
+
+    /** The method CpuProfiler#dropToFrame. */
+    static final String METHOD_DROP_TO_FRAME = "dropToFrame";
+
+    /** The method name representing the class initialization method. */
+    static final String METHOD_CLINIT = "<clinit>";
+
+    /** The descriptor for two strings. */
+    static final String DESC_STRING_STRING = "(Ljava/lang/String;Ljava/lang/String;)V";
+
+    /** The descriptor for three strings. */
+    static final String DESC_STRING_STRING_STRING = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V";
+
+    /** The -javaagent option for JVM. */
+    static final String JAVA_AGENT_OPTION = "-javaagent:";
+
+    /** The main thread. */
+    static final String MAIN_THREAD = "main";
+
+    /** The date format for dump file name. */
+    static final String TIME_FORMAT_FOR_FILENAME = "HHmmss";
+
+    /** The dump file suffix. */
+    static final String DUMP_FILE_SUFFIX = ".cpu";
+
+    /** The dump file prefix. */
+    public static final String DUMP_FILE_PREFIX = "jvmmonitor_";
+
+    /** The date format. */
+    public static final String DATE_FORMAT = "yyyy/MM/dd";
+
+    /** The time format. */
+    public static final String TIME_FORMAT = "HH:mm:ss";
+}

jvmmonitor-read-only/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/CpuBciProfiler.java

+/*******************************************************************************
+ * Copyright (c) 2010 JVM Monitor project. All rights reserved.