[jboss-cvs] JBoss Profiler SVN: r561 - in branches/JBossProfiler2: .settings and 19 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 17 22:08:44 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-08-17 22:08:43 -0400 (Mon, 17 Aug 2009)
New Revision: 561

Modified:
   branches/JBossProfiler2/.classpath
   branches/JBossProfiler2/.settings/org.eclipse.jdt.core.prefs
   branches/JBossProfiler2/.settings/org.eclipse.jdt.ui.prefs
   branches/JBossProfiler2/doc/developerguide/en/modules/coding.xml
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassRepository.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ExceptionInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/NopProfilerThreadImpl.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/SizeComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Transformer.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/Job.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/JobHelper.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StartProfiling.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StopProfiling.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AddClassesTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/ClearSnapshotsTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/GCTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RegressionTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RemoveClassesTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/SaveTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/as/Communicator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/as/CommunicatorMBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/as/Profiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/as/ProfilerMBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/DifferenceUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/HTMLUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/ThreadHolder.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/Util.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ArchiveUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassInstrumenter.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassScanner.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ExtensionScanner.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/FileUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/JarScanner.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/Precompiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/SizeComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/HttpHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/LocalHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RemoteHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RmiHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/SocketHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/embedded/Profiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/InventoryDataPoint.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTICallBack.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTIInterface.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTITypes.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/ReferenceDataPoint.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/AbstractHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/InstancesHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/MemoryProfilerEmbedded.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/ReferenceHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/RootHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/StopHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Hibernate.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Seam.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassType.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Command.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameHelper.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Math.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Plugin.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/PluginHelper.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Snapshot.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/SnapshotHelper.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadComparator.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadHelper.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfo.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfoProxy.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Version.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Visibility.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Complex.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity3.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMX.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMXMBean.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/ManagedBean.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message3.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session3.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Simple.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/TestServlet.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/JVMTIWebTestManual.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/StressReportTest.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/TestClass.java
   branches/JBossProfiler2/tools/checkstyle/checkstyle.xml
Log:
Style/formatting changes only

Modified: branches/JBossProfiler2/.classpath
===================================================================
--- branches/JBossProfiler2/.classpath	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/.classpath	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,5 +22,6 @@
 	<classpathentry kind="lib" path="lib/servlet.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
 	<classpathentry kind="var" path="ANT_HOME"/>
+	<classpathentry kind="lib" path="lib/junit-4.4.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: branches/JBossProfiler2/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/JBossProfiler2/.settings/org.eclipse.jdt.core.prefs	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/.settings/org.eclipse.jdt.core.prefs	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,4 +1,4 @@
-#Sat Sep 27 08:56:30 BST 2008
+#Mon Aug 17 17:28:16 CDT 2009
 eclipse.preferences.version=1
 org.eclipse.jdt.core.codeComplete.argumentPrefixes=
 org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -8,6 +8,8 @@
 org.eclipse.jdt.core.codeComplete.localSuffixes=
 org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
 org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=optimize out
@@ -23,22 +25,22 @@
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=82
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=82
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=82
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=82
-org.eclipse.jdt.core.formatter.alignment_for_assignment=82
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=82
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_assignment=32
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=17
 org.eclipse.jdt.core.formatter.alignment_for_compact_if=82
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=33
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=82
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=82
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=82
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=82
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=82
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=82
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=82
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=82
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=20
 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
 org.eclipse.jdt.core.formatter.blank_lines_before_field=1
@@ -75,8 +77,8 @@
 org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
 org.eclipse.jdt.core.formatter.comment.line_length=120
 org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=3
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=3
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
@@ -90,6 +92,9 @@
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
 org.eclipse.jdt.core.formatter.indentation.size=3
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
@@ -141,7 +146,7 @@
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
@@ -170,7 +175,7 @@
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
@@ -258,6 +263,8 @@
 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
 org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
 org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true
 org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false

Modified: branches/JBossProfiler2/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- branches/JBossProfiler2/.settings/org.eclipse.jdt.ui.prefs	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/.settings/org.eclipse.jdt.ui.prefs	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,4 +1,4 @@
-#Wed Feb 25 14:56:24 CET 2009
+#Mon Aug 17 17:37:04 CDT 2009
 cleanup.add_default_serial_version_id=false
 cleanup.add_generated_serial_version_id=true
 cleanup.add_missing_annotations=true
@@ -49,12 +49,12 @@
 cleanup_settings_version=2
 eclipse.preferences.version=1
 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
-formatter_profile=_JBM
+formatter_profile=_JBossProfiler
 formatter_settings_version=11
 org.eclipse.jdt.ui.exception.name=e
 org.eclipse.jdt.ui.gettersetter.use.is=true
 org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;com;org;
+org.eclipse.jdt.ui.importorder=org.jboss.profiler;java;javax;org.jboss;org;javassist;
 org.eclipse.jdt.ui.javadoc=true
 org.eclipse.jdt.ui.keywordthis=false
 org.eclipse.jdt.ui.ondemandthreshold=9999

Modified: branches/JBossProfiler2/doc/developerguide/en/modules/coding.xml
===================================================================
--- branches/JBossProfiler2/doc/developerguide/en/modules/coding.xml	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/doc/developerguide/en/modules/coding.xml	2009-08-18 02:08:43 UTC (rev 561)
@@ -5,7 +5,7 @@
   <section id="sourcecodestyle">
     <title>Source code formatting</title>
     
-    <para>JBoss Tattletale uses 2 spaces for indentation with curly brakets on the same line
+    <para>JBoss Profiler uses 3 spaces for indentation with curly brakets on the next line
       as the class or the statement.</para>
 
     <programlisting>

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,131 +31,164 @@
  * An abstract transformer
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public abstract class AbstractTransformer implements Transformer {
+public abstract class AbstractTransformer implements Transformer
+{
 
-  /**
-   * The transform method
-   * @param loader The class loader
-   * @param className The class name
-   * @param classBeingRedefined The class being redefined
-   * @param protectionDomain The protection domain
-   * @param classfileBuffer The class buffer
-   * @return The transformed class; null if no transformation have been done
-   * @exception IllegalClassFormatException If the class can't be transformed
-   */
-  public byte[] transform(ClassLoader loader, 
-                          String className, 
-                          Class<?> classBeingRedefined, 
-                          ProtectionDomain protectionDomain, 
-                          byte[] classfileBuffer) throws IllegalClassFormatException {
+   /**
+    * The transform method
+    * @param loader The class loader
+    * @param className The class name
+    * @param classBeingRedefined The class being redefined
+    * @param protectionDomain The protection domain
+    * @param classfileBuffer The class buffer
+    * @return The transformed class; null if no transformation have been done
+    * @exception IllegalClassFormatException If the class can't be transformed
+    */
+   public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
+         ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException
+   {
 
-    byte[] result = null;
-    
-    if (Agent.isEnabled() && Agent.accept(className)) {
-      try {
-        if (Agent.isRepository() && !ClassRepository.exists(className, loader)) {
-          ClassRepository.save(className, loader, classfileBuffer);
-        }
+      byte[] result = null;
 
-        byte[] buffer = null;
-        if (classBeingRedefined != null) {
-          buffer = loadNonInstrumented(className, loader);
-        }
-        if (buffer == null) {
-          buffer = classfileBuffer;
-        }
- 
-        result = generateInstrumented(className, buffer);
+      if (Agent.isEnabled() &&
+            Agent.accept(className))
+      {
+         try
+         {
+            if (Agent.isRepository() &&
+                  !ClassRepository.exists(className, loader))
+            {
+               ClassRepository.save(className, loader, classfileBuffer);
+            }
 
-      } catch (Throwable t) {
-        IllegalClassFormatException ice = new IllegalClassFormatException(t.getMessage());
-        ice.initCause(t);
-        throw ice;
+            byte[] buffer = null;
+            if (classBeingRedefined != null)
+            {
+               buffer = loadNonInstrumented(className, loader);
+            }
+            if (buffer == null)
+            {
+               buffer = classfileBuffer;
+            }
+
+            result = generateInstrumented(className, buffer);
+
+         }
+         catch (Throwable t)
+         {
+            IllegalClassFormatException ice = new IllegalClassFormatException(t.getMessage());
+            ice.initCause(t);
+            throw ice;
+         }
       }
-    } else if (classBeingRedefined != null) {
-      try {
-        result = loadNonInstrumented(className, loader);
-      } catch (Throwable t) {
-        IllegalClassFormatException ice = new IllegalClassFormatException(t.getMessage());
-        ice.initCause(t);
-        throw ice;
+      else if (classBeingRedefined != null)
+      {
+         try
+         {
+            result = loadNonInstrumented(className, loader);
+         }
+         catch (Throwable t)
+         {
+            IllegalClassFormatException ice = new IllegalClassFormatException(t.getMessage());
+            ice.initCause(t);
+            throw ice;
+         }
       }
-    }
-    if (Agent.isRepository() && 
-        className.indexOf("$Proxy") != -1 &&
-        !ClassRepository.exists(className, loader)) {
-      try {
-        // Create backup of all proxy classes regardless of policy
-        ClassRepository.save(className, loader, classfileBuffer);
-      } catch (Throwable t) {
-        //
+      if (Agent.isRepository() &&
+            className.indexOf("$Proxy") != -1 && !ClassRepository.exists(className, loader))
+      {
+         try
+         {
+            // Create backup of all proxy classes regardless of policy
+            ClassRepository.save(className, loader, classfileBuffer);
+         }
+         catch (Throwable t)
+         {
+            //
+         }
       }
-    }
 
-    return result;
-  }
+      return result;
+   }
 
-  /**
-   * Load non instrumented class
-   * @param className The class name
-   * @param loader The class loader
-   * @return The bytes
-   * @exception IOException If an error occurs
-   */
-  public byte[] loadNonInstrumented(String className, ClassLoader loader) throws IOException {
-    byte[] clz = null;
-    className = className.replace(".", "/");
+   /**
+    * Load non instrumented class
+    * @param className The class name
+    * @param loader The class loader
+    * @return The bytes
+    * @exception IOException If an error occurs
+    */
+   public byte[] loadNonInstrumented(String className, ClassLoader loader) throws IOException
+   {
+      byte[] clz = null;
+      className = className.replace(".", "/");
 
-    if (Agent.isRepository() && ClassRepository.exists(className, loader)) {
-      clz = ClassRepository.load(className, loader);
-    } else if (loader != null) {
-      InputStream is = null;
-      try {
-        is = loader.getResourceAsStream(className + ".class");
+      if (Agent.isRepository() &&
+            ClassRepository.exists(className, loader))
+      {
+         clz = ClassRepository.load(className, loader);
+      }
+      else if (loader != null)
+      {
+         InputStream is = null;
+         try
+         {
+            is = loader.getResourceAsStream(className +
+                  ".class");
 
-        if (is != null) {
-          BufferedInputStream bis = new BufferedInputStream(is);
-          clz = new byte[bis.available()];
-          int n = bis.read(clz);
-        }
+            if (is != null)
+            {
+               BufferedInputStream bis = new BufferedInputStream(is);
+               clz = new byte[bis.available()];
+               int n = bis.read(clz);
+            }
 
-      } finally {
-        if (is != null) {
-          try {
-            is.close();
-          } catch (IOException ioe) {
-            //
-          }
-        }
-      }
+         }
+         finally
+         {
+            if (is != null)
+            {
+               try
+               {
+                  is.close();
+               }
+               catch (IOException ioe)
+               {
+                  //
+               }
+            }
+         }
 
-      if (Agent.isRepository() && !ClassRepository.exists(className, loader) && clz != null) {
-        ClassRepository.save(className, loader, clz);
+         if (Agent.isRepository() &&
+               !ClassRepository.exists(className, loader) && clz != null)
+         {
+            ClassRepository.save(className, loader, clz);
+         }
       }
-    }
 
-    return clz;
-  }
+      return clz;
+   }
 
-  /**
-   * Load instrumented class
-   * @param className The class name
-   * @param loader The class loader
-   * @return The bytes
-   * @exception IOException If an error occurs
-   */
-  public byte[] loadInstrumented(String className, ClassLoader loader) throws IOException {
-    byte[] clz = loadNonInstrumented(className, loader);
+   /**
+    * Load instrumented class
+    * @param className The class name
+    * @param loader The class loader
+    * @return The bytes
+    * @exception IOException If an error occurs
+    */
+   public byte[] loadInstrumented(String className, ClassLoader loader) throws IOException
+   {
+      byte[] clz = loadNonInstrumented(className, loader);
 
-    return generateInstrumented(className, clz);
-  }
+      return generateInstrumented(className, clz);
+   }
 
-  /**
-   * Generate instrumented class
-   * @param className The class name
-   * @param ob The original bytes
-   * @return The instrumented bytes
-   * @exception IOException If an error occurs
-   */
-  protected abstract byte[] generateInstrumented(String className, byte[] ob) throws IOException;
+   /**
+    * Generate instrumented class
+    * @param className The class name
+    * @param ob The original bytes
+    * @return The instrumented bytes
+    * @exception IOException If an error occurs
+    */
+   protected abstract byte[] generateInstrumented(String className, byte[] ob) throws IOException;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -52,951 +52,1144 @@
  * The agent class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Agent {
+public class Agent
+{
 
-  /** Transformer */
-  private static Transformer transformer;
+   /** Transformer */
+   private static Transformer transformer;
 
-  /** Instrumentation */
-  private static Instrumentation instrumentation;
+   /** Instrumentation */
+   private static Instrumentation instrumentation;
 
-  /** Enabled */
-  private static boolean enabled = true;
+   /** Enabled */
+   private static boolean enabled = true;
 
-  /** Precompiled */
-  private static boolean precompiled = false;
+   /** Precompiled */
+   private static boolean precompiled = false;
 
-  /** CPU */
-  private static boolean cpu = true;
+   /** CPU */
+   private static boolean cpu = true;
 
-  /** Memory */
-  private static boolean memory = true;
+   /** Memory */
+   private static boolean memory = true;
 
-  /** Quite */
-  private static boolean quite = false;
+   /** Quite */
+   private static boolean quite = false;
 
-  /** Include all */
-  private static boolean includeAll = false;
+   /** Include all */
+   private static boolean includeAll = false;
 
-  /** The include list */
-  private static List<String> includeList = new ArrayList<String>();
+   /** The include list */
+   private static List<String> includeList = new ArrayList<String>();
 
-  /** Exclude all */
-  private static boolean excludeAll = true;
+   /** Exclude all */
+   private static boolean excludeAll = true;
 
-  /** The exclude list */
-  private static List<String> excludeList = new ArrayList<String>();
+   /** The exclude list */
+   private static List<String> excludeList = new ArrayList<String>();
 
-  /** Repository */
-  private static boolean repository = false;
+   /** Repository */
+   private static boolean repository = false;
 
-  /** Store */
-  private static boolean store = true;
+   /** Store */
+   private static boolean store = true;
 
-  /** Store location */
-  private static String storeLocation;
+   /** Store location */
+   private static String storeLocation;
 
-  /** Remote */
-  private static boolean remote = true;
+   /** Remote */
+   private static boolean remote = true;
 
-  /** Host */
-  private static String host;
+   /** Host */
+   private static String host;
 
-  /** Port */
-  private static int port;
+   /** Port */
+   private static int port;
 
-  /** Connector */
-  private static Object connector = null;
+   /** Connector */
+   private static Object connector = null;
 
-  /** Global visibility */
-  private static Visibility visibility;
+   /** Global visibility */
+   private static Visibility visibility;
 
-  /** Visibility tree */
-  private static TreeMap visibilityTree;
+   /** Visibility tree */
+   private static TreeMap visibilityTree;
 
-  /** Save */
-  private static boolean save = true;
+   /** Save */
+   private static boolean save = true;
 
-  /** Save location */
-  private static String saveLocation;
+   /** Save location */
+   private static String saveLocation;
 
-  /** Startup */
-  private static boolean startup = true;
+   /** Startup */
+   private static boolean startup = true;
 
-  /** EJB */
-  private static boolean ejb = true;
+   /** EJB */
+   private static boolean ejb = true;
 
-  /** Servlet */
-  private static boolean servlet = true;
+   /** Servlet */
+   private static boolean servlet = true;
 
-  /** JSF */
-  private static boolean jsf = true;
+   /** JSF */
+   private static boolean jsf = true;
 
-  /** JMX */
-  private static boolean jmx = true;
+   /** JMX */
+   private static boolean jmx = true;
 
-  /** RMI */
-  private static boolean rmi = true;
+   /** RMI */
+   private static boolean rmi = true;
 
-  /** CORBA */
-  private static boolean corba = true;
+   /** CORBA */
+   private static boolean corba = true;
 
-  /** Timer */
-  private static Timer timer;
+   /** Timer */
+   private static Timer timer;
 
-  /**
-   * Parse configuration
-   */
-  private static void parseConfiguration() {
-    Properties properties = new Properties();
-    String propertiesFile = System.getProperty("jboss-profiler.properties");
-    boolean loaded = false;
-    
-    if (propertiesFile != null) {
-      FileInputStream fis = null;
-      try {
-        fis = new FileInputStream(propertiesFile);
-        properties.load(fis);
-        loaded = true;
-      } catch (IOException e) {
-        System.err.println("Unable to open " + propertiesFile);
-      } finally {
-        if (fis != null) {
-          try {
-            fis.close();
-          } catch (IOException ioe) {
-            // Nothing to do
-          }
-        }
+   /**
+    * Parse configuration
+    */
+   private static void parseConfiguration()
+   {
+      Properties properties = new Properties();
+      String propertiesFile = System.getProperty("jboss-profiler.properties");
+      boolean loaded = false;
+
+      if (propertiesFile != null)
+      {
+         FileInputStream fis = null;
+         try
+         {
+            fis = new FileInputStream(propertiesFile);
+            properties.load(fis);
+            loaded = true;
+         }
+         catch (IOException e)
+         {
+            System.err.println("Unable to open " +
+                  propertiesFile);
+         }
+         finally
+         {
+            if (fis != null)
+            {
+               try
+               {
+                  fis.close();
+               }
+               catch (IOException ioe)
+               {
+                  // Nothing to do
+               }
+            }
+         }
       }
-    }
-    if (!loaded) {
-      InputStream is = null;
-      try {
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        is = cl.getResourceAsStream("jboss-profiler.properties");
-        properties.load(is);
-        loaded = true;
-      } catch (Exception ie) {
-        // Properties file not found
-      } finally {
-        if (is != null) {
-          try {
-            is.close();
-          } catch (IOException ioe) {
-            // Nothing to do
-          }
-        }
+      if (!loaded)
+      {
+         InputStream is = null;
+         try
+         {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            is = cl.getResourceAsStream("jboss-profiler.properties");
+            properties.load(is);
+            loaded = true;
+         }
+         catch (Exception ie)
+         {
+            // Properties file not found
+         }
+         finally
+         {
+            if (is != null)
+            {
+               try
+               {
+                  is.close();
+               }
+               catch (IOException ioe)
+               {
+                  // Nothing to do
+               }
+            }
+         }
       }
-    }
 
-    String vs = properties.getProperty("visibility", "private");
-    visibility = parseVisibility(vs);
-    visibilityTree = new TreeMap(new SizeComparator());
+      String vs = properties.getProperty("visibility", "private");
+      visibility = parseVisibility(vs);
+      visibilityTree = new TreeMap(new SizeComparator());
 
-    ejb = parseBoolean(properties.getProperty("ejb"), true);
-    servlet = parseBoolean(properties.getProperty("servlet"), true);
-    jsf = parseBoolean(properties.getProperty("jsf"), true);
-    jmx = parseBoolean(properties.getProperty("jmx"), true);
-    rmi = parseBoolean(properties.getProperty("rmi"), true);
-    corba = parseBoolean(properties.getProperty("corba"), true);
+      ejb = parseBoolean(properties.getProperty("ejb"), true);
+      servlet = parseBoolean(properties.getProperty("servlet"), true);
+      jsf = parseBoolean(properties.getProperty("jsf"), true);
+      jmx = parseBoolean(properties.getProperty("jmx"), true);
+      rmi = parseBoolean(properties.getProperty("rmi"), true);
+      corba = parseBoolean(properties.getProperty("corba"), true);
 
-    repository = parseBoolean(properties.getProperty("repository"), false);
+      repository = parseBoolean(properties.getProperty("repository"), false);
 
-    parse(properties.getProperty("includes"), properties.getProperty("excludes"));
+      parse(properties.getProperty("includes"), properties.getProperty("excludes"));
 
-    enabled = parseBoolean(properties.getProperty("enable"), true);
-    precompiled = parseBoolean(properties.getProperty("precompiled"), false);
-    cpu = parseBoolean(properties.getProperty("cpu"), true);
-    memory = parseBoolean(properties.getProperty("memory"), true);
-    remote = parseBoolean(properties.getProperty("remote"), true);
-    host = properties.getProperty("host", "localhost");
-    port = Integer.parseInt(properties.getProperty("port", "5400"));
+      enabled = parseBoolean(properties.getProperty("enable"), true);
+      precompiled = parseBoolean(properties.getProperty("precompiled"), false);
+      cpu = parseBoolean(properties.getProperty("cpu"), true);
+      memory = parseBoolean(properties.getProperty("memory"), true);
+      remote = parseBoolean(properties.getProperty("remote"), true);
+      host = properties.getProperty("host", "localhost");
+      port = Integer.parseInt(properties.getProperty("port", "5400"));
 
-    save = parseBoolean(properties.getProperty("save"), true);
-    saveLocation = properties.getProperty("savelocation", ".");
-    if (!saveLocation.endsWith(File.separator)) {
-      saveLocation += File.separator;
-    }
-    startup = parseBoolean(properties.getProperty("startup"), true);
+      save = parseBoolean(properties.getProperty("save"), true);
+      saveLocation = properties.getProperty("savelocation", ".");
+      if (!saveLocation.endsWith(File.separator))
+      {
+         saveLocation += File.separator;
+      }
+      startup = parseBoolean(properties.getProperty("startup"), true);
 
-    store = parseStore(properties.getProperty("store"), true);
-    storeLocation = properties.getProperty("location", System.getProperty("java.io.tmpdir"));
-    if (!storeLocation.endsWith(File.separator)) {
-      storeLocation += File.separator;
-    }
+      store = parseStore(properties.getProperty("store"), true);
+      storeLocation = properties.getProperty("location", System.getProperty("java.io.tmpdir"));
+      if (!storeLocation.endsWith(File.separator))
+      {
+         storeLocation += File.separator;
+      }
 
-    loadPlugins(properties);
-    loadJobs(properties);
-  }
+      loadPlugins(properties);
+      loadJobs(properties);
+   }
 
-  /**
-   * Parse boolean property
-   * @param p The property
-   * @param def The default value
-   * @return True or false
-   */
-  private static boolean parseBoolean(String p, boolean def) {
-    if (p != null) {
-      p = p.trim();
+   /**
+    * Parse boolean property
+    * @param p The property
+    * @param def The default value
+    * @return True or false
+    */
+   private static boolean parseBoolean(String p, boolean def)
+   {
+      if (p != null)
+      {
+         p = p.trim();
 
-      return ("ON".equalsIgnoreCase(p) || "YES".equalsIgnoreCase(p) || "TRUE".equalsIgnoreCase(p));
-    }
+         return ("ON".equalsIgnoreCase(p) ||
+               "YES".equalsIgnoreCase(p) || "TRUE".equalsIgnoreCase(p));
+      }
 
-    return def;
-  }
+      return def;
+   }
 
-  /**
-   * Parse visibility property
-   * @param vs The property
-   * @return The visibility
-   */
-  private static Visibility parseVisibility(String vs) {
-    if (vs != null) {
-      if ("public".equalsIgnoreCase(vs)) {
-        return Visibility.PUBLIC;
-      } else if ("package".equalsIgnoreCase(vs)) {
-        return Visibility.PACKAGE;
-      } else if ("protected".equalsIgnoreCase(vs)) {
-        return Visibility.PROTECTED;
+   /**
+    * Parse visibility property
+    * @param vs The property
+    * @return The visibility
+    */
+   private static Visibility parseVisibility(String vs)
+   {
+      if (vs != null)
+      {
+         if ("public".equalsIgnoreCase(vs))
+         {
+            return Visibility.PUBLIC;
+         }
+         else if ("package".equalsIgnoreCase(vs))
+         {
+            return Visibility.PACKAGE;
+         }
+         else if ("protected".equalsIgnoreCase(vs))
+         {
+            return Visibility.PROTECTED;
+         }
       }
-    }
-    return Visibility.PRIVATE;
-  }
+      return Visibility.PRIVATE;
+   }
 
-  /**
-   * Parse include / exclude lists
-   * @param include The include input
-   * @param exclude The exclude input
-   */
-  private static void parse(String include, String exclude) {
-    if (include != null) {
-      if (servlet) {
-        includeList.add("org/apache/jsp/");
-        visibilityTree.put("org/apache/jsp/", Visibility.PUBLIC);
-      }
+   /**
+    * Parse include / exclude lists
+    * @param include The include input
+    * @param exclude The exclude input
+    */
+   private static void parse(String include, String exclude)
+   {
+      if (include != null)
+      {
+         if (servlet)
+         {
+            includeList.add("org/apache/jsp/");
+            visibilityTree.put("org/apache/jsp/", Visibility.PUBLIC);
+         }
 
-      StringTokenizer st = new StringTokenizer(include, ",");
-      List<String> l = new ArrayList<String>();
-      while (st.hasMoreTokens()) {
-        String s = st.nextToken();
-        s = s.trim();
-        if ("*".equals(s)) {
-          includeAll = true;
-        } else {
-          l.add(s);
-        }
-      }
-      Collections.sort(l, new SizeComparator());
-      Collections.reverse(l);
+         StringTokenizer st = new StringTokenizer(include, ",");
+         List<String> l = new ArrayList<String>();
+         while (st.hasMoreTokens())
+         {
+            String s = st.nextToken();
+            s = s.trim();
+            if ("*".equals(s))
+            {
+               includeAll = true;
+            }
+            else
+            {
+               l.add(s);
+            }
+         }
+         Collections.sort(l, new SizeComparator());
+         Collections.reverse(l);
 
-      for (String s : l) {
-        String c = s;
-        String v = null;
-        if (s.indexOf("|") != -1) {
-          c = s.substring(0, s.indexOf("|"));
-          c = c.trim();
-          v = s.substring(s.indexOf("|") + 1);
-          v = v.trim();
-        }
-        
-        if (c.endsWith(".*")) {
-          c = c.substring(0, c.indexOf(".*")) + "/";
-        }
-        if (c.endsWith(".class")) {
-          c = c.substring(0, c.indexOf(".class"));
-        }
-        c = c.replace('.', '/');
-        
-        Iterator it = includeList.iterator();
-        while (it.hasNext()) {
-          String t = (String)it.next();
-          
-          if (t.startsWith(c)) {
-            it.remove();
-          }
-        }
-        it = visibilityTree.keySet().iterator();
-        while (it.hasNext()) {
-          String t = (String)it.next();
-          
-          if (t.startsWith(c)) {
-            it.remove();
-          }
-        }
-        
-        includeList.add(c);
-        if (v != null) {
-          visibilityTree.put(c, parseVisibility(v));
-        }
+         for (String s : l)
+         {
+            String c = s;
+            String v = null;
+            if (s.indexOf("|") != -1)
+            {
+               c = s.substring(0, s.indexOf("|"));
+               c = c.trim();
+               v = s.substring(s.indexOf("|") + 1);
+               v = v.trim();
+            }
+
+            if (c.endsWith(".*"))
+            {
+               c = c.substring(0, c.indexOf(".*")) +
+                     "/";
+            }
+            if (c.endsWith(".class"))
+            {
+               c = c.substring(0, c.indexOf(".class"));
+            }
+            c = c.replace('.', '/');
+
+            Iterator it = includeList.iterator();
+            while (it.hasNext())
+            {
+               String t = (String)it.next();
+
+               if (t.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
+            it = visibilityTree.keySet().iterator();
+            while (it.hasNext())
+            {
+               String t = (String)it.next();
+
+               if (t.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
+
+            includeList.add(c);
+            if (v != null)
+            {
+               visibilityTree.put(c, parseVisibility(v));
+            }
+         }
       }
-    }
 
-    if (exclude != null) {
-      excludeAll = false;
-      StringTokenizer st = new StringTokenizer(exclude, ",");
-      List<String> l = new ArrayList<String>();
-      while (st.hasMoreTokens()) {
-        String s = st.nextToken();
-        s = s.trim();
-        if ("*".equals(s)) {
-          excludeAll = true;
-        } else {
-          l.add(s);
-        }
+      if (exclude != null)
+      {
+         excludeAll = false;
+         StringTokenizer st = new StringTokenizer(exclude, ",");
+         List<String> l = new ArrayList<String>();
+         while (st.hasMoreTokens())
+         {
+            String s = st.nextToken();
+            s = s.trim();
+            if ("*".equals(s))
+            {
+               excludeAll = true;
+            }
+            else
+            {
+               l.add(s);
+            }
+         }
+         Collections.sort(l, new SizeComparator());
+
+         for (String c : l)
+         {
+            if (c.endsWith(".*"))
+            {
+               c = c.substring(0, c.indexOf(".*")) +
+                     "/";
+            }
+            if (c.endsWith(".class"))
+            {
+               c = c.substring(0, c.indexOf(".class"));
+            }
+            c = c.replace('.', '/');
+
+            Iterator it = excludeList.iterator();
+            while (it.hasNext())
+            {
+               String s = (String)it.next();
+
+               if (s.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
+
+            excludeList.add(c);
+         }
       }
-      Collections.sort(l, new SizeComparator());
 
-      for (String c : l) {
-        if (c.endsWith(".*")) {
-          c = c.substring(0, c.indexOf(".*")) + "/";
-        }
-        if (c.endsWith(".class")) {
-          c = c.substring(0, c.indexOf(".class"));
-        }
-        c = c.replace('.', '/');
+      Collections.sort(includeList, new SizeComparator());
+      Collections.sort(excludeList, new SizeComparator());
+   }
 
-        Iterator it = excludeList.iterator();
-        while (it.hasNext()) {
-          String s = (String)it.next();
-          
-          if (s.startsWith(c)) {
-            it.remove();
-          }
-        }
-        
-        excludeList.add(c);
+   /**
+    * Parse store property
+    * @param p The property
+    * @param def The default value
+    * @return True or false
+    */
+   private static boolean parseStore(String p, boolean def)
+   {
+      if (p != null)
+      {
+         p = p.trim();
+
+         return !("FILE".equalsIgnoreCase(p));
       }
-    }
 
-    Collections.sort(includeList, new SizeComparator());
-    Collections.sort(excludeList, new SizeComparator());
-  }
+      return def;
+   }
 
-  /**
-   * Parse store property
-   * @param p The property
-   * @param def The default value
-   * @return True or false
-   */
-  private static boolean parseStore(String p, boolean def) {
-    if (p != null) {
-      p = p.trim();
+   /**
+    * Is the memory store enabled ?
+    * @return True if the memory store is enabled; otherwise false (file store)
+    */
+   public static boolean isMemoryStore()
+   {
+      return store;
+   }
 
-      return !("FILE".equalsIgnoreCase(p));
-    }
+   /**
+    * Get the file store location
+    * @return The file store location
+    */
+   public static String getFileStoreLocation()
+   {
+      return storeLocation;
+   }
 
-    return def;
-  }
+   /**
+    * Is the repository enabled ?
+    * @return True if the repository is enabled; otherwise false
+    */
+   public static boolean isRepository()
+   {
+      return repository;
+   }
 
-  /**
-   * Is the memory store enabled ?
-   * @return True if the memory store is enabled; otherwise false (file store)
-   */
-  public static boolean isMemoryStore() {
-    return store;
-  }
+   /**
+    * Is the profiler enabled ?
+    * @return True if the profiler is enabled; otherwise false
+    */
+   public static boolean isEnabled()
+   {
+      return enabled;
+   }
 
-  /**
-   * Get the file store location
-   * @return The file store location
-   */
-  public static String getFileStoreLocation() {
-    return storeLocation;
-  }
+   /**
+    * Set the enabled state of the agent
+    * @param e The enabled state
+    */
+   public static void setEnabled(boolean e)
+   {
+      enabled = e;
 
-  /**
-   * Is the repository enabled ?
-   * @return True if the repository is enabled; otherwise false
-   */
-  public static boolean isRepository() {
-    return repository;
-  }
+      if (isRepository())
+      {
+         List<Class> l = new ArrayList<Class>();
 
-  /**
-   * Is the profiler enabled ?
-   * @return True if the profiler is enabled; otherwise false
-   */
-  public static boolean isEnabled() {
-    return enabled;
-  }
+         for (Class c : instrumentation.getAllLoadedClasses())
+         {
+            String className = c.getName().replace(".", "/");
 
-  /**
-   * Set the enabled state of the agent
-   * @param e The enabled state
-   */
-  public static void setEnabled(boolean e) {
-    enabled = e;
+            boolean added = false;
+            for (int i = 0; !added &&
+                  i < includeList.size(); i++)
+            {
+               String classes = includeList.get(i);
+               if (className.startsWith(classes))
+               {
+                  l.add(c);
+                  added = true;
+               }
+            }
+         }
 
-    if (isRepository()) {
-      List<Class> l = new ArrayList<Class>();
-      
-      for (Class c : instrumentation.getAllLoadedClasses()) {
-        String className = c.getName().replace(".", "/");
-        
-        boolean added = false;
-        for (int i = 0; !added && i < includeList.size(); i++) {
-          String classes = includeList.get(i);
-          if (className.startsWith(classes)) {
-            l.add(c);
-            added = true;
-          }
-        }
+         Class[] clz = new Class[l.size()];
+         for (int i = 0; i < l.size(); i++)
+         {
+            clz[i] = l.get(i);
+         }
+
+         if (enabled)
+         {
+            redefine(clz, true);
+         }
+         else
+         {
+            redefine(clz, false);
+         }
       }
-      
-      Class[] clz = new Class[l.size()];
-      for (int i = 0; i < l.size(); i++) {
-        clz[i] = l.get(i);
-      }
-      
-      if (enabled) {
-        redefine(clz, true);
-      } else {
-        redefine(clz, false);
-      }
-    }
-  }
+   }
 
-  /**
-   * Is the profiler in precompiled mode ?
-   * @return True if the profiler is in precompiled mode; otherwise false
-   */
-  public static boolean isPrecompiled() {
-    return precompiled;
-  }
+   /**
+    * Is the profiler in precompiled mode ?
+    * @return True if the profiler is in precompiled mode; otherwise false
+    */
+   public static boolean isPrecompiled()
+   {
+      return precompiled;
+   }
 
-  /**
-   * Is the CPU profiling enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isCPU() {
-    return cpu;
-  }
+   /**
+    * Is the CPU profiling enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isCPU()
+   {
+      return cpu;
+   }
 
-  /**
-   * Is the memory profiling enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isMemory() {
-    return memory;
-  }
+   /**
+    * Is the memory profiling enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isMemory()
+   {
+      return memory;
+   }
 
-  /**
-   * Load plugins
-   * @param prop The properties
-   */
-  private static void loadPlugins(Properties prop) {
-    List<Plugin> ps = PluginHelper.load(prop);
+   /**
+    * Load plugins
+    * @param prop The properties
+    */
+   private static void loadPlugins(Properties prop)
+   {
+      List<Plugin> ps = PluginHelper.load(prop);
 
-    for (Plugin p : ps) {
-      ClassUtil.addPlugin(p);
-    }
-  }
+      for (Plugin p : ps)
+      {
+         ClassUtil.addPlugin(p);
+      }
+   }
 
-  /**
-   * Load jobs
-   * @param prop The properties
-   */
-  private static void loadJobs(Properties prop) {
-    List<Job> js = JobHelper.load(prop);
+   /**
+    * Load jobs
+    * @param prop The properties
+    */
+   private static void loadJobs(Properties prop)
+   {
+      List<Job> js = JobHelper.load(prop);
 
-    if (js != null && js.size() > 0) {
-      timer = new Timer(Version.VENDOR + " " + Version.PRODUCT + ": Job executer", true);
-      for (Job j : js) {
-        if (j.getPeriod() >= 0) {
-          timer.scheduleAtFixedRate(j, j.getTime(), j.getPeriod());
-        } else {
-          timer.schedule(j, j.getTime());
-        }
+      if (js != null &&
+            js.size() > 0)
+      {
+         timer = new Timer(Version.VENDOR +
+               " " + Version.PRODUCT + ": Job executer", true);
+         for (Job j : js)
+         {
+            if (j.getPeriod() >= 0)
+            {
+               timer.scheduleAtFixedRate(j, j.getTime(), j.getPeriod());
+            }
+            else
+            {
+               timer.schedule(j, j.getTime());
+            }
+         }
       }
-    }
-  }
+   }
 
-  /**
-   * Get the instrumentation interface
-   * @return The instrumentation
-   */
-  public static Instrumentation getInstrumentation() {
-    return instrumentation;
-  }
+   /**
+    * Get the instrumentation interface
+    * @return The instrumentation
+    */
+   public static Instrumentation getInstrumentation()
+   {
+      return instrumentation;
+   }
 
-  /**
-   * Approve the following class for transformation
-   * @param className The class name
-   * @return True if the class is approved; otherwise false
-   */
-  static boolean approve(String className) {
-    // We can't profile the profiler, Java / Sun classes 
-    // nor Javassist
-    if (className.startsWith("org/jboss/profiler/agent/") ||
-        className.startsWith("org/jboss/profiler/as/") ||
-        className.startsWith("org/jboss/profiler/client/") ||
-        className.startsWith("org/jboss/profiler/connectors/") ||
-        className.startsWith("org/jboss/profiler/plugins/") ||
-        className.startsWith("org/jboss/profiler/shared/") ||
-        className.startsWith("java/") ||
-        className.startsWith("javax/") ||
-        className.startsWith("sun/") ||
-        className.startsWith("com/sun/") ||
-        className.startsWith("javassist/")) {
-      return false;
-    }
+   /**
+    * Approve the following class for transformation
+    * @param className The class name
+    * @return True if the class is approved; otherwise false
+    */
+   static boolean approve(String className)
+   {
+      // We can't profile the profiler, Java / Sun classes
+      // nor Javassist
+      if (className.startsWith("org/jboss/profiler/agent/") ||
+            className.startsWith("org/jboss/profiler/as/") || className.startsWith("org/jboss/profiler/client/") ||
+            className.startsWith("org/jboss/profiler/connectors/") ||
+            className.startsWith("org/jboss/profiler/plugins/") || className.startsWith("org/jboss/profiler/shared/") ||
+            className.startsWith("java/") || className.startsWith("javax/") || className.startsWith("sun/") ||
+            className.startsWith("com/sun/") || className.startsWith("javassist/"))
+      {
+         return false;
+      }
 
-    return true;
-  }
+      return true;
+   }
 
-  /**
-   * Accept the following class for transformation
-   * @param className The class name
-   * @return True if the class should be transformed; otherwise false
-   */
-  public static boolean accept(String className) {
-    if (!approve(className)) {
-      return false;
-    }
+   /**
+    * Accept the following class for transformation
+    * @param className The class name
+    * @return True if the class should be transformed; otherwise false
+    */
+   public static boolean accept(String className)
+   {
+      if (!approve(className))
+      {
+         return false;
+      }
 
-    for (String cl : excludeList) {
-      if (className.startsWith(cl)) {
-        return false;
+      for (String cl : excludeList)
+      {
+         if (className.startsWith(cl))
+         {
+            return false;
+         }
       }
-    }
 
-    if (includeAll && !excludeAll) {
-      return true;
-    }
+      if (includeAll &&
+            !excludeAll)
+      {
+         return true;
+      }
 
-    for (String cl : includeList) {
-      if (className.startsWith(cl)) {
-        return true;
+      for (String cl : includeList)
+      {
+         if (className.startsWith(cl))
+         {
+            return true;
+         }
       }
-    }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Get the visibility for class
-   * @param className The class name
-   * @return The visibility
-   */
-  public static Visibility getVisibility(String className) {
-    Iterator it = visibilityTree.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      if (className.startsWith(key)) {
-        return (Visibility)entry.getValue();
+   /**
+    * Get the visibility for class
+    * @param className The class name
+    * @return The visibility
+    */
+   public static Visibility getVisibility(String className)
+   {
+      Iterator it = visibilityTree.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         if (className.startsWith(key))
+         {
+            return (Visibility)entry.getValue();
+         }
       }
-    }
 
-    return visibility;
-  }
+      return visibility;
+   }
 
-  /**
-   * Is EJB ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isEJB() {
-    return ejb;
-  }
+   /**
+    * Is EJB ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isEJB()
+   {
+      return ejb;
+   }
 
-  /**
-   * Is Servlet ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isServlet() {
-    return servlet;
-  }
+   /**
+    * Is Servlet ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isServlet()
+   {
+      return servlet;
+   }
 
-  /**
-   * Is JSF ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isJSF() {
-    return jsf;
-  }
+   /**
+    * Is JSF ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isJSF()
+   {
+      return jsf;
+   }
 
-  /**
-   * Is JMX ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isJMX() {
-    return jmx;
-  }
+   /**
+    * Is JMX ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isJMX()
+   {
+      return jmx;
+   }
 
-  /**
-   * Is RMI ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isRMI() {
-    return rmi;
-  }
+   /**
+    * Is RMI ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isRMI()
+   {
+      return rmi;
+   }
 
-  /**
-   * Is CORBA ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isCORBA() {
-    return corba;
-  }
+   /**
+    * Is CORBA ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isCORBA()
+   {
+      return corba;
+   }
 
-  /**
-   * Add classes
-   * @param classes The classes
-   * @param v The visibility
-   */
-  public static void addClasses(String classes, Visibility v) {
-    if (isRepository() && !precompiled) {
+   /**
+    * Add classes
+    * @param classes The classes
+    * @param v The visibility
+    */
+   public static void addClasses(String classes, Visibility v)
+   {
+      if (isRepository() &&
+            !precompiled)
+      {
 
-      if (classes.endsWith(".*")) {
-        classes = classes.substring(0, classes.indexOf(".*")) + "/";
-      }
-      if (classes.endsWith(".class")) {
-        classes = classes.substring(0, classes.indexOf(".class"));
-      }
-      classes = classes.replace('.', '/');
+         if (classes.endsWith(".*"))
+         {
+            classes = classes.substring(0, classes.indexOf(".*")) +
+                  "/";
+         }
+         if (classes.endsWith(".class"))
+         {
+            classes = classes.substring(0, classes.indexOf(".class"));
+         }
+         classes = classes.replace('.', '/');
 
-      if (approve(classes)) {
-        List<Class> l = new ArrayList<Class>();
-        
-        for (Class c : instrumentation.getAllLoadedClasses()) {
-          String className = c.getName().replace(".", "/");
-          if (className.startsWith(classes)) {
-            l.add(c);
-          }
-        }
-        
-        Class[] clz = new Class[l.size()];
-        for (int i = 0; i < l.size(); i++) {
-          clz[i] = l.get(i);
-        }
+         if (approve(classes))
+         {
+            List<Class> l = new ArrayList<Class>();
 
-        Iterator it = includeList.iterator();
-        while (it.hasNext()) {
-          String s = (String)it.next();
-          
-          if (s.startsWith(classes)) {
-            it.remove();
-          }
-        }
-        
-        it = visibilityTree.keySet().iterator();
-        while (it.hasNext()) {
-          String s = (String)it.next();
-          
-          if (s.startsWith(classes)) {
-            it.remove();
-          }
-        }
-        
-        it = excludeList.iterator();
-        while (it.hasNext()) {
-          String s = (String)it.next();
-          
-          if (s.startsWith(classes)) {
-            it.remove();
-          }
-        }
+            for (Class c : instrumentation.getAllLoadedClasses())
+            {
+               String className = c.getName().replace(".", "/");
+               if (className.startsWith(classes))
+               {
+                  l.add(c);
+               }
+            }
 
-        includeList.add(classes);
-        visibilityTree.put(classes, v);
+            Class[] clz = new Class[l.size()];
+            for (int i = 0; i < l.size(); i++)
+            {
+               clz[i] = l.get(i);
+            }
 
-        Collections.sort(includeList, new SizeComparator());
-        Collections.sort(excludeList, new SizeComparator());
+            Iterator it = includeList.iterator();
+            while (it.hasNext())
+            {
+               String s = (String)it.next();
 
-        redefine(clz, true);
-      }
-    }
-  }
+               if (s.startsWith(classes))
+               {
+                  it.remove();
+               }
+            }
 
-  /**
-   * Remove classes
-   * @param classes The classes
-   */
-  public static void removeClasses(String classes) {
-    if (isRepository() && !precompiled) {
-      boolean all = false;
+            it = visibilityTree.keySet().iterator();
+            while (it.hasNext())
+            {
+               String s = (String)it.next();
 
-      if (classes.endsWith(".*")) {
-        classes = classes.substring(0, classes.indexOf(".*")) + "/";
+               if (s.startsWith(classes))
+               {
+                  it.remove();
+               }
+            }
+
+            it = excludeList.iterator();
+            while (it.hasNext())
+            {
+               String s = (String)it.next();
+
+               if (s.startsWith(classes))
+               {
+                  it.remove();
+               }
+            }
+
+            includeList.add(classes);
+            visibilityTree.put(classes, v);
+
+            Collections.sort(includeList, new SizeComparator());
+            Collections.sort(excludeList, new SizeComparator());
+
+            redefine(clz, true);
+         }
       }
-      if (classes.endsWith(".class")) {
-        classes = classes.substring(0, classes.indexOf(".class"));
-      }
-      classes = classes.replace('.', '/');
-      
-      List<Class> l = new ArrayList<Class>();
-      
-      for (Class c : instrumentation.getAllLoadedClasses()) {
-        String className = c.getName().replace(".", "/");
-        if (className.startsWith(classes)) {
-          l.add(c);
-        }
-      }
-      
-      Class[] clz = new Class[l.size()];
-      for (int i = 0; i < l.size(); i++) {
-        clz[i] = l.get(i);
-      }
+   }
 
-      Iterator it = includeList.iterator();
-      while (it.hasNext()) {
-        String s = (String)it.next();
+   /**
+    * Remove classes
+    * @param classes The classes
+    */
+   public static void removeClasses(String classes)
+   {
+      if (isRepository() &&
+            !precompiled)
+      {
+         boolean all = false;
 
-        if (s.startsWith(classes)) {
-          it.remove();
-        }
+         if (classes.endsWith(".*"))
+         {
+            classes = classes.substring(0, classes.indexOf(".*")) +
+                  "/";
+         }
+         if (classes.endsWith(".class"))
+         {
+            classes = classes.substring(0, classes.indexOf(".class"));
+         }
+         classes = classes.replace('.', '/');
+
+         List<Class> l = new ArrayList<Class>();
+
+         for (Class c : instrumentation.getAllLoadedClasses())
+         {
+            String className = c.getName().replace(".", "/");
+            if (className.startsWith(classes))
+            {
+               l.add(c);
+            }
+         }
+
+         Class[] clz = new Class[l.size()];
+         for (int i = 0; i < l.size(); i++)
+         {
+            clz[i] = l.get(i);
+         }
+
+         Iterator it = includeList.iterator();
+         while (it.hasNext())
+         {
+            String s = (String)it.next();
+
+            if (s.startsWith(classes))
+            {
+               it.remove();
+            }
+         }
+
+         it = visibilityTree.keySet().iterator();
+         while (it.hasNext())
+         {
+            String s = (String)it.next();
+
+            if (s.startsWith(classes))
+            {
+               it.remove();
+            }
+         }
+
+         Collections.sort(includeList, new SizeComparator());
+
+         redefine(clz, false);
       }
-      
-      it = visibilityTree.keySet().iterator();
-      while (it.hasNext()) {
-        String s = (String)it.next();
+   }
 
-        if (s.startsWith(classes)) {
-          it.remove();
-        }
+   /**
+    * List classes
+    * @return The classes
+    */
+   public static String[] listClasses()
+   {
+      if (!precompiled)
+      {
+         String[] result = new String[includeList.size()];
+         for (int i = 0; i < includeList.size(); i++)
+         {
+            String s = includeList.get(i);
+
+            if (s.endsWith("/"))
+            {
+               s = s.substring(0, s.length() - 1) +
+                     ".*";
+            }
+
+            s = s.replace('/', '.');
+
+            result[i] = s;
+         }
+         return result;
       }
-      
-      Collections.sort(includeList, new SizeComparator());
-      
-      redefine(clz, false);
-    }
-  }
-    
-  /**
-   * List classes
-   * @return The classes
-   */
-  public static String[] listClasses() {
-    if (!precompiled) {
-      String[] result = new String[includeList.size()];
-      for (int i = 0; i < includeList.size(); i++) {
-        String s = includeList.get(i);
-        
-        if (s.endsWith("/")) {
-          s = s.substring(0, s.length() - 1) + ".*";
-        }
-        
-        s = s.replace('/', '.');
-        
-        result[i] = s;
-      }
-      return result;
-    }
-    return null;
-  }
+      return null;
+   }
 
-  /**
-   * Redefine
-   * @param clz The classes
-   * @param instrument Should the classes be instrumented ?
-   */
-  private static void redefine(Class[] clz, boolean instrument) {
-    try {
-      List<ClassDefinition> l = new ArrayList<ClassDefinition>();
+   /**
+    * Redefine
+    * @param clz The classes
+    * @param instrument Should the classes be instrumented ?
+    */
+   private static void redefine(Class[] clz, boolean instrument)
+   {
+      try
+      {
+         List<ClassDefinition> l = new ArrayList<ClassDefinition>();
 
-      if (clz != null) {
-        for (Class c : clz) {
-          try {
-            byte[] buffer = null;
-            if (instrument) {
-              buffer = transformer.loadInstrumented(c.getName(), c.getClassLoader());
-            } else {
-              buffer = transformer.loadNonInstrumented(c.getName(), c.getClassLoader());
+         if (clz != null)
+         {
+            for (Class c : clz)
+            {
+               try
+               {
+                  byte[] buffer = null;
+                  if (instrument)
+                  {
+                     buffer = transformer.loadInstrumented(c.getName(), c.getClassLoader());
+                  }
+                  else
+                  {
+                     buffer = transformer.loadNonInstrumented(c.getName(), c.getClassLoader());
+                  }
+
+                  if (buffer != null)
+                  {
+                     ClassDefinition cd = new ClassDefinition(c, buffer);
+                     l.add(cd);
+                  }
+               }
+               catch (Throwable it)
+               {
+                  System.err.println(it.getMessage());
+                  it.printStackTrace(System.err);
+               }
             }
+         }
 
-            if (buffer != null) {
-              ClassDefinition cd = new ClassDefinition(c, buffer);
-              l.add(cd);
-            }
-          } catch (Throwable it) {
-            System.err.println(it.getMessage());
-            it.printStackTrace(System.err);
-          }
-        }
+         ClassDefinition[] cds = new ClassDefinition[l.size()];
+         for (int i = 0; i < l.size(); i++)
+         {
+            cds[i] = l.get(i);
+         }
+
+         instrumentation.redefineClasses(cds);
       }
+      catch (Throwable t)
+      {
+         System.err.println(t.getMessage());
+         t.printStackTrace(System.err);
+      }
+   }
 
-      ClassDefinition[] cds = new ClassDefinition[l.size()];
-      for (int i = 0; i < l.size(); i++) {
-        cds[i] = l.get(i);
+   /**
+    * Check for the presence of the instrumentation library
+    * @return True if detection went ok; otherwise false
+    */
+   private static boolean checkInstrumentation()
+   {
+      try
+      {
+         Class c = Class.forName("javassist.ClassPool");
       }
+      catch (Throwable t)
+      {
+         System.out.println("WARNING: Javassist not detected - the profiler will not be enabled");
+         return false;
+      }
+      return true;
+   }
 
-      instrumentation.redefineClasses(cds);
-    } catch (Throwable t) {
-      System.err.println(t.getMessage());
-      t.printStackTrace(System.err);
-    }
-  }
+   /**
+    * The agentmain method
+    * @param args The arguments
+    * @param inst The instrumentation
+    */
+   public static void agentmain(String args, Instrumentation inst)
+   {
+      boot(args, inst);
+   }
 
-  /**
-   * Check for the presence of the instrumentation library
-   * @return True if detection went ok; otherwise false
-   */
-  private static boolean checkInstrumentation() {
-    try {
-      Class c = Class.forName("javassist.ClassPool");
-    } catch (Throwable t) {
-      System.out.println("WARNING: Javassist not detected - the profiler will not be enabled");
-      return false;
-    }
-    return true;
-  }
+   /**
+    * The premain method
+    * @param args The arguments
+    * @param inst The instrumentation
+    */
+   public static void premain(String args, Instrumentation inst)
+   {
+      boot(args, inst);
+   }
 
-  /**
-   * The agentmain method
-   * @param args The arguments
-   * @param inst The instrumentation
-   */
-  public static void agentmain(String args, Instrumentation inst) {
-    boot(args, inst);
-  }
+   /**
+    * The boot method
+    * @param args The arguments
+    * @param inst The instrumentation
+    */
+   private static void boot(String args, Instrumentation inst)
+   {
+      parseConfiguration();
 
-  /**
-   * The premain method
-   * @param args The arguments
-   * @param inst The instrumentation
-   */
-  public static void premain(String args, Instrumentation inst) {
-    boot(args, inst);
-  }
+      if (args != null &&
+            !args.equals(""))
+      {
+         StringTokenizer st = new StringTokenizer(args, ",");
+         while (st.hasMoreTokens())
+         {
+            String s = st.nextToken();
 
-  /**
-   * The boot method
-   * @param args The arguments
-   * @param inst The instrumentation
-   */
-  private static void boot(String args, Instrumentation inst) {
-    parseConfiguration();
+            String key = s.substring(0, s.indexOf("="));
+            String value = s.substring(s.indexOf("=") + 1);
 
-    if (args != null && !args.equals("")) {
-      StringTokenizer st = new StringTokenizer(args, ",");
-      while (st.hasMoreTokens()) {
-        String s = st.nextToken();
+            if ("enable".equalsIgnoreCase(key))
+            {
+               enabled = parseBoolean(value, enabled);
+            }
+            if ("remote".equalsIgnoreCase(key))
+            {
+               remote = parseBoolean(value, remote);
+            }
+            if ("quite".equalsIgnoreCase(key))
+            {
+               quite = parseBoolean(value, quite);
+            }
+         }
+      }
 
-        String key = s.substring(0, s.indexOf("="));
-        String value = s.substring(s.indexOf("=") + 1);
-        
-        if ("enable".equalsIgnoreCase(key)) {
-          enabled = parseBoolean(value, enabled);
-        }
-        if ("remote".equalsIgnoreCase(key)) {
-          remote = parseBoolean(value, remote);
-        }
-        if ("quite".equalsIgnoreCase(key)) {
-          quite = parseBoolean(value, quite);
-        }
+      if (!quite)
+      {
+         System.out.println(Version.FULL_VERSION +
+               " (" + System.getProperty("java.vendor") + " " + System.getProperty("java.version") + ")");
       }
-    }
 
-    if (!quite) {
-      System.out.println(Version.FULL_VERSION + " (" + System.getProperty("java.vendor") + " " + 
-                         System.getProperty("java.version") + ")");
-    }
+      if (!quite &&
+            !enabled)
+      {
+         System.out.println("JBoss Profiler not enabled");
+      }
 
-    if (!quite && !enabled) {
-      System.out.println("JBoss Profiler not enabled");
-    }
+      instrumentation = inst;
 
-    instrumentation = inst;
+      if (!precompiled &&
+            checkInstrumentation())
+      {
+         transformer = new JavassistTransformer();
+         instrumentation.addTransformer(transformer);
+      }
 
-    if (!precompiled && checkInstrumentation()) {
-      transformer = new JavassistTransformer();
-      instrumentation.addTransformer(transformer);
-    }
+      if (save ||
+            remote)
+      {
+         Runtime.getRuntime().addShutdownHook(new Thread()
+         {
+            @Override
+            public void run()
+            {
+               Profiler.stopProfiler();
 
-    if (save || remote) {
-      Runtime.getRuntime().addShutdownHook(new Thread() {
-        @Override
-        public void run() {
-          Profiler.stopProfiler();
+               if (save)
+               {
+                  for (Snapshot snapshot : Profiler.getSnapshots())
+                  {
+                     try
+                     {
+                        SnapshotHelper.save(snapshot, new File(saveLocation +
+                              SnapshotHelper.getName(snapshot) + ".jps"));
+                     }
+                     catch (Exception e)
+                     {
+                        System.err.println(e.getMessage());
+                        e.printStackTrace(System.err);
+                     }
+                  }
+               }
 
-          if (save) {
-            for (Snapshot snapshot : Profiler.getSnapshots()) {
-              try {
-                SnapshotHelper.save(snapshot, new File(saveLocation + SnapshotHelper.getName(snapshot) + ".jps"));
-              } catch (Exception e) {
-                System.err.println(e.getMessage());
-                e.printStackTrace(System.err);
-              }
-            }
-          }
+               if (connector != null)
+               {
+                  try
+                  {
+                     Method connectorStop = connector.getClass().getMethod("stop", (Class[])null);
 
-          if (connector != null) {
-            try {
-              Method connectorStop = connector.getClass().getMethod("stop", (Class[])null);
+                     connectorStop.invoke(connector, (Object[])null);
 
-              connectorStop.invoke(connector, (Object[])null);
+                     Method connectorDestroy = connector.getClass().getMethod("destroy", (Class[])null);
 
-              Method connectorDestroy = connector.getClass().getMethod("destroy", (Class[])null);
-
-              connectorDestroy.invoke(connector, (Object[])null);
-            } catch (Exception e) {
-              System.err.println(e.getMessage());
-              e.printStackTrace();
+                     connectorDestroy.invoke(connector, (Object[])null);
+                  }
+                  catch (Exception e)
+                  {
+                     System.err.println(e.getMessage());
+                     e.printStackTrace();
+                  }
+               }
             }
-          }
-        }
-      });
-    }
+         });
+      }
 
-    boolean remoteInit = false;
-    if (remote) {
-      try {
-        Class invokerClass = Class.forName("org.jboss.remoting.InvokerLocator");
-        Constructor invokerConstructor = invokerClass.getConstructor(String.class);
+      boolean remoteInit = false;
+      if (remote)
+      {
+         try
+         {
+            Class invokerClass = Class.forName("org.jboss.remoting.InvokerLocator");
+            Constructor invokerConstructor = invokerClass.getConstructor(String.class);
 
-        Object invoker = invokerConstructor.newInstance("socket://" + host + ":" + Integer.toString(port));
+            Object invoker = invokerConstructor.newInstance("socket://" +
+                  host + ":" + Integer.toString(port));
 
-        Class connectorClass = Class.forName("org.jboss.remoting.transport.Connector");
-        Constructor connectorConstructor = connectorClass.getConstructor(invokerClass);
+            Class connectorClass = Class.forName("org.jboss.remoting.transport.Connector");
+            Constructor connectorConstructor = connectorClass.getConstructor(invokerClass);
 
-        connector = connectorConstructor.newInstance(invoker);
+            connector = connectorConstructor.newInstance(invoker);
 
-        Method connectorCreate = connectorClass.getMethod("create", (Class[])null);
+            Method connectorCreate = connectorClass.getMethod("create", (Class[])null);
 
-        connectorCreate.invoke(connector, (Object[])null);
+            connectorCreate.invoke(connector, (Object[])null);
 
-        Class socketHandlerClass = Class.forName("org.jboss.profiler.connectors.SocketHandler");
-        Object socketHandler = socketHandlerClass.newInstance();
+            Class socketHandlerClass = Class.forName("org.jboss.profiler.connectors.SocketHandler");
+            Object socketHandler = socketHandlerClass.newInstance();
 
-        Class serverInvocationHandlerClass = Class.forName("org.jboss.remoting.ServerInvocationHandler");
+            Class serverInvocationHandlerClass = Class.forName("org.jboss.remoting.ServerInvocationHandler");
 
-        Method connectorAddInvocationHandler = connectorClass.getMethod("addInvocationHandler",
-                                                                        new Class[] {
-                                                                          String.class,
-                                                                          serverInvocationHandlerClass
-                                                                        });
+            Method connectorAddInvocationHandler =
+                  connectorClass.getMethod("addInvocationHandler", new Class[] {String.class,
+                     serverInvocationHandlerClass});
 
-        connectorAddInvocationHandler.invoke(connector,
-                                             new Object[] {
-                                               "jboss-profiler-socket",
-                                               socketHandler
-                                             });
+            connectorAddInvocationHandler.invoke(connector, new Object[] {"jboss-profiler-socket", socketHandler});
 
-        Method connectorStart = connectorClass.getMethod("start", (Class[])null);
+            Method connectorStart = connectorClass.getMethod("start", (Class[])null);
 
-        connectorStart.invoke(connector, (Object[])null);
+            connectorStart.invoke(connector, (Object[])null);
 
-        remoteInit = true;
-        if (!quite) {
-          System.out.println("JBoss Profiler: Socket=" + host + ":" + Integer.toString(port));
-        }
+            remoteInit = true;
+            if (!quite)
+            {
+               System.out.println("JBoss Profiler: Socket=" +
+                     host + ":" + Integer.toString(port));
+            }
 
-      } catch (ClassNotFoundException cnfe) {
-        // JBoss Remoting or JBoss Profiler Connectors not in classpath
-        // Assume running in application server with external communication module
-      } catch (Exception e) {
-        System.err.println(e.getMessage());
-        e.printStackTrace();
+         }
+         catch (ClassNotFoundException cnfe)
+         {
+            // JBoss Remoting or JBoss Profiler Connectors not in classpath
+            // Assume running in application server with external communication module
+         }
+         catch (Exception e)
+         {
+            System.err.println(e.getMessage());
+            e.printStackTrace();
+         }
       }
-    }
 
-    if (remote && !remoteInit && !quite) {
-      System.out.println("JBoss Profiler depends on external communication module");
-    }
+      if (remote &&
+            !remoteInit && !quite)
+      {
+         System.out.println("JBoss Profiler depends on external communication module");
+      }
 
-    if (startup) {
-      Profiler.startProfiler();
-    }
-  }
+      if (startup)
+      {
+         Profiler.startProfiler();
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassRepository.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassRepository.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassRepository.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,119 +32,146 @@
  * Class repository
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassRepository {
+public class ClassRepository
+{
 
-  /** Lock */
-  private static Object lock = new Object();
+   /** Lock */
+   private static Object lock = new Object();
 
-  /** Repository location */
-  private static File location = new File(System.getProperty("java.io.tmpdir"), 
-                                          "jboss-profiler.tmp");
+   /** Repository location */
+   private static File location = new File(System.getProperty("java.io.tmpdir"), "jboss-profiler.tmp");
 
-  static {
-    location.mkdirs();
-    location.deleteOnExit();
-  }
+   static
+   {
+      location.mkdirs();
+      location.deleteOnExit();
+   }
 
-  /**
-   * Load
-   * @param name The class name
-   * @param loader The class loader
-   * @return The class
-   * @exception IOException If an error occurs
-   */
-  public static byte[] load(String name, ClassLoader loader) throws IOException {
-    synchronized (lock) {
-      File file = getFile(name, loader);
-      
-      if (file.exists()) {
-        FileInputStream fis = null;
-        try {
-          byte[] buffer = new byte[(int)file.length()];
-        
-          fis = new FileInputStream(file);
-          BufferedInputStream bis = new BufferedInputStream(fis, 16384);
-        
-          bis.read(buffer);
+   /**
+    * Load
+    * @param name The class name
+    * @param loader The class loader
+    * @return The class
+    * @exception IOException If an error occurs
+    */
+   public static byte[] load(String name, ClassLoader loader) throws IOException
+   {
+      synchronized (lock)
+      {
+         File file = getFile(name, loader);
 
-          return buffer;
-        } finally {
-          if (fis != null) {
-            try {
-              fis.close();
-            } catch (IOException ioe) {
-              // Ignore
+         if (file.exists())
+         {
+            FileInputStream fis = null;
+            try
+            {
+               byte[] buffer = new byte[(int)file.length()];
+
+               fis = new FileInputStream(file);
+               BufferedInputStream bis = new BufferedInputStream(fis, 16384);
+
+               bis.read(buffer);
+
+               return buffer;
             }
-          }
-        }
+            finally
+            {
+               if (fis != null)
+               {
+                  try
+                  {
+                     fis.close();
+                  }
+                  catch (IOException ioe)
+                  {
+                     // Ignore
+                  }
+               }
+            }
+         }
+
+         return null;
       }
-      
-      return null;
-    }
-  }
+   }
 
-  /**
-   * Save
-   * @param name The class name
-   * @param loader The class loader
-   * @param clz The class
-   * @exception IOException If an error occurs
-   */
-  public static void save(String name, ClassLoader loader, byte[] clz) throws IOException {
-    synchronized (lock) {
-      File file = getFile(name, loader);
+   /**
+    * Save
+    * @param name The class name
+    * @param loader The class loader
+    * @param clz The class
+    * @exception IOException If an error occurs
+    */
+   public static void save(String name, ClassLoader loader, byte[] clz) throws IOException
+   {
+      synchronized (lock)
+      {
+         File file = getFile(name, loader);
 
-      FileOutputStream fos = null;
-      try {
-        fos = new FileOutputStream(file);
-        BufferedOutputStream bos = new BufferedOutputStream(fos, 16384);
-        
-        bos.write(clz);
-        
-        bos.flush();
-      } finally {
-        if (fos != null) {
-          try {
-            fos.close();
-          } catch (IOException ioe) {
-            // Ignore
-          }
-        }
+         FileOutputStream fos = null;
+         try
+         {
+            fos = new FileOutputStream(file);
+            BufferedOutputStream bos = new BufferedOutputStream(fos, 16384);
+
+            bos.write(clz);
+
+            bos.flush();
+         }
+         finally
+         {
+            if (fos != null)
+            {
+               try
+               {
+                  fos.close();
+               }
+               catch (IOException ioe)
+               {
+                  // Ignore
+               }
+            }
+         }
       }
-    }
-  }
+   }
 
-  /**
-   * Exists
-   * @param name The class name
-   * @param loader The class loader
-   * @return True if the class exists in the repository; otherwise false
-   */
-  public static boolean exists(String name, ClassLoader loader) {
-    synchronized (lock) {
-      File file = getFile(name, loader);
+   /**
+    * Exists
+    * @param name The class name
+    * @param loader The class loader
+    * @return True if the class exists in the repository; otherwise false
+    */
+   public static boolean exists(String name, ClassLoader loader)
+   {
+      synchronized (lock)
+      {
+         File file = getFile(name, loader);
 
-      if (file.exists()) {
-        return true;
+         if (file.exists())
+         {
+            return true;
+         }
+
+         return false;
       }
+   }
 
-      return false;
-    }
-  }
+   /**
+    * Get the file
+    * @param name The class name
+    * @param loader The class loader
+    * @return The file
+    */
+   private static File getFile(String name, ClassLoader loader)
+   {
+      if (loader == null)
+      {
+         loader = ClassLoader.getSystemClassLoader();
+      }
+      String prefix = (loader == null)
+            ? "SYSCL_" : String.format("CL@%08X_", System.identityHashCode(loader));
+      String suffix = name.replace("/", "_");
 
-  /**
-   * Get the file
-   * @param name The class name
-   * @param loader The class loader
-   * @return The file
-   */
-  private static File getFile(String name, ClassLoader loader) {
-    if (loader == null) {
-      loader = ClassLoader.getSystemClassLoader();
-    }
-    String prefix = (loader == null) ? "SYSCL_" : String.format("CL@%08X_", System.identityHashCode(loader));
-    String suffix = name.replace("/", "_");
-
-    return new File(location, prefix + suffix + ".class");
-  }
+      return new File(location, prefix +
+            suffix + ".class");
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ClassUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,7 +32,6 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -48,543 +47,695 @@
  * The class utility class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassUtil {
+public class ClassUtil
+{
 
-  /** Plugins */
-  private static List<Plugin> plugins = new ArrayList<Plugin>();
+   /** Plugins */
+   private static List<Plugin> plugins = new ArrayList<Plugin>();
 
-  /** Web.xml map */
-  private static Map<ClassLoader, String> webMap = 
-    new HashMap<ClassLoader, String>();
+   /** Web.xml map */
+   private static Map<ClassLoader, String> webMap = new HashMap<ClassLoader, String>();
 
-  /** JSF map */
-  private static Map<ClassLoader, Map<Integer, List<String>>> jsfMap = 
-    new HashMap<ClassLoader, Map<Integer, List<String>>>();
+   /** JSF map */
+   private static Map<ClassLoader, Map<Integer, List<String>>> jsfMap =
+         new HashMap<ClassLoader, Map<Integer, List<String>>>();
 
-  /**
-   * Add a plugin
-   * @param plugin The plugin
-   */
-  public static void addPlugin(Plugin plugin) {
-    plugins.add(plugin);
-  }
+   /**
+    * Add a plugin
+    * @param plugin The plugin
+    */
+   public static void addPlugin(Plugin plugin)
+   {
+      plugins.add(plugin);
+   }
 
-  /**
-   * Get the classes
-   * @return The classes
-   */
-  public static List<ClassInfo> getClasses() {
-    List<ClassInfo> result = new ArrayList<ClassInfo>();
+   /**
+    * Get the classes
+    * @return The classes
+    */
+   public static List<ClassInfo> getClasses()
+   {
+      List<ClassInfo> result = new ArrayList<ClassInfo>();
 
-    Instrumentation instrumentation = Agent.getInstrumentation();
-    if (instrumentation != null) {
-      Class[] loaded = instrumentation.getAllLoadedClasses();
+      Instrumentation instrumentation = Agent.getInstrumentation();
+      if (instrumentation != null)
+      {
+         Class[] loaded = instrumentation.getAllLoadedClasses();
 
-      Set<String> processed = new HashSet<String>();
-      
-      for (Class c : loaded) {
-        if (!c.isInterface() && 
-            !c.isArray() && 
-            !c.isAnnotation() && 
-            !c.isSynthetic()) {
-          String className = c.getName().replace(".", "/");
-          if (((Agent.isPrecompiled() && Agent.approve(className)) || Agent.accept(className)) && 
-              !processed.contains(className)) {
+         Set<String> processed = new HashSet<String>();
 
-            int ct = ClassType.POJO;
-            
-            if (Agent.isEJB() && isSession(c)) {
-              ct = ClassType.EJB_SESSION;
-            } else if (Agent.isEJB() && isEntity(c)) {
-              ct = ClassType.EJB_ENTITY;
-            } else if (Agent.isEJB() && isMessage(c)) {
-              ct = ClassType.EJB_MESSAGE;
-            } else if (Agent.isServlet() && isJSP(c)) {
-              ct = ClassType.JSP;
-            } else if (Agent.isServlet() && isServlet(c)) {
-              ct = ClassType.SERVLET;
-            } else if (Agent.isServlet() && isServletFilter(c)) {
-              ct = ClassType.SERVLET_FILTER;
-            } else if (Agent.isJMX() && isJMXMBean(c)) {
-              ct = ClassType.JMX_MBEAN;
-            } else if (Agent.isJSF() && isJSFConverter(c)) {
-              ct = ClassType.JSF_CONVERTER;
-            } else if (Agent.isJSF() && isJSFManagedBean(c)) {
-              ct = ClassType.JSF_MANAGED_BEAN;
-            } else if (isThrowable(c)) {
-              ct = ClassType.THROWABLE;
-            } else if (Agent.isCORBA() && isCORBAServant(c)) {
-              ct = ClassType.CORBA_SERVANT;
-            } else if (Agent.isCORBA() && isCORBAObject(c)) {
-              ct = ClassType.CORBA_OBJECT;
-            } else if (Agent.isRMI() && isRMIServer(c)) {
-              ct = ClassType.RMI_SERVER;
-            } else if (Agent.isRMI() && isRMIRemote(c)) {
-              ct = ClassType.RMI_REMOTE;
-            }
-            
-            for (Plugin plugin : plugins) {
-              if (plugin.isSupported(c)) {
-                ct = plugin.getType(c);
-              }
-            }
+         for (Class c : loaded)
+         {
+            if (!c.isInterface() &&
+                  !c.isArray() && !c.isAnnotation() && !c.isSynthetic())
+            {
+               String className = c.getName().replace(".", "/");
+               if (((Agent.isPrecompiled() && Agent.approve(className)) || Agent.accept(className)) &&
+                     !processed.contains(className))
+               {
 
-            processed.add(className);
-            
-            ClassInfo ci = new ClassInfo(className, ct);
-            result.add(ci);
-          }
-        }
-      }
-    }
+                  int ct = ClassType.POJO;
 
-    webMap.clear();
-    jsfMap.clear();
-    
-    return result;
-  }
+                  if (Agent.isEJB() &&
+                        isSession(c))
+                  {
+                     ct = ClassType.EJB_SESSION;
+                  }
+                  else if (Agent.isEJB() &&
+                        isEntity(c))
+                  {
+                     ct = ClassType.EJB_ENTITY;
+                  }
+                  else if (Agent.isEJB() &&
+                        isMessage(c))
+                  {
+                     ct = ClassType.EJB_MESSAGE;
+                  }
+                  else if (Agent.isServlet() &&
+                        isJSP(c))
+                  {
+                     ct = ClassType.JSP;
+                  }
+                  else if (Agent.isServlet() &&
+                        isServlet(c))
+                  {
+                     ct = ClassType.SERVLET;
+                  }
+                  else if (Agent.isServlet() &&
+                        isServletFilter(c))
+                  {
+                     ct = ClassType.SERVLET_FILTER;
+                  }
+                  else if (Agent.isJMX() &&
+                        isJMXMBean(c))
+                  {
+                     ct = ClassType.JMX_MBEAN;
+                  }
+                  else if (Agent.isJSF() &&
+                        isJSFConverter(c))
+                  {
+                     ct = ClassType.JSF_CONVERTER;
+                  }
+                  else if (Agent.isJSF() &&
+                        isJSFManagedBean(c))
+                  {
+                     ct = ClassType.JSF_MANAGED_BEAN;
+                  }
+                  else if (isThrowable(c))
+                  {
+                     ct = ClassType.THROWABLE;
+                  }
+                  else if (Agent.isCORBA() &&
+                        isCORBAServant(c))
+                  {
+                     ct = ClassType.CORBA_SERVANT;
+                  }
+                  else if (Agent.isCORBA() &&
+                        isCORBAObject(c))
+                  {
+                     ct = ClassType.CORBA_OBJECT;
+                  }
+                  else if (Agent.isRMI() &&
+                        isRMIServer(c))
+                  {
+                     ct = ClassType.RMI_SERVER;
+                  }
+                  else if (Agent.isRMI() &&
+                        isRMIRemote(c))
+                  {
+                     ct = ClassType.RMI_REMOTE;
+                  }
 
-  /**
-   * Enterprise Session Bean
-   * @param clz The class
-   * @return True if session; otherwise false
-   */
-  private static boolean isSession(Class clz) {
-    if (clz != null) {
-      Annotation[] annotations = clz.getDeclaredAnnotations();
-      for (Annotation ca : annotations) {
-        if (ca.annotationType().getName().startsWith("javax.ejb.Stateful") ||
-            ca.annotationType().getName().startsWith("javax.ejb.Stateless")) {
-          return true;
-        }
-      }
+                  for (Plugin plugin : plugins)
+                  {
+                     if (plugin.isSupported(c))
+                     {
+                        ct = plugin.getType(c);
+                     }
+                  }
 
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("javax.ejb.SessionBean")) {
-          return true;
-        }
+                  processed.add(className);
+
+                  ClassInfo ci = new ClassInfo(className, ct);
+                  result.add(ci);
+               }
+            }
+         }
       }
 
-      return isSession(clz.getSuperclass());
-    }
+      webMap.clear();
+      jsfMap.clear();
 
-    return false;
-  }
+      return result;
+   }
 
-  /**
-   * Enterprise Entity Bean
-   * @param clz The class
-   * @return True if entity; otherwise false
-   */
-  private static boolean isEntity(Class clz) {
-    if (clz != null) {
-      Annotation[] annotations = clz.getDeclaredAnnotations();
-      for (Annotation ca : annotations) {
-        if (ca.annotationType().getName().startsWith("javax.persistence.Entity")) {
-          return true;
-        }
-      }
+   /**
+    * Enterprise Session Bean
+    * @param clz The class
+    * @return True if session; otherwise false
+    */
+   private static boolean isSession(Class clz)
+   {
+      if (clz != null)
+      {
+         Annotation[] annotations = clz.getDeclaredAnnotations();
+         for (Annotation ca : annotations)
+         {
+            if (ca.annotationType().getName().startsWith("javax.ejb.Stateful") ||
+                  ca.annotationType().getName().startsWith("javax.ejb.Stateless"))
+            {
+               return true;
+            }
+         }
 
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("javax.ejb.EntityBean")) {
-          return true;
-        }
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("javax.ejb.SessionBean"))
+            {
+               return true;
+            }
+         }
+
+         return isSession(clz.getSuperclass());
       }
 
-      return isEntity(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * Enterprise Entity Bean
+    * @param clz The class
+    * @return True if entity; otherwise false
+    */
+   private static boolean isEntity(Class clz)
+   {
+      if (clz != null)
+      {
+         Annotation[] annotations = clz.getDeclaredAnnotations();
+         for (Annotation ca : annotations)
+         {
+            if (ca.annotationType().getName().startsWith("javax.persistence.Entity"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * Enterprise Message Bean
-   * @param clz The class
-   * @return True if message; otherwise false
-   */
-  private static boolean isMessage(Class clz) {
-    if (clz != null) {
-      Annotation[] annotations = clz.getDeclaredAnnotations();
-      for (Annotation ca : annotations) {
-        if (ca.annotationType().getName().startsWith("javax.ejb.MessageDriven")) {
-          return true;
-        }
-      }
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("javax.ejb.EntityBean"))
+            {
+               return true;
+            }
+         }
 
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("javax.ejb.MessageDrivenBean")) {
-          return true;
-        }
+         return isEntity(clz.getSuperclass());
       }
 
-      return isMessage(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * Enterprise Message Bean
+    * @param clz The class
+    * @return True if message; otherwise false
+    */
+   private static boolean isMessage(Class clz)
+   {
+      if (clz != null)
+      {
+         Annotation[] annotations = clz.getDeclaredAnnotations();
+         for (Annotation ca : annotations)
+         {
+            if (ca.annotationType().getName().startsWith("javax.ejb.MessageDriven"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * Servlet
-   * @param clz The class
-   * @return True if servlet; otherwise false
-   */
-  private static boolean isServlet(Class clz) {
-    if (clz != null) {
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("javax.servlet.Servlet")) {
-          return true;
-        }
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("javax.ejb.MessageDrivenBean"))
+            {
+               return true;
+            }
+         }
+
+         return isMessage(clz.getSuperclass());
       }
 
-      return isServlet(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * Servlet
+    * @param clz The class
+    * @return True if servlet; otherwise false
+    */
+   private static boolean isServlet(Class clz)
+   {
+      if (clz != null)
+      {
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("javax.servlet.Servlet"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * Servlet filter
-   * @param clz The class
-   * @return True if servlet; otherwise false
-   */
-  private static boolean isServletFilter(Class clz) {
-    if (clz != null) {
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("javax.servlet.Filter")) {
-          return true;
-        }
+         return isServlet(clz.getSuperclass());
       }
 
-      return isServletFilter(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * Servlet filter
+    * @param clz The class
+    * @return True if servlet; otherwise false
+    */
+   private static boolean isServletFilter(Class clz)
+   {
+      if (clz != null)
+      {
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("javax.servlet.Filter"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * JSP
-   * @param clz The class
-   * @return True if JSP; otherwise false
-   */
-  private static boolean isJSP(Class clz) {
-    if (clz != null) {
-      if (clz.getName().startsWith("org.apache.jsp")) {
-        return true;
+         return isServletFilter(clz.getSuperclass());
       }
-    }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * JMX: MBean
-   * @param clz The class
-   * @return True if mbean; otherwise false
-   */
-  private static boolean isJMXMBean(Class clz) {
-    if (clz != null) {
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().endsWith("MBean")) {
-          return true;
-        }
+   /**
+    * JSP
+    * @param clz The class
+    * @return True if JSP; otherwise false
+    */
+   private static boolean isJSP(Class clz)
+   {
+      if (clz != null)
+      {
+         if (clz.getName().startsWith("org.apache.jsp"))
+         {
+            return true;
+         }
       }
 
-      return isJMXMBean(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * JMX: MBean
+    * @param clz The class
+    * @return True if mbean; otherwise false
+    */
+   private static boolean isJMXMBean(Class clz)
+   {
+      if (clz != null)
+      {
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().endsWith("MBean"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * JavaServer Faces: Converter
-   * @param clz The class
-   * @return True if converter; otherwise false
-   */
-  private static boolean isJSFConverter(Class clz) {
-    if (clz != null) {
-      loadJSFConfig(clz);
+         return isJMXMBean(clz.getSuperclass());
+      }
 
-      Map<Integer, List<String>> m = jsfMap.get(clz.getClassLoader());
-      if (m != null) {
-        List<String> result = m.get(Integer.valueOf(ClassType.JSF_CONVERTER));
-        if (result != null) {
-          for (String cn : result) {
-            if (cn.equals(clz.getName())) {
-              return true;
+      return false;
+   }
+
+   /**
+    * JavaServer Faces: Converter
+    * @param clz The class
+    * @return True if converter; otherwise false
+    */
+   private static boolean isJSFConverter(Class clz)
+   {
+      if (clz != null)
+      {
+         loadJSFConfig(clz);
+
+         Map<Integer, List<String>> m = jsfMap.get(clz.getClassLoader());
+         if (m != null)
+         {
+            List<String> result = m.get(Integer.valueOf(ClassType.JSF_CONVERTER));
+            if (result != null)
+            {
+               for (String cn : result)
+               {
+                  if (cn.equals(clz.getName()))
+                  {
+                     return true;
+                  }
+               }
             }
-          }
-        }
+         }
       }
-    }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * JavaServer Faces: Managed bean
-   * @param clz The class
-   * @return True if managed bean; otherwise false
-   */
-  private static boolean isJSFManagedBean(Class clz) {
-    if (clz != null) {
-      loadJSFConfig(clz);
+   /**
+    * JavaServer Faces: Managed bean
+    * @param clz The class
+    * @return True if managed bean; otherwise false
+    */
+   private static boolean isJSFManagedBean(Class clz)
+   {
+      if (clz != null)
+      {
+         loadJSFConfig(clz);
 
-      Map<Integer, List<String>> m = jsfMap.get(clz.getClassLoader());
-      if (m != null) {
-        List<String> result = m.get(Integer.valueOf(ClassType.JSF_MANAGED_BEAN));
-        if (result != null) {
-          for (String cn : result) {
-            if (cn.equals(clz.getName())) {
-              return true;
+         Map<Integer, List<String>> m = jsfMap.get(clz.getClassLoader());
+         if (m != null)
+         {
+            List<String> result = m.get(Integer.valueOf(ClassType.JSF_MANAGED_BEAN));
+            if (result != null)
+            {
+               for (String cn : result)
+               {
+                  if (cn.equals(clz.getName()))
+                  {
+                     return true;
+                  }
+               }
             }
-          }
-        }
+         }
       }
-    }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Load web.xml
-   * @param clz The class
-   */
-  private static void loadWebXml(Class clz) {
-    InputStream web = null;
-    try {
-      ClassLoader cl = clz.getClassLoader();
+   /**
+    * Load web.xml
+    * @param clz The class
+    */
+   private static void loadWebXml(Class clz)
+   {
+      InputStream web = null;
+      try
+      {
+         ClassLoader cl = clz.getClassLoader();
 
-      if (webMap.containsKey(cl)) {
-        return;
-      }
+         if (webMap.containsKey(cl))
+         {
+            return;
+         }
 
-      web = cl.getResourceAsStream("WEB-INF/web.xml");
-      
-      while (web == null && cl != null) {
-        cl = cl.getParent();
-        if (cl != null) {
-          web = cl.getResourceAsStream("WEB-INF/web.xml");
-        }
-      }
-      
-      if (web != null) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Document wd = db.parse(web);
+         web = cl.getResourceAsStream("WEB-INF/web.xml");
 
-        String path = null;
+         while (web == null &&
+               cl != null)
+         {
+            cl = cl.getParent();
+            if (cl != null)
+            {
+               web = cl.getResourceAsStream("WEB-INF/web.xml");
+            }
+         }
 
-        NodeList nl = wd.getElementsByTagName("context-param");
-          
-        for (int i = 0; path == null && i < nl.getLength(); i++) {
-          Node n = nl.item(i);
-          boolean insert = false;
-          
-          NodeList children = n.getChildNodes();
-          for (int j = 0; j < children.getLength(); j++) {
-            Node child = children.item(j);
-            if ("param-name".equals(child.getNodeName()) &&
-                "javax.faces.CONFIG_FILES".equals(child.getTextContent())) {
-              insert = true;
-            } else if (insert && "param-value".equals(child.getNodeName())) {
-              path = child.getTextContent();
-              if (path.startsWith("/")) {
-                path = path.substring(1);
-              }
-              insert = false;
+         if (web != null)
+         {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document wd = db.parse(web);
+
+            String path = null;
+
+            NodeList nl = wd.getElementsByTagName("context-param");
+
+            for (int i = 0; path == null &&
+                  i < nl.getLength(); i++)
+            {
+               Node n = nl.item(i);
+               boolean insert = false;
+
+               NodeList children = n.getChildNodes();
+               for (int j = 0; j < children.getLength(); j++)
+               {
+                  Node child = children.item(j);
+                  if ("param-name".equals(child.getNodeName()) &&
+                        "javax.faces.CONFIG_FILES".equals(child.getTextContent()))
+                  {
+                     insert = true;
+                  }
+                  else if (insert &&
+                        "param-value".equals(child.getNodeName()))
+                  {
+                     path = child.getTextContent();
+                     if (path.startsWith("/"))
+                     {
+                        path = path.substring(1);
+                     }
+                     insert = false;
+                  }
+               }
             }
-          }
-        }
-        
-        webMap.put(clz.getClassLoader(), path);
+
+            webMap.put(clz.getClassLoader(), path);
+         }
+
       }
-      
-    } catch (Exception e) {
-      //
-    } finally {
-      if (web != null) {
-        try {
-          web.close();
-        } catch (IOException ioe) {
-          //
-        }
+      catch (Exception e)
+      {
+         //
       }
-    }
-  }
+      finally
+      {
+         if (web != null)
+         {
+            try
+            {
+               web.close();
+            }
+            catch (IOException ioe)
+            {
+               //
+            }
+         }
+      }
+   }
 
-  /**
-   * Load JSF configuration
-   * @param clz The class
-   */
-  private static void loadJSFConfig(Class clz) {
-    InputStream jsf = null;
-    try {
-      ClassLoader cl = clz.getClassLoader();
+   /**
+    * Load JSF configuration
+    * @param clz The class
+    */
+   private static void loadJSFConfig(Class clz)
+   {
+      InputStream jsf = null;
+      try
+      {
+         ClassLoader cl = clz.getClassLoader();
 
-      if (jsfMap.containsKey(cl)) {
-        return;
-      }
+         if (jsfMap.containsKey(cl))
+         {
+            return;
+         }
 
-      loadWebXml(clz);
+         loadWebXml(clz);
 
-      String path = webMap.get(cl);
+         String path = webMap.get(cl);
 
-      if (path == null || path.trim().equals("")) {
-        return;
-      }
+         if (path == null ||
+               path.trim().equals(""))
+         {
+            return;
+         }
 
-      jsf = cl.getResourceAsStream(path);
+         jsf = cl.getResourceAsStream(path);
 
-      while (jsf == null && cl != null) {
-        cl = cl.getParent();
-        if (cl != null) {
-          jsf = cl.getResourceAsStream(path);
-        }
-      }
-        
-      if (jsf != null) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Document jd = db.parse(jsf);
+         while (jsf == null &&
+               cl != null)
+         {
+            cl = cl.getParent();
+            if (cl != null)
+            {
+               jsf = cl.getResourceAsStream(path);
+            }
+         }
 
-        Map<Integer, List<String>> result = new HashMap<Integer, List<String>>();
+         if (jsf != null)
+         {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document jd = db.parse(jsf);
 
-        List<String> l = new ArrayList<String>();
-          
-        NodeList nl = jd.getElementsByTagName("converter-class");
-          
-        for (int i = 0; i < nl.getLength(); i++) {
-          Node n = nl.item(i);
-          l.add(n.getTextContent());
-        }
+            Map<Integer, List<String>> result = new HashMap<Integer, List<String>>();
 
-        if (!l.isEmpty()) {
-          result.put(Integer.valueOf(ClassType.JSF_CONVERTER), l);
-        }
+            List<String> l = new ArrayList<String>();
 
-        l = new ArrayList<String>();
-          
-        nl = jd.getElementsByTagName("managed-bean-class");
-          
-        for (int i = 0; i < nl.getLength(); i++) {
-          Node n = nl.item(i);
-          l.add(n.getTextContent());
-        }
+            NodeList nl = jd.getElementsByTagName("converter-class");
 
-        if (!l.isEmpty()) {
-          result.put(Integer.valueOf(ClassType.JSF_MANAGED_BEAN), l);
-        }
+            for (int i = 0; i < nl.getLength(); i++)
+            {
+               Node n = nl.item(i);
+               l.add(n.getTextContent());
+            }
 
-        jsfMap.put(clz.getClassLoader(), result);
-      }
+            if (!l.isEmpty())
+            {
+               result.put(Integer.valueOf(ClassType.JSF_CONVERTER), l);
+            }
 
-    } catch (Exception e) {
-      //
-    } finally {
-      if (jsf != null) {
-        try {
-          jsf.close();
-        } catch (IOException ioe) {
-          //
-        }
+            l = new ArrayList<String>();
+
+            nl = jd.getElementsByTagName("managed-bean-class");
+
+            for (int i = 0; i < nl.getLength(); i++)
+            {
+               Node n = nl.item(i);
+               l.add(n.getTextContent());
+            }
+
+            if (!l.isEmpty())
+            {
+               result.put(Integer.valueOf(ClassType.JSF_MANAGED_BEAN), l);
+            }
+
+            jsfMap.put(clz.getClassLoader(), result);
+         }
+
       }
-    }
-  }
+      catch (Exception e)
+      {
+         //
+      }
+      finally
+      {
+         if (jsf != null)
+         {
+            try
+            {
+               jsf.close();
+            }
+            catch (IOException ioe)
+            {
+               //
+            }
+         }
+      }
+   }
 
-  /**
-   * Throwable
-   * @param clz The class
-   * @return True if throwable; otherwise false
-   */
-  private static boolean isThrowable(Class clz) {
-    if (clz != null) {
-      if (clz.getName().startsWith("java.lang.Throwable")) {
-        return true;
+   /**
+    * Throwable
+    * @param clz The class
+    * @return True if throwable; otherwise false
+    */
+   private static boolean isThrowable(Class clz)
+   {
+      if (clz != null)
+      {
+         if (clz.getName().startsWith("java.lang.Throwable"))
+         {
+            return true;
+         }
+
+         return isThrowable(clz.getSuperclass());
       }
 
-      return isThrowable(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * CORBA: Object
+    * @param clz The class
+    * @return True if CORBA object; otherwise false
+    */
+   private static boolean isCORBAObject(Class clz)
+   {
+      if (clz != null)
+      {
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("org.omg.CORBA.Object"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * CORBA: Object
-   * @param clz The class
-   * @return True if CORBA object; otherwise false
-   */
-  private static boolean isCORBAObject(Class clz) {
-    if (clz != null) {
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("org.omg.CORBA.Object")) {
-          return true;
-        }
+         return isCORBAObject(clz.getSuperclass());
       }
 
-      return isCORBAObject(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * CORBA: Servant
+    * @param clz The class
+    * @return True if CORBA servant; otherwise false
+    */
+   private static boolean isCORBAServant(Class clz)
+   {
+      if (clz != null)
+      {
+         if (clz.getName().startsWith("org.omg.CORBA.portable.Servant"))
+         {
+            return true;
+         }
 
-  /**
-   * CORBA: Servant
-   * @param clz The class
-   * @return True if CORBA servant; otherwise false
-   */
-  private static boolean isCORBAServant(Class clz) {
-    if (clz != null) {
-      if (clz.getName().startsWith("org.omg.CORBA.portable.Servant")) {
-        return true;
+         return isCORBAServant(clz.getSuperclass());
       }
 
-      return isCORBAServant(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * RMI: Server
+    * @param clz The class
+    * @return True if server; otherwise false
+    */
+   private static boolean isRMIServer(Class clz)
+   {
+      if (clz != null)
+      {
+         if (clz.getName().startsWith("java.rmi.server.RemoteServer"))
+         {
+            return true;
+         }
 
-  /**
-   * RMI: Server
-   * @param clz The class
-   * @return True if server; otherwise false
-   */
-  private static boolean isRMIServer(Class clz) {
-    if (clz != null) {
-      if (clz.getName().startsWith("java.rmi.server.RemoteServer")) {
-        return true;
+         return isRMIServer(clz.getSuperclass());
       }
 
-      return isRMIServer(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * RMI: Remote
+    * @param clz The class
+    * @return True if remote; otherwise false
+    */
+   private static boolean isRMIRemote(Class clz)
+   {
+      if (clz != null)
+      {
+         Class[] interfaces = clz.getInterfaces();
+         for (Class cint : interfaces)
+         {
+            if (cint.getName().startsWith("java.rmi.Remote"))
+            {
+               return true;
+            }
+         }
 
-  /**
-   * RMI: Remote
-   * @param clz The class
-   * @return True if remote; otherwise false
-   */
-  private static boolean isRMIRemote(Class clz) {
-    if (clz != null) {
-      Class[] interfaces = clz.getInterfaces();
-      for (Class cint : interfaces) {
-        if (cint.getName().startsWith("java.rmi.Remote")) {
-          return true;
-        }
+         return isRMIRemote(clz.getSuperclass());
       }
 
-      return isRMIRemote(clz.getSuperclass());
-    }
-
-    return false;
-  }
+      return false;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ExceptionInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ExceptionInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ExceptionInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,48 +25,54 @@
  * Represents an exception
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ExceptionInfo {
+public class ExceptionInfo
+{
 
-  /** The type */
-  private String type;
-  
-  /**
-   * Constructor
-   * @param type The type
-   */
-  public ExceptionInfo(String type) {
-    this.type = type;
-  }
+   /** The type */
+   private String type;
 
-  /**
-   * Get the type
-   * @return The type
-   */
-  public String getType() {
-    return type;
-  }
+   /**
+    * Constructor
+    * @param type The type
+    */
+   public ExceptionInfo(String type)
+   {
+      this.type = type;
+   }
 
-  /**
-   * Equals
-   * @param other The other object
-   * @return True if equal; otherwise false
-   */
-  @Override
-  public boolean equals(Object other) {
-    if (!(other instanceof ExceptionInfo)) {
-      return false;
-    }
+   /**
+    * Get the type
+    * @return The type
+    */
+   public String getType()
+   {
+      return type;
+   }
 
-    ExceptionInfo ei = (ExceptionInfo)other;
-    return this.type.equals(ei.getType());
-  }
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+      if (!(other instanceof ExceptionInfo))
+      {
+         return false;
+      }
 
-  /**
-   * Hash code
-   * @return The hash code
-   */
-  @Override
-  public int hashCode() {
-    return type.hashCode();
-  }
+      ExceptionInfo ei = (ExceptionInfo)other;
+      return this.type.equals(ei.getType());
+   }
+
+   /**
+    * Hash code
+    * @return The hash code
+    */
+   @Override
+   public int hashCode()
+   {
+      return type.hashCode();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -40,183 +40,221 @@
  * Implements the Javssist based transformer
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class JavassistTransformer extends AbstractTransformer {
+public class JavassistTransformer extends AbstractTransformer
+{
 
-  /** Prefix */
-  private static final String PREFIX = "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread())";
+   /** Prefix */
+   private static final String PREFIX = "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread())";
 
-  /** */
-  private static final String CODE = "{" + PREFIX + ".beginWait(); $_ = $proceed($$); " + PREFIX + ".endWait();}";
+   /** */
+   private static final String CODE = "{" +
+         PREFIX + ".beginWait(); $_ = $proceed($$); " + PREFIX + ".endWait();}";
 
-  /** The class pool */
-  private ClassPool pool;
+   /** The class pool */
+   private ClassPool pool;
 
-  /**
-   * Constructor
-   */
-  public JavassistTransformer() {
-    pool = ClassPool.getDefault();
+   /**
+    * Constructor
+    */
+   public JavassistTransformer()
+   {
+      pool = ClassPool.getDefault();
 
-    //setup();
-  }
+      // setup();
+   }
 
-  /**
-   * Generate instrumented class
-   * @param className The class name
-   * @param ob The original bytes
-   * @return The instrumented bytes
-   * @exception IOException If an error occurs
-   */
-  protected byte[] generateInstrumented(String className, byte[] ob) throws IOException {
-    ByteArrayInputStream bis = null;
-    try {
-      bis = new ByteArrayInputStream(ob);
+   /**
+    * Generate instrumented class
+    * @param className The class name
+    * @param ob The original bytes
+    * @return The instrumented bytes
+    * @exception IOException If an error occurs
+    */
+   protected byte[] generateInstrumented(String className, byte[] ob) throws IOException
+   {
+      ByteArrayInputStream bis = null;
+      try
+      {
+         bis = new ByteArrayInputStream(ob);
 
-      Visibility v = Agent.getVisibility(className);
-      
-      CtClass cc = pool.makeClass(bis);
-      CtConstructor[] constructors =  cc.getDeclaredConstructors();
-      for (int i = 0; i < constructors.length; i++) {
-        CtConstructor constructor = constructors[i];
-        instrumentConstructor(constructor, className, v);
-      }
+         Visibility v = Agent.getVisibility(className);
 
-      CtMethod[] methods =  cc.getDeclaredMethods();
-      for (int i = 0; i < methods.length; i++) {
-        CtMethod method = methods[i];
-        instrumentMethod(method, className, v);
-      }
+         CtClass cc = pool.makeClass(bis);
+         CtConstructor[] constructors = cc.getDeclaredConstructors();
+         for (int i = 0; i < constructors.length; i++)
+         {
+            CtConstructor constructor = constructors[i];
+            instrumentConstructor(constructor, className, v);
+         }
 
-      return cc.toBytecode();
+         CtMethod[] methods = cc.getDeclaredMethods();
+         for (int i = 0; i < methods.length; i++)
+         {
+            CtMethod method = methods[i];
+            instrumentMethod(method, className, v);
+         }
 
-    } catch (Exception e) {
-      IOException ioe = new IOException(e.getMessage());
-      ioe.initCause(e);
-      throw ioe;
-    } finally {
-      if (bis != null) {
-        try {
-          bis.close();
-        } catch (IOException ioe) {
-          // Ignore
-        }
+         return cc.toBytecode();
+
       }
-    }
-  }
+      catch (Exception e)
+      {
+         IOException ioe = new IOException(e.getMessage());
+         ioe.initCause(e);
+         throw ioe;
+      }
+      finally
+      {
+         if (bis != null)
+         {
+            try
+            {
+               bis.close();
+            }
+            catch (IOException ioe)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 
-  /**
-   * Instrument constructor
-   * @param constructor The constructor
-   * @param className The class name
-   * @param v The visibility
-   * @exception CannotCompileException If the constructor cant be modified
-   */
-  private void instrumentConstructor(CtConstructor constructor, 
-                                     String className, 
-                                     Visibility v) 
-    throws CannotCompileException {
+   /**
+    * Instrument constructor
+    * @param constructor The constructor
+    * @param className The class name
+    * @param v The visibility
+    * @exception CannotCompileException If the constructor cant be modified
+    */
+   private void instrumentConstructor(CtConstructor constructor, String className, Visibility v)
+      throws CannotCompileException
+   {
 
-    if (!constructor.isClassInitializer()) {
-      boolean include = true;
-      
-      if (Modifier.isPrivate(constructor.getModifiers())) {
-        if (v == Visibility.PROTECTED ||
-            v == Visibility.PACKAGE ||
-            v == Visibility.PUBLIC) {
-          include = false;
-        }
-      } else if (Modifier.isProtected(constructor.getModifiers())) {
-        if (v == Visibility.PACKAGE ||
-            v == Visibility.PUBLIC) {
-          include = false;
-        }
-      } else if (Modifier.isPackage(constructor.getModifiers())) {
-        if (v == Visibility.PUBLIC) {
-          include = false;
-        }
-      }
-      // Modifier.PUBLIC -- no need to check for method visibility
-      
-      if (include) {
-        constructor.insertBeforeBody("{ " +
-                                     PREFIX + ".allocation(\"" + className + "\");" +
-                                     PREFIX + ".start(\"" + className + "\", \"" + constructor.getLongName() + "\");" +
-                                     " }");
+      if (!constructor.isClassInitializer())
+      {
+         boolean include = true;
 
-        constructor.insertAfter("{ " +
-                                PREFIX + ".end(\"" + className + "\", \"" + constructor.getLongName() + "\");" +
-                                " }", true);
-        
-        setup(constructor);
+         if (Modifier.isPrivate(constructor.getModifiers()))
+         {
+            if (v == Visibility.PROTECTED ||
+                  v == Visibility.PACKAGE || v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         else if (Modifier.isProtected(constructor.getModifiers()))
+         {
+            if (v == Visibility.PACKAGE ||
+                  v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         else if (Modifier.isPackage(constructor.getModifiers()))
+         {
+            if (v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         // Modifier.PUBLIC -- no need to check for method visibility
+
+         if (include)
+         {
+            constructor.insertBeforeBody("{ " +
+                  PREFIX + ".allocation(\"" + className + "\");" + PREFIX + ".start(\"" + className + "\", \"" +
+                  constructor.getLongName() + "\");" + " }");
+
+            constructor.insertAfter("{ " +
+                  PREFIX + ".end(\"" + className + "\", \"" + constructor.getLongName() + "\");" + " }", true);
+
+            setup(constructor);
+         }
       }
-    }
-  }
+   }
 
-  /**
-   * Instrument method
-   * @param method The method
-   * @param className The class name
-   * @param v The visibility
-   * @exception CannotCompileException If the constructor cant be modified
-   */
-  private void instrumentMethod(CtMethod method, String className, Visibility v) throws CannotCompileException {
-    boolean include = true;
-      
-    if (Modifier.isPrivate(method.getModifiers())) {
-      if (v == Visibility.PROTECTED ||
-          v == Visibility.PACKAGE ||
-          v == Visibility.PUBLIC) {
-        include = false;
+   /**
+    * Instrument method
+    * @param method The method
+    * @param className The class name
+    * @param v The visibility
+    * @exception CannotCompileException If the constructor cant be modified
+    */
+   private void instrumentMethod(CtMethod method, String className, Visibility v) throws CannotCompileException
+   {
+      boolean include = true;
+
+      if (Modifier.isPrivate(method.getModifiers()))
+      {
+         if (v == Visibility.PROTECTED ||
+               v == Visibility.PACKAGE || v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    } else if (Modifier.isProtected(method.getModifiers())) {
-      if (v == Visibility.PACKAGE ||
-          v == Visibility.PUBLIC) {
-        include = false;
+      else if (Modifier.isProtected(method.getModifiers()))
+      {
+         if (v == Visibility.PACKAGE ||
+               v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    } else if (Modifier.isPackage(method.getModifiers())) {
-      if (v == Visibility.PUBLIC) {
-        include = false;
+      else if (Modifier.isPackage(method.getModifiers()))
+      {
+         if (v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    }
-    // Modifier.PUBLIC -- no need to check for method visibility
-    
-    if (include) {
-      method.insertBefore("{ " +
-                          PREFIX + ".start(\"" + className + "\", \"" + method.getLongName() + "\");" +
-                          " }");
-      
-      method.insertAfter("{ " +
-                         PREFIX + ".end(\"" + className + "\", \"" + method.getLongName() + "\");" +
-                         " }", true);
+      // Modifier.PUBLIC -- no need to check for method visibility
 
-      setup(method);
-    }
-  }
+      if (include)
+      {
+         method.insertBefore("{ " +
+               PREFIX + ".start(\"" + className + "\", \"" + method.getLongName() + "\");" + " }");
 
-  /**
-   * Setup the beginWait/endWait methods
-   * @param ctb The behavior
-   */
-  private void setup(CtBehavior ctb) {
-    try {
-      ctb.instrument(new ExprEditor() {
-          public void edit(MethodCall m) throws CannotCompileException {
-            if ("java.lang.Object".equals(m.getClassName())) {
-              if ("wait".equals(m.getMethodName())) {
-                m.replace(CODE);
-              }
-            } else if ("java.lang.Thread".equals(m.getClassName())) {
-              if ("join".equals(m.getMethodName()) ||
-                  "sleep".equals(m.getMethodName()) ||
-                  "yield".equals(m.getMethodName())) {
-                m.replace(CODE);
-              }
+         method.insertAfter("{ " +
+               PREFIX + ".end(\"" + className + "\", \"" + method.getLongName() + "\");" + " }", true);
+
+         setup(method);
+      }
+   }
+
+   /**
+    * Setup the beginWait/endWait methods
+    * @param ctb The behavior
+    */
+   private void setup(CtBehavior ctb)
+   {
+      try
+      {
+         ctb.instrument(new ExprEditor()
+         {
+            public void edit(MethodCall m) throws CannotCompileException
+            {
+               if ("java.lang.Object".equals(m.getClassName()))
+               {
+                  if ("wait".equals(m.getMethodName()))
+                  {
+                     m.replace(CODE);
+                  }
+               }
+               else if ("java.lang.Thread".equals(m.getClassName()))
+               {
+                  if ("join".equals(m.getMethodName()) ||
+                        "sleep".equals(m.getMethodName()) || "yield".equals(m.getMethodName()))
+                  {
+                     m.replace(CODE);
+                  }
+               }
             }
-          }
-        });
+         });
 
-    } catch (Exception e) {
-      e.printStackTrace(System.err);
-    }
-  }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace(System.err);
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/NopProfilerThreadImpl.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/NopProfilerThreadImpl.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/NopProfilerThreadImpl.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,46 +25,53 @@
  * The no operation profiler thread implementation
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class NopProfilerThreadImpl implements ProfilerThread {
+public class NopProfilerThreadImpl implements ProfilerThread
+{
 
-  /**
-   * Constructor
-   */
-  NopProfilerThreadImpl() {
-  }
+   /**
+    * Constructor
+    */
+   NopProfilerThreadImpl()
+   {
+   }
 
-  /**
-   * Register start time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void start(String className, String methodName) {
-  }
-  
-  /**
-   * Register end time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void end(String className, String methodName) {
-  }
-  
-  /**
-   * Register start wait time for a method
-   */
-  public void beginWait() {
-  }
-  
-  /**
-   * Register end wait time for a method
-   */
-  public void endWait() {
-  }
-  
-  /**
-   * Class allocation
-   * @param className The class being allocated
-   */
-  public void allocation(String className) {
-  }
+   /**
+    * Register start time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void start(String className, String methodName)
+   {
+   }
+
+   /**
+    * Register end time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void end(String className, String methodName)
+   {
+   }
+
+   /**
+    * Register start wait time for a method
+    */
+   public void beginWait()
+   {
+   }
+
+   /**
+    * Register end wait time for a method
+    */
+   public void endWait()
+   {
+   }
+
+   /**
+    * Class allocation
+    * @param className The class being allocated
+    */
+   public void allocation(String className)
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -23,24 +23,16 @@
 
 import org.jboss.profiler.shared.AllocationInfo;
 import org.jboss.profiler.shared.ClassInfo;
-import org.jboss.profiler.shared.FrameHelper;
-import org.jboss.profiler.shared.FrameInfo;
-import org.jboss.profiler.shared.MethodInfo;
 import org.jboss.profiler.shared.MethodRepository;
 import org.jboss.profiler.shared.Snapshot;
 import org.jboss.profiler.shared.SnapshotHelper;
-import org.jboss.profiler.shared.ThreadHelper;
 import org.jboss.profiler.shared.ThreadInfo;
 
 import java.io.File;
-import java.io.IOException;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -54,295 +46,342 @@
  * The profiler
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Profiler {
+public class Profiler
+{
 
-  /** The class name */
-  public static final String CLASSNAME = "org/jboss/profiler/agent/Profiler"; 
+   /** The class name */
+   public static final String CLASSNAME = "org/jboss/profiler/agent/Profiler";
 
-  /** NOP profiler thread */
-  private static final NopProfilerThreadImpl NOP_PROFILER_THREAD = new NopProfilerThreadImpl();
+   /** NOP profiler thread */
+   private static final NopProfilerThreadImpl NOP_PROFILER_THREAD = new NopProfilerThreadImpl();
 
-  /** The profiler threads map */
-  private static ConcurrentMap<Long, ProfilerThreadImpl> profilerThreadMap;
+   /** The profiler threads map */
+   private static ConcurrentMap<Long, ProfilerThreadImpl> profilerThreadMap;
 
-  /** The from date */
-  private static Date from;
+   /** The from date */
+   private static Date from;
 
-  /** The current top level directory */
-  private static File root;
+   /** The current top level directory */
+   private static File root;
 
-  /** The snapshots */
-  private static List<Snapshot> snapshots = new ArrayList<Snapshot>();
+   /** The snapshots */
+   private static List<Snapshot> snapshots = new ArrayList<Snapshot>();
 
-  /** Lock */
-  private static Object lock = new Object();
-  
-  /** Running */
-  private static AtomicBoolean running = new AtomicBoolean(false);
+   /** Lock */
+   private static Object lock = new Object();
 
-  /** Method repository */
-  private static MethodRepository methodRepository;
+   /** Running */
+   private static AtomicBoolean running = new AtomicBoolean(false);
 
-  /**
-   * Constructor
-   */
-  private Profiler() {
-  }
+   /** Method repository */
+   private static MethodRepository methodRepository;
 
-  /**
-   * Start the profiler
-   */
-  public static void startProfiler() {
-    synchronized (lock) {
-      profilerThreadMap = new ConcurrentHashMap<Long, ProfilerThreadImpl>();
-      from = new Date();
+   /**
+    * Constructor
+    */
+   private Profiler()
+   {
+   }
 
-      methodRepository = new MethodRepository();
+   /**
+    * Start the profiler
+    */
+   public static void startProfiler()
+   {
+      synchronized (lock)
+      {
+         profilerThreadMap = new ConcurrentHashMap<Long, ProfilerThreadImpl>();
+         from = new Date();
 
-      if (!Agent.isMemoryStore()) {
-        Calendar c = Calendar.getInstance();
-        DecimalFormat df = new DecimalFormat("00");
-        DecimalFormat df3 = new DecimalFormat("000");
-        StringBuffer sb = new StringBuffer();
-              
-        c.setTime(from);
+         methodRepository = new MethodRepository();
 
-        sb = sb.append(Agent.getFileStoreLocation());
-        
-        sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
-        sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
-        sb = sb.append(df.format(c.get(Calendar.DATE)));
-        sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
-        sb = sb.append(df.format(c.get(Calendar.MINUTE)));
-        sb = sb.append(df.format(c.get(Calendar.SECOND)));
-        sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
-        
-        sb = sb.append(File.separator);
+         if (!Agent.isMemoryStore())
+         {
+            Calendar c = Calendar.getInstance();
+            DecimalFormat df = new DecimalFormat("00");
+            DecimalFormat df3 = new DecimalFormat("000");
+            StringBuffer sb = new StringBuffer();
 
-        root = new File(sb.toString());
-        root.mkdirs();
+            c.setTime(from);
+
+            sb = sb.append(Agent.getFileStoreLocation());
+
+            sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
+            sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
+            sb = sb.append(df.format(c.get(Calendar.DATE)));
+            sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
+            sb = sb.append(df.format(c.get(Calendar.MINUTE)));
+            sb = sb.append(df.format(c.get(Calendar.SECOND)));
+            sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
+
+            sb = sb.append(File.separator);
+
+            root = new File(sb.toString());
+            root.mkdirs();
+         }
+
+         running.set(true);
       }
+   }
 
-      running.set(true);
-    }
-  }
+   /**
+    * Stop the profiler
+    */
+   public static void stopProfiler()
+   {
+      synchronized (lock)
+      {
+         if (running.get())
+         {
+            for (ProfilerThreadImpl pti : profilerThreadMap.values())
+            {
+               pti.closeFrames();
+            }
 
-  /**
-   * Stop the profiler
-   */
-  public static void stopProfiler() {
-    synchronized (lock) {
-      if (running.get()) {
-        for (ProfilerThreadImpl pti : profilerThreadMap.values()) {
-          pti.closeFrames();
-        }
-      
-        Date to = new Date();
-        List<ClassInfo> classList = ClassUtil.getClasses();
+            Date to = new Date();
+            List<ClassInfo> classList = ClassUtil.getClasses();
 
-        if (Agent.isMemoryStore()) {
-          List<ThreadInfo> threadInfos = new ArrayList<ThreadInfo>();
-          Map<String, AllocationInfo> allocationInfos = new HashMap<String, AllocationInfo>();
+            if (Agent.isMemoryStore())
+            {
+               List<ThreadInfo> threadInfos = new ArrayList<ThreadInfo>();
+               Map<String, AllocationInfo> allocationInfos = new HashMap<String, AllocationInfo>();
 
-          for (ProfilerThreadImpl pti : profilerThreadMap.values()) {
-            threadInfos.add(pti.getThreadInfo());
+               for (ProfilerThreadImpl pti : profilerThreadMap.values())
+               {
+                  threadInfos.add(pti.getThreadInfo());
 
-            Map<String, AllocationInfo> ptiAllocationMap = pti.getAllocationMap();
+                  Map<String, AllocationInfo> ptiAllocationMap = pti.getAllocationMap();
 
-            Iterator it = ptiAllocationMap.entrySet().iterator();
-            while (it.hasNext()) {
-              Map.Entry entry = (Map.Entry)it.next();
+                  Iterator it = ptiAllocationMap.entrySet().iterator();
+                  while (it.hasNext())
+                  {
+                     Map.Entry entry = (Map.Entry)it.next();
 
-              String className = (String)entry.getKey();
-              AllocationInfo ptiAllocation = (AllocationInfo)entry.getValue();
+                     String className = (String)entry.getKey();
+                     AllocationInfo ptiAllocation = (AllocationInfo)entry.getValue();
 
-              AllocationInfo ai = allocationInfos.get(className);
-              
-              if (ai == null) {
-                ai = new AllocationInfo(className);
-                allocationInfos.put(className, ai);
-              }
-            
-              for (long l = 0; l < ptiAllocation.getCount(); l++) {
-                ai.increase();
-              }
-            }
-          }
+                     AllocationInfo ai = allocationInfos.get(className);
 
-          Snapshot snapshot = new Snapshot(threadInfos,
-                                           new ArrayList<AllocationInfo>(allocationInfos.values()),
-                                           classList,
-                                           methodRepository,
-                                           from,
-                                           to);
-          snapshots.add(snapshot);
-        } else {
-          try {
-            Map<String, AllocationInfo> allocationInfos = new HashMap<String, AllocationInfo>();
-          
-            for (ProfilerThreadImpl pti : profilerThreadMap.values()) {
-              Map<String, AllocationInfo> ptiAllocationMap = pti.getAllocationMap();
-              
-              Iterator it = ptiAllocationMap.entrySet().iterator();
-              while (it.hasNext()) {
-                Map.Entry entry = (Map.Entry)it.next();
-                
-                String className = (String)entry.getKey();
-                AllocationInfo ptiAllocation = (AllocationInfo)entry.getValue();
-                
-                AllocationInfo ai = allocationInfos.get(className);
-                
-                if (ai == null) {
-                  ai = new AllocationInfo(className);
-                  allocationInfos.put(className, ai);
-                }
-                
-                for (long l = 0; l < ptiAllocation.getCount(); l++) {
-                  ai.increase();
-                }
-              }
+                     if (ai == null)
+                     {
+                        ai = new AllocationInfo(className);
+                        allocationInfos.put(className, ai);
+                     }
+
+                     for (long l = 0; l < ptiAllocation.getCount(); l++)
+                     {
+                        ai.increase();
+                     }
+                  }
+               }
+
+               Snapshot snapshot =
+                     new Snapshot(threadInfos,
+                                  new ArrayList<AllocationInfo>(allocationInfos.values()),
+                                  classList,
+                                  methodRepository,
+                                  from,
+                                  to);
+               snapshots.add(snapshot);
             }
+            else
+            {
+               try
+               {
+                  Map<String, AllocationInfo> allocationInfos = new HashMap<String, AllocationInfo>();
 
-            Snapshot snapshot = new Snapshot(null,
-                                             new ArrayList<AllocationInfo>(allocationInfos.values()),
-                                             classList,
-                                             methodRepository,
-                                             from,
-                                             to);
-            SnapshotHelper.save(snapshot, new File(root, "data"));
-          } catch (Exception e) {
-            System.err.println(e.getMessage());
-            e.printStackTrace(System.err);
-          }
-        }
-      }
+                  for (ProfilerThreadImpl pti : profilerThreadMap.values())
+                  {
+                     Map<String, AllocationInfo> ptiAllocationMap = pti.getAllocationMap();
 
-      running.set(false);
-    }
-  }
+                     Iterator it = ptiAllocationMap.entrySet().iterator();
+                     while (it.hasNext())
+                     {
+                        Map.Entry entry = (Map.Entry)it.next();
 
-  /**
-   * Take a snapshot
-   * @return The snapshot
-   */
-  public static Snapshot snapshot() {
-    synchronized (lock) {
-      Snapshot snapshot = null;
-      boolean wasRunning = false;
+                        String className = (String)entry.getKey();
+                        AllocationInfo ptiAllocation = (AllocationInfo)entry.getValue();
 
-      if (running.get()) {
-        stopProfiler();
-        wasRunning = true;
-      }
+                        AllocationInfo ai = allocationInfos.get(className);
 
-      if (snapshots.size() > 0) {
-        snapshot = snapshots.get(snapshots.size() - 1);
-      }
+                        if (ai == null)
+                        {
+                           ai = new AllocationInfo(className);
+                           allocationInfos.put(className, ai);
+                        }
 
-      if (wasRunning) {
-        startProfiler();
+                        for (long l = 0; l < ptiAllocation.getCount(); l++)
+                        {
+                           ai.increase();
+                        }
+                     }
+                  }
+
+                  Snapshot snapshot =
+                        new Snapshot(null,
+                                     new ArrayList<AllocationInfo>(allocationInfos.values()),
+                                     classList,
+                                     methodRepository,
+                                     from,
+                                     to);
+                  SnapshotHelper.save(snapshot, new File(root, "data"));
+               }
+               catch (Exception e)
+               {
+                  System.err.println(e.getMessage());
+                  e.printStackTrace(System.err);
+               }
+            }
+         }
+
+         running.set(false);
       }
-      return snapshot;
-    }
-  }
+   }
 
-  /**
-   * Get all snapshots
-   * @return The snapshots
-   */
-  public static List<Snapshot> getSnapshots() {
-    return snapshots;
-  }
+   /**
+    * Take a snapshot
+    * @return The snapshot
+    */
+   public static Snapshot snapshot()
+   {
+      synchronized (lock)
+      {
+         Snapshot snapshot = null;
+         boolean wasRunning = false;
 
-  /**
-   * Get a snapshot
-   * @param index The snapshot index
-   * @return The snapshot
-   */
-  public static Snapshot getSnapshot(int index) {
-    Snapshot result = null;
-    if (index >= 1 && index <= snapshots.size()) {
-      result = snapshots.get(index - 1);
-    }
-    return result;
-  }
+         if (running.get())
+         {
+            stopProfiler();
+            wasRunning = true;
+         }
 
-  /**
-   * List snapshots
-   * @return The snapshots
-   */
-  public static String[] listSnapshots() {
-    SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMMM yyyy HH:mm:ss:SSS");
-    String[] result = new String[snapshots.size()];
-    for (int i = 0; i < snapshots.size(); i++) {
-      Snapshot s = snapshots.get(i);
-      result[i] = Integer.toString(i + 1) + ": " + 
-        dateFormat.format(s.getFrom()) + " -> " + dateFormat.format(s.getTo());
-    }
-    return result;
-  }
+         if (snapshots.size() > 0)
+         {
+            snapshot = snapshots.get(snapshots.size() - 1);
+         }
 
-  /**
-   * Clear snapshots
-   */
-  public static void clearSnapshots() {
-    synchronized (lock) {
-      snapshots = new ArrayList<Snapshot>();
-    }
-  }
+         if (wasRunning)
+         {
+            startProfiler();
+         }
+         return snapshot;
+      }
+   }
 
-  /**
-   * Garbage collection
-   */
-  public static void garbageCollection() {
-    synchronized (lock) {
-      System.gc();
-    }
-  }
+   /**
+    * Get all snapshots
+    * @return The snapshots
+    */
+   public static List<Snapshot> getSnapshots()
+   {
+      return snapshots;
+   }
 
-  /**
-   * Is the profiler running ?
-   * @return True if running; otherwise false
-   */
-  public static boolean isRunning() {
-    return running.get();
-  }
+   /**
+    * Get a snapshot
+    * @param index The snapshot index
+    * @return The snapshot
+    */
+   public static Snapshot getSnapshot(int index)
+   {
+      Snapshot result = null;
+      if (index >= 1 &&
+            index <= snapshots.size())
+      {
+         result = snapshots.get(index - 1);
+      }
+      return result;
+   }
 
-  /**
-   * Get the profiler thread
-   * @param thread The thread
-   * @return The profiler thread
-   */
-  public static ProfilerThread getProfilerThread(Thread thread) {
-    if (running.get()) {
-      ProfilerThreadImpl result = profilerThreadMap.get(Long.valueOf(thread.getId()));
-      if (result == null) {
-        // ProfilerThreadImpl does not yet exist
-        ProfilerThreadImpl newResult = new ProfilerThreadImpl(thread);
-        result = profilerThreadMap.putIfAbsent(Long.valueOf(thread.getId()), newResult);
-        if (result == null) {
-          // put succeeded, use new value
-          result = newResult;
-        }
+   /**
+    * List snapshots
+    * @return The snapshots
+    */
+   public static String[] listSnapshots()
+   {
+      SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMMM yyyy HH:mm:ss:SSS");
+      String[] result = new String[snapshots.size()];
+      for (int i = 0; i < snapshots.size(); i++)
+      {
+         Snapshot s = snapshots.get(i);
+         result[i] = Integer.toString(i + 1) +
+               ": " + dateFormat.format(s.getFrom()) + " -> " + dateFormat.format(s.getTo());
       }
       return result;
-    }
-    return NOP_PROFILER_THREAD;
-  }
+   }
 
-  /**
-   * Get the root directory
-   * @return The root directory
-   */
-  static File getRoot() {
-    return root;
-  }
+   /**
+    * Clear snapshots
+    */
+   public static void clearSnapshots()
+   {
+      synchronized (lock)
+      {
+         snapshots = new ArrayList<Snapshot>();
+      }
+   }
 
-  /**
-   * Get the method repository
-   * @return The method repository
-   */
-  static MethodRepository getMethodRepository() {
-    return methodRepository;
-  }
+   /**
+    * Garbage collection
+    */
+   public static void garbageCollection()
+   {
+      synchronized (lock)
+      {
+         System.gc();
+      }
+   }
+
+   /**
+    * Is the profiler running ?
+    * @return True if running; otherwise false
+    */
+   public static boolean isRunning()
+   {
+      return running.get();
+   }
+
+   /**
+    * Get the profiler thread
+    * @param thread The thread
+    * @return The profiler thread
+    */
+   public static ProfilerThread getProfilerThread(Thread thread)
+   {
+      if (running.get())
+      {
+         ProfilerThreadImpl result = profilerThreadMap.get(Long.valueOf(thread.getId()));
+         if (result == null)
+         {
+            // ProfilerThreadImpl does not yet exist
+            ProfilerThreadImpl newResult = new ProfilerThreadImpl(thread);
+            result = profilerThreadMap.putIfAbsent(Long.valueOf(thread.getId()), newResult);
+            if (result == null)
+            {
+               // put succeeded, use new value
+               result = newResult;
+            }
+         }
+         return result;
+      }
+      return NOP_PROFILER_THREAD;
+   }
+
+   /**
+    * Get the root directory
+    * @return The root directory
+    */
+   static File getRoot()
+   {
+      return root;
+   }
+
+   /**
+    * Get the method repository
+    * @return The method repository
+    */
+   static MethodRepository getMethodRepository()
+   {
+      return methodRepository;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,35 +25,36 @@
  * A profiler thread
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface ProfilerThread {
+public interface ProfilerThread
+{
 
-  /**
-   * Register start time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void start(String className, String methodName);
-  
-  /**
-   * Register end time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void end(String className, String methodName);
-  
-  /**
-   * Register start wait time for a method
-   */
-  public void beginWait();
-  
-  /**
-   * Register end wait time for a method
-   */
-  public void endWait();
-  
-  /**
-   * Class allocation
-   * @param className The class being allocated
-   */
-  public void allocation(String className);
+   /**
+    * Register start time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void start(String className, String methodName);
+
+   /**
+    * Register end time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void end(String className, String methodName);
+
+   /**
+    * Register start wait time for a method
+    */
+   public void beginWait();
+
+   /**
+    * Register end wait time for a method
+    */
+   public void endWait();
+
+   /**
+    * Class allocation
+    * @param className The class being allocated
+    */
+   public void allocation(String className);
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,26 +22,14 @@
 package org.jboss.profiler.agent;
 
 import org.jboss.profiler.shared.AllocationInfo;
-import org.jboss.profiler.shared.ClassInfo;
 import org.jboss.profiler.shared.FrameHelper;
 import org.jboss.profiler.shared.FrameInfo;
 import org.jboss.profiler.shared.MethodInfo;
-import org.jboss.profiler.shared.MethodRepository;
-import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.shared.SnapshotHelper;
 import org.jboss.profiler.shared.ThreadHelper;
 import org.jboss.profiler.shared.ThreadInfo;
 
 import java.io.File;
-import java.io.IOException;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -50,244 +38,295 @@
  * The profiler thread implementation
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ProfilerThreadImpl implements ProfilerThread {
+public class ProfilerThreadImpl implements ProfilerThread
+{
 
-  /** The thread id */
-  private long threadId;
+   /** The thread id */
+   private long threadId;
 
-  /** The thread info */
-  private ThreadInfo ti;
+   /** The thread info */
+   private ThreadInfo ti;
 
-  /** The active frame */
-  private FrameInfo activeFrame;
+   /** The active frame */
+   private FrameInfo activeFrame;
 
-  /** The frame number */
-  private long frameNumber;
+   /** The frame number */
+   private long frameNumber;
 
-  /** The allocation map */
-  private Map<String, AllocationInfo> allocationMap;
+   /** The allocation map */
+   private Map<String, AllocationInfo> allocationMap;
 
-  /**
-   * Constructor
-   * @param thread The thread
-   */
-  ProfilerThreadImpl(Thread thread) {
-    threadId = thread.getId();
+   /**
+    * Constructor
+    * @param thread The thread
+    */
+   ProfilerThreadImpl(Thread thread)
+   {
+      threadId = thread.getId();
 
-    List<String> groups = new ArrayList<String>();
-          
-    ThreadGroup tg = thread.getThreadGroup();
-    while (tg != null) {
-      groups.add(tg.getName());
-      tg = tg.getParent();
-    }
-    
-    ti = new ThreadInfo(threadId, thread.getName(), thread.getPriority(), thread.isDaemon(), groups);
+      List<String> groups = new ArrayList<String>();
 
-    activeFrame = null;
-    frameNumber = 0;
-    allocationMap = new HashMap<String, AllocationInfo>();
-    
-    if (!Agent.isMemoryStore()) {            
-      File directory = new File(Profiler.getRoot(), Long.toString(threadId));
-      
-      try {
-        ThreadHelper.save(ti, directory);
-      } catch (Exception e) {
-        System.err.println(e.getMessage());
-        e.printStackTrace(System.err);
+      ThreadGroup tg = thread.getThreadGroup();
+      while (tg != null)
+      {
+         groups.add(tg.getName());
+         tg = tg.getParent();
       }
-    }
-  }
 
-  /**
-   * Register start time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void start(String className, String methodName) {
-    if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
-      return;
-    }
+      ti = new ThreadInfo(threadId, thread.getName(), thread.getPriority(), thread.isDaemon(), groups);
 
-    Integer mi = Profiler.getMethodRepository().getId(className, methodName);
-    
-    FrameInfo parent = activeFrame;
-    FrameInfo fi = null;
-    
-    if (parent != null) {
-      fi = (FrameInfo)parent.getChild(mi);
-      
-      if (fi == null) {
-        fi = new FrameInfo(mi, parent);
+      activeFrame = null;
+      frameNumber = 0;
+      allocationMap = new HashMap<String, AllocationInfo>();
+
+      if (!Agent.isMemoryStore())
+      {
+         File directory = new File(Profiler.getRoot(), Long.toString(threadId));
+
+         try
+         {
+            ThreadHelper.save(ti, directory);
+         }
+         catch (Exception e)
+         {
+            System.err.println(e.getMessage());
+            e.printStackTrace(System.err);
+         }
       }
-    } else {
-      fi = new FrameInfo(mi, null);
-      ti.add(fi);
-    }
-      
-    activeFrame = fi;
-    
-    fi.setBeginTime(System.nanoTime());
-  }
-  
-  /**
-   * Register end time for a method
-   * @param className The class name
-   * @param methodName The method name
-   */
-  public void end(String className, String methodName) {
-    long start = System.nanoTime();
-    
-    if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
-      return;
-    }
+   }
 
-    FrameInfo fi = findFrame(className, methodName);
-      
-    if (fi == null) {
-      return;
-    }
-    
-    fi.setOverhead(System.nanoTime() - start);
-    fi.setEndTime(System.nanoTime());
-    
-    if (fi.getParent() != null) {
-      activeFrame = fi.getParent();
-    } else {
-      activeFrame = null;
+   /**
+    * Register start time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void start(String className, String methodName)
+   {
+      if (!Agent.isEnabled() ||
+            !Agent.isCPU() || !Profiler.isRunning())
+      {
+         return;
+      }
 
-      if (!Agent.isMemoryStore()) {
-        File directory = new File(Profiler.getRoot(), Long.toString(threadId));
-        
-        try {
-          FrameHelper.save(fi, frameNumber, directory);
-          
-          ti.getFrames().clear();
-          
-          frameNumber += 1;
-        } catch (Exception e) {
-          System.err.println(e.getMessage());
-          e.printStackTrace(System.err);
-        }
+      Integer mi = Profiler.getMethodRepository().getId(className, methodName);
+
+      FrameInfo parent = activeFrame;
+      FrameInfo fi = null;
+
+      if (parent != null)
+      {
+         fi = (FrameInfo)parent.getChild(mi);
+
+         if (fi == null)
+         {
+            fi = new FrameInfo(mi, parent);
+         }
       }
-    }
-  }
-  
-  /**
-   * Register start wait time for a method
-   */
-  public void beginWait() {
-    if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
-      return;
-    }
+      else
+      {
+         fi = new FrameInfo(mi, null);
+         ti.add(fi);
+      }
 
-    FrameInfo fi = activeFrame;
-      
-    if (fi == null) {
-      return;
-    }
-      
-    fi.setBeginWaitTime(System.nanoTime());
-  }
-  
-  /**
-   * Register end wait time for a method
-   */
-  public void endWait() {
-    long start = System.nanoTime();
-    
-    if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
-      return;
-    }
+      activeFrame = fi;
 
-    FrameInfo fi = activeFrame;
-      
-    if (fi == null) {
-      return;
-    }
-      
-    fi.setOverhead(System.nanoTime() - start);
-    fi.setEndWaitTime(System.nanoTime());
-  }
-  
-  /**
-   * Class allocation
-   * @param className The class being allocated
-   */
-  public void allocation(String className) {
-    if (!Agent.isEnabled() || !Agent.isMemory() || !Profiler.isRunning()) {
-      return;
-    }
+      fi.setBeginTime(System.nanoTime());
+   }
 
-    FrameInfo fi = activeFrame;
-      
-    // Constructor delegation
-    if (fi != null) {
-      MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
-      if (mi.getClassName().equals(className) && "<init>".equals(mi.getMethodName())) {
-        return;
+   /**
+    * Register end time for a method
+    * @param className The class name
+    * @param methodName The method name
+    */
+   public void end(String className, String methodName)
+   {
+      long start = System.nanoTime();
+
+      if (!Agent.isEnabled() ||
+            !Agent.isCPU() || !Profiler.isRunning())
+      {
+         return;
       }
-    }
 
-    AllocationInfo ai = allocationMap.get(className);
-    
-    if (ai == null) {
-      ai = new AllocationInfo(className);
-      allocationMap.put(className, ai);
-    }
-    
-    ai.increase();
-  }
+      FrameInfo fi = findFrame(className, methodName);
 
-  /**
-   * Close the frames
-   */
-  void closeFrames() {
-    if (ti.getFrames().size() > 0) {
-      FrameInfo fi = ti.getRecentFrame();
-      fi.close();
-    }
-  }
+      if (fi == null)
+      {
+         return;
+      }
 
-  /**
-   * Get the thead info
-   * @return The thread info
-   */
-  ThreadInfo getThreadInfo() {
-    return ti;
-  }
+      fi.setOverhead(System.nanoTime() -
+            start);
+      fi.setEndTime(System.nanoTime());
 
-  /**
-   * Get the allocation map
-   * @return The map
-   */
-  Map<String, AllocationInfo> getAllocationMap() {
-    return allocationMap;
-  }
+      if (fi.getParent() != null)
+      {
+         activeFrame = fi.getParent();
+      }
+      else
+      {
+         activeFrame = null;
 
-  /**
-   * Find the frame which contains the call
-   * @param threadId The thread id
-   * @param className The class name
-   * @param methodName The method name
-   * @return The frame; null if not found
-   */
-  private FrameInfo findFrame(String className, String methodName) {
-    FrameInfo fi = activeFrame;
-    
-    while (fi != null) {
-      MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
-      if (mi.getClassName().equals(className) 
-          && mi.getMethodName().equals(methodName)) {
-        // Found the first frame
-        return fi;
-      } else {
-        fi.setEndTime(System.nanoTime());
-        fi = fi.getParent();
+         if (!Agent.isMemoryStore())
+         {
+            File directory = new File(Profiler.getRoot(), Long.toString(threadId));
+
+            try
+            {
+               FrameHelper.save(fi, frameNumber, directory);
+
+               ti.getFrames().clear();
+
+               frameNumber += 1;
+            }
+            catch (Exception e)
+            {
+               System.err.println(e.getMessage());
+               e.printStackTrace(System.err);
+            }
+         }
       }
-    }
-    
-    return fi;
-  }
+   }
+
+   /**
+    * Register start wait time for a method
+    */
+   public void beginWait()
+   {
+      if (!Agent.isEnabled() ||
+            !Agent.isCPU() || !Profiler.isRunning())
+      {
+         return;
+      }
+
+      FrameInfo fi = activeFrame;
+
+      if (fi == null)
+      {
+         return;
+      }
+
+      fi.setBeginWaitTime(System.nanoTime());
+   }
+
+   /**
+    * Register end wait time for a method
+    */
+   public void endWait()
+   {
+      long start = System.nanoTime();
+
+      if (!Agent.isEnabled() ||
+            !Agent.isCPU() || !Profiler.isRunning())
+      {
+         return;
+      }
+
+      FrameInfo fi = activeFrame;
+
+      if (fi == null)
+      {
+         return;
+      }
+
+      fi.setOverhead(System.nanoTime() -
+            start);
+      fi.setEndWaitTime(System.nanoTime());
+   }
+
+   /**
+    * Class allocation
+    * @param className The class being allocated
+    */
+   public void allocation(String className)
+   {
+      if (!Agent.isEnabled() ||
+            !Agent.isMemory() || !Profiler.isRunning())
+      {
+         return;
+      }
+
+      FrameInfo fi = activeFrame;
+
+      // Constructor delegation
+      if (fi != null)
+      {
+         MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
+         if (mi.getClassName().equals(className) &&
+               "<init>".equals(mi.getMethodName()))
+         {
+            return;
+         }
+      }
+
+      AllocationInfo ai = allocationMap.get(className);
+
+      if (ai == null)
+      {
+         ai = new AllocationInfo(className);
+         allocationMap.put(className, ai);
+      }
+
+      ai.increase();
+   }
+
+   /**
+    * Close the frames
+    */
+   void closeFrames()
+   {
+      if (ti.getFrames().size() > 0)
+      {
+         FrameInfo fi = ti.getRecentFrame();
+         fi.close();
+      }
+   }
+
+   /**
+    * Get the thead info
+    * @return The thread info
+    */
+   ThreadInfo getThreadInfo()
+   {
+      return ti;
+   }
+
+   /**
+    * Get the allocation map
+    * @return The map
+    */
+   Map<String, AllocationInfo> getAllocationMap()
+   {
+      return allocationMap;
+   }
+
+   /**
+    * Find the frame which contains the call
+    * @param threadId The thread id
+    * @param className The class name
+    * @param methodName The method name
+    * @return The frame; null if not found
+    */
+   private FrameInfo findFrame(String className, String methodName)
+   {
+      FrameInfo fi = activeFrame;
+
+      while (fi != null)
+      {
+         MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
+         if (mi.getClassName().equals(className) &&
+               mi.getMethodName().equals(methodName))
+         {
+            // Found the first frame
+            return fi;
+         }
+         else
+         {
+            fi.setEndTime(System.nanoTime());
+            fi = fi.getParent();
+         }
+      }
+
+      return fi;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/SizeComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/SizeComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/SizeComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,21 +28,28 @@
  * Size comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SizeComparator implements Comparator<String>, Serializable {
+public class SizeComparator implements Comparator<String>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param sa String
-   * @param sb String
-   * @return Positive if sb greater than sa; zero if equal; otherwise negative
-   */
-  public int compare(String sa, String sb) {
-    if (sa.length() < sb.length()) {
-      return 1;
-    } else if (sa.length() == sb.length()) { 
-      return sa.compareTo(sb);
-    } else {
-      return -1;
-    }
-  }
+   /**
+    * Compare two objects
+    * @param sa String
+    * @param sb String
+    * @return Positive if sb greater than sa; zero if equal; otherwise negative
+    */
+   public int compare(String sa, String sb)
+   {
+      if (sa.length() < sb.length())
+      {
+         return 1;
+      }
+      else if (sa.length() == sb.length())
+      {
+         return sa.compareTo(sb);
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Transformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Transformer.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Transformer.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,9 +21,7 @@
  */
 package org.jboss.profiler.agent;
 
-import java.io.BufferedInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.IllegalClassFormatException;
 import java.security.ProtectionDomain;
@@ -32,39 +30,37 @@
  * The transformer interface
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface Transformer extends ClassFileTransformer {
+public interface Transformer extends ClassFileTransformer
+{
 
-  /**
-   * The transform method
-   * @param loader The class loader
-   * @param className The class name
-   * @param classBeingRedefined The class being redefined
-   * @param protectionDomain The protection domain
-   * @param classfileBuffer The class buffer
-   * @return The transformed class; null if no transformation have been done
-   * @exception IllegalClassFormatException If the class can't be transformed
-   */
-  public byte[] transform(ClassLoader loader, 
-                          String className, 
-                          Class<?> classBeingRedefined, 
-                          ProtectionDomain protectionDomain, 
-                          byte[] classfileBuffer) throws IllegalClassFormatException;
+   /**
+    * The transform method
+    * @param loader The class loader
+    * @param className The class name
+    * @param classBeingRedefined The class being redefined
+    * @param protectionDomain The protection domain
+    * @param classfileBuffer The class buffer
+    * @return The transformed class; null if no transformation have been done
+    * @exception IllegalClassFormatException If the class can't be transformed
+    */
+   public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
+         ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException;
 
-  /**
-   * Load non instrumented class
-   * @param className The class name
-   * @param loader The class loader
-   * @return The bytes
-   * @exception IOException If an error occurs
-   */
-  public byte[] loadNonInstrumented(String className, ClassLoader loader) throws IOException;
+   /**
+    * Load non instrumented class
+    * @param className The class name
+    * @param loader The class loader
+    * @return The bytes
+    * @exception IOException If an error occurs
+    */
+   public byte[] loadNonInstrumented(String className, ClassLoader loader) throws IOException;
 
-  /**
-   * Load instrumented class
-   * @param className The class name
-   * @param loader The class loader
-   * @return The bytes
-   * @exception IOException If an error occurs
-   */
-  public byte[] loadInstrumented(String className, ClassLoader loader) throws IOException;
+   /**
+    * Load instrumented class
+    * @param className The class name
+    * @param loader The class loader
+    * @return The bytes
+    * @exception IOException If an error occurs
+    */
+   public byte[] loadInstrumented(String className, ClassLoader loader) throws IOException;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/Job.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/Job.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/Job.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,63 +28,70 @@
  * The job class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public abstract class Job extends TimerTask {
+public abstract class Job extends TimerTask
+{
 
-  /** The time */
-  private Date time;
+   /** The time */
+   private Date time;
 
-  /** The period */
-  private long period;
+   /** The period */
+   private long period;
 
-  /**
-   * Constructor
-   */
-  protected Job() {
-    time = null;
-    period = -1;
-  }
+   /**
+    * Constructor
+    */
+   protected Job()
+   {
+      time = null;
+      period = -1;
+   }
 
-  /**
-   * Get the time
-   * @return The time
-   */
-  public Date getTime() {
-    return time;
-  }
+   /**
+    * Get the time
+    * @return The time
+    */
+   public Date getTime()
+   {
+      return time;
+   }
 
-  /**
-   * Set the time
-   * @param t The time
-   */
-  public void setTime(Date t) {
-    time = t;
-  }
-  
-  /**
-   * Get the period
-   * @return The period
-   */
-  public long getPeriod() {
-    return period;
-  }
+   /**
+    * Set the time
+    * @param t The time
+    */
+   public void setTime(Date t)
+   {
+      time = t;
+   }
 
-  /**
-   * Set the period
-   * @param p The period
-   */
-  public void setPeriod(long p) {
-    period = p;
-  }
-  
-  /**
-   * The run method
-   */
-  public void run() {
-    doJob();
-  }
+   /**
+    * Get the period
+    * @return The period
+    */
+   public long getPeriod()
+   {
+      return period;
+   }
 
-  /**
-   * Execute the job
-   */
-  public abstract void doJob();
+   /**
+    * Set the period
+    * @param p The period
+    */
+   public void setPeriod(long p)
+   {
+      period = p;
+   }
+
+   /**
+    * The run method
+    */
+   public void run()
+   {
+      doJob();
+   }
+
+   /**
+    * Execute the job
+    */
+   public abstract void doJob();
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/JobHelper.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/JobHelper.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/JobHelper.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,94 +34,107 @@
  * The job helper
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class JobHelper {
+public class JobHelper
+{
 
-  /** Argument: type */
-  private static final String ARGUMENT_TYPE = "type";
+   /** Argument: type */
+   private static final String ARGUMENT_TYPE = "type";
 
-  /** Argument: time */
-  private static final String ARGUMENT_TIME = "time";
+   /** Argument: time */
+   private static final String ARGUMENT_TIME = "time";
 
-  /** Argument: period */
-  private static final String ARGUMENT_PERIOD = "period";
+   /** Argument: period */
+   private static final String ARGUMENT_PERIOD = "period";
 
-  /**
-   * Constructor
-   */
-  private JobHelper() {
-  }
+   /**
+    * Constructor
+    */
+   private JobHelper()
+   {
+   }
 
-  /**
-   * Load a list of jobs
-   * @param properties The properties
-   * @return The list
-   */
-  public static List<Job> load(Properties properties) {
-    List<Job> result = new ArrayList<Job>();
+   /**
+    * Load a list of jobs
+    * @param properties The properties
+    * @return The list
+    */
+   public static List<Job> load(Properties properties)
+   {
+      List<Job> result = new ArrayList<Job>();
 
-    if (properties != null) {
-      Map<Integer, Map<String, String>> jobs = 
-        new TreeMap<Integer, Map<String, String>>();
-      
-      Iterator it = properties.entrySet().iterator();
-      while (it.hasNext()) {
-        Map.Entry entry = (Map.Entry)it.next();
+      if (properties != null)
+      {
+         Map<Integer, Map<String, String>> jobs = new TreeMap<Integer, Map<String, String>>();
 
-        String key = (String)entry.getKey();
-        String value = (String)entry.getValue();
+         Iterator it = properties.entrySet().iterator();
+         while (it.hasNext())
+         {
+            Map.Entry entry = (Map.Entry)it.next();
 
-        if (key.startsWith("job.")) {
-          int from = key.indexOf(".") + 1;
-          int to = key.indexOf(".", from);
+            String key = (String)entry.getKey();
+            String value = (String)entry.getValue();
 
-          Integer idx = Integer.parseInt(key.substring(from, to));
+            if (key.startsWith("job."))
+            {
+               int from = key.indexOf(".") + 1;
+               int to = key.indexOf(".", from);
 
-          Map<String, String> m = jobs.get(idx);
-          if (m == null) {
-            m = new HashMap<String, String>();
-          }
+               Integer idx = Integer.parseInt(key.substring(from, to));
 
-          String kt = key.substring(to + 1);
-          kt = kt.trim().toLowerCase();
+               Map<String, String> m = jobs.get(idx);
+               if (m == null)
+               {
+                  m = new HashMap<String, String>();
+               }
 
-          if (kt.equals(ARGUMENT_TYPE) ||
-              kt.equals(ARGUMENT_TIME) ||
-              kt.equals(ARGUMENT_PERIOD)) {
-            m.put(kt, value.trim());
+               String kt = key.substring(to + 1);
+               kt = kt.trim().toLowerCase();
 
-            jobs.put(idx, m);
-          }
-        }
-      }
+               if (kt.equals(ARGUMENT_TYPE) || kt.equals(ARGUMENT_TIME) || kt.equals(ARGUMENT_PERIOD))
+               {
+                  m.put(kt, value.trim());
 
-      List<Map<String, String>> js = new ArrayList<Map<String, String>>(jobs.values());
-      for (Map<String, String> ji : js) {
+                  jobs.put(idx, m);
+               }
+            }
+         }
 
-        String className = ji.get(ARGUMENT_TYPE);
-        try {
-          Class c = Class.forName(className);
-          Job j = (Job)c.newInstance();
+         List<Map<String, String>> js = new ArrayList<Map<String, String>>(jobs.values());
+         for (Map<String, String> ji : js)
+         {
 
-          String ts = ji.get(ARGUMENT_TIME);
-          if (ts != null) {
-            j.setTime(new Date(Long.parseLong(ts)));
+            String className = ji.get(ARGUMENT_TYPE);
+            try
+            {
+               Class c = Class.forName(className);
+               Job j = (Job)c.newInstance();
 
-            String ps = ji.get(ARGUMENT_PERIOD);
-            if (ps != null) {
-              j.setPeriod(Long.parseLong(ps));
+               String ts = ji.get(ARGUMENT_TIME);
+               if (ts != null)
+               {
+                  j.setTime(new Date(Long.parseLong(ts)));
+
+                  String ps = ji.get(ARGUMENT_PERIOD);
+                  if (ps != null)
+                  {
+                     j.setPeriod(Long.parseLong(ps));
+                  }
+
+                  result.add(j);
+               }
+               else
+               {
+                  System.err.println("Job " + className + " could not be loaded");
+               }
             }
-
-            result.add(j);
-          } else {
-            System.err.println("Job " + className + " could not be loaded");
-          }
-        } catch (Exception e) {
-          // Nothing to do
-          System.err.println("Job " + className + " could not be loaded");
-        }
+            catch (Exception e)
+            {
+               // Nothing to do
+               System.err.println("Job " + className + " could not be loaded");
+            }
+         }
       }
-    }
 
-    return result;
-  }
+      return result;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StartProfiling.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StartProfiling.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StartProfiling.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,19 +28,22 @@
  * The start profiling job
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class StartProfiling extends Job {
+public class StartProfiling extends Job
+{
 
-  /**
-   * Constructor
-   */
-  public StartProfiling() {
-  }
+   /**
+    * Constructor
+    */
+   public StartProfiling()
+   {
+   }
 
-  /**
-   * The job method
-   */
-  public void doJob() {
-    Agent.setEnabled(true);
-    Profiler.startProfiler();
-  }
+   /**
+    * The job method
+    */
+   public void doJob()
+   {
+      Agent.setEnabled(true);
+      Profiler.startProfiler();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StopProfiling.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StopProfiling.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/jobs/StopProfiling.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,19 +28,22 @@
  * The stop profiling job
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class StopProfiling extends Job {
+public class StopProfiling extends Job
+{
 
-  /**
-   * Constructor
-   */
-  public StopProfiling() {
-  }
+   /**
+    * Constructor
+    */
+   public StopProfiling()
+   {
+   }
 
-  /**
-   * The job method
-   */
-  public void doJob() {
-    Profiler.stopProfiler();
-    Agent.setEnabled(false);
-  }
+   /**
+    * The job method
+    */
+   public void doJob()
+   {
+      Profiler.stopProfiler();
+      Agent.setEnabled(false);
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,77 +28,85 @@
  * The abstract Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public abstract class AbstractTask extends Task {
+public abstract class AbstractTask extends Task
+{
 
-  /** Protocol */
-  private String protocol;
+   /** Protocol */
+   private String protocol;
 
-  /** Host */
-  private String host;
+   /** Host */
+   private String host;
 
-  /** Port */
-  private int port;
+   /** Port */
+   private int port;
 
-  /**
-   * Constructor
-   */
-  public AbstractTask() {
-    protocol = "socket";
-    host = "localhost";
-    port = 5400;
-  }
+   /**
+    * Constructor
+    */
+   public AbstractTask()
+   {
+      protocol = "socket";
+      host = "localhost";
+      port = 5400;
+   }
 
-  /**
-   * Get the protocol
-   * @return The protocol
-   */
-  public String getProtocol() {
-    return protocol;
-  }
+   /**
+    * Get the protocol
+    * @return The protocol
+    */
+   public String getProtocol()
+   {
+      return protocol;
+   }
 
-  /**
-   * Set the protocol
-   * @param p The protocol
-   */
-  public void setProtocol(String p) {
-    protocol = p;
-  }
+   /**
+    * Set the protocol
+    * @param p The protocol
+    */
+   public void setProtocol(String p)
+   {
+      protocol = p;
+   }
 
-  /**
-   * Get the host
-   * @return The host
-   */
-  public String getHost() {
-    return host;
-  }
+   /**
+    * Get the host
+    * @return The host
+    */
+   public String getHost()
+   {
+      return host;
+   }
 
-  /**
-   * Set the host
-   * @param h The host
-   */
-  public void setHost(String h) {
-    host = h;
-  }
+   /**
+    * Set the host
+    * @param h The host
+    */
+   public void setHost(String h)
+   {
+      host = h;
+   }
 
-  /**
-   * Get the port
-   * @return The port
-   */
-  public int getPort() {
-    return port;
-  }
+   /**
+    * Get the port
+    * @return The port
+    */
+   public int getPort()
+   {
+      return port;
+   }
 
-  /**
-   * Set the port
-   * @param p The port
-   */
-  public void setPort(int p) {
-    port = p;
-  }
+   /**
+    * Set the port
+    * @param p The port
+    */
+   public void setPort(int p)
+   {
+      port = p;
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public abstract void execute() throws BuildException;
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public abstract void execute() throws BuildException;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AddClassesTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AddClassesTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AddClassesTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -35,83 +35,109 @@
  * The add classes Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class AddClassesTask extends AbstractTask {
+public class AddClassesTask extends AbstractTask
+{
 
-  /** Classes */
-  private String classes;
+   /** Classes */
+   private String classes;
 
-  /**
-   * Constructor
-   */
-  public AddClassesTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public AddClassesTask()
+   {
+      super();
+   }
 
-  /**
-   * Get the classes
-   * @return The classes
-   */
-  public String getClasses() {
-    return classes;
-  }
+   /**
+    * Get the classes
+    * @return The classes
+    */
+   public String getClasses()
+   {
+      return classes;
+   }
 
-  /**
-   * Set the classes
-   * @param c The classes
-   */
-  public void setClasses(String c) {
-    classes = c;
-  }
+   /**
+    * Set the classes
+    * @param c The classes
+    */
+   public void setClasses(String c)
+   {
+      classes = c;
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      if (classes != null && classes.trim().length() > 0) {
-        InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-        
-        remotingClient =  new org.jboss.remoting.Client(locator);
-        remotingClient.connect();
-        
-        StringTokenizer st = new StringTokenizer(classes, ", ");
-        while (st.hasMoreTokens()) {
-          String token = st.nextToken();
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         if (classes != null &&
+               classes.trim().length() > 0)
+         {
+            InvokerLocator locator = new InvokerLocator(getProtocol() +
+                  "://" + getHost() + ":" + getPort());
 
-          String clz = "";
-          String vs = "";
+            remotingClient = new org.jboss.remoting.Client(locator);
+            remotingClient.connect();
 
-          if (token.indexOf("|") == -1) {
-            clz = token;
-          } else {
-            clz = token.substring(0, token.indexOf("|"));
-            vs = token.substring(token.indexOf("|") + 1);
-          }
+            StringTokenizer st = new StringTokenizer(classes, ", ");
+            while (st.hasMoreTokens())
+            {
+               String token = st.nextToken();
 
-          Visibility v = Visibility.PUBLIC;
-          if (vs.equalsIgnoreCase("private")) {
-            v = Visibility.PRIVATE;
-          } else if (vs.equalsIgnoreCase("protected")) {
-            v = Visibility.PROTECTED;
-          } else if (vs.equalsIgnoreCase("package")) {
-            v = Visibility.PACKAGE;
-          }
-          Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
-          String response = (String)remotingClient.invoke(cmd);
-        }
+               String clz = "";
+               String vs = "";
+
+               if (token.indexOf("|") == -1)
+               {
+                  clz = token;
+               }
+               else
+               {
+                  clz = token.substring(0, token.indexOf("|"));
+                  vs = token.substring(token.indexOf("|") + 1);
+               }
+
+               Visibility v = Visibility.PUBLIC;
+               if (vs.equalsIgnoreCase("private"))
+               {
+                  v = Visibility.PRIVATE;
+               }
+               else if (vs.equalsIgnoreCase("protected"))
+               {
+                  v = Visibility.PROTECTED;
+               }
+               else if (vs.equalsIgnoreCase("package"))
+               {
+                  v = Visibility.PACKAGE;
+               }
+               Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
+               String response = (String)remotingClient.invoke(cmd);
+            }
+         }
       }
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
       }
-    }
-  }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/ClearSnapshotsTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/ClearSnapshotsTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/ClearSnapshotsTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The clear snapshots Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClearSnapshotsTask extends AbstractTask {
+public class ClearSnapshotsTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public ClearSnapshotsTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public ClearSnapshotsTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient =  new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
 
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The disable profiler Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class DisableProfilerTask extends AbstractTask {
+public class DisableProfilerTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public DisableProfilerTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public DisableProfilerTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.DISABLE);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.DISABLE);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient =  new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
 
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The enable profiler Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class EnableProfilerTask extends AbstractTask {
+public class EnableProfilerTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public EnableProfilerTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public EnableProfilerTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.ENABLE);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.ENABLE);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient =  new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
 
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/GCTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/GCTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/GCTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The garbage collection Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class GCTask extends AbstractTask {
+public class GCTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public GCTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public GCTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.GC);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.GC);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient = new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
-      
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
+
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RegressionTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RegressionTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RegressionTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -35,101 +35,118 @@
  * The regression Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class RegressionTask extends Task {
+public class RegressionTask extends Task
+{
 
-  /** Old snapshot */
-  private File oldSnapshot;
+   /** Old snapshot */
+   private File oldSnapshot;
 
-  /** New snapshpt */
-  private File newSnapshot;
+   /** New snapshpt */
+   private File newSnapshot;
 
-  /** Difference */
-  private int difference;
+   /** Difference */
+   private int difference;
 
-  /**
-   * Constructor
-   */
-  public RegressionTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public RegressionTask()
+   {
+      super();
+   }
 
-  /**
-   * Get the old snapshot
-   * @return The old snapshot
-   */
-  public File getOldsnapshot() {
-    return oldSnapshot;
-  }
+   /**
+    * Get the old snapshot
+    * @return The old snapshot
+    */
+   public File getOldsnapshot()
+   {
+      return oldSnapshot;
+   }
 
-  /**
-   * Set the old snapshot
-   * @param s The old snapshot
-   */
-  public void setOldsnapshot(File s) {
-    oldSnapshot = s;
-  }
+   /**
+    * Set the old snapshot
+    * @param s The old snapshot
+    */
+   public void setOldsnapshot(File s)
+   {
+      oldSnapshot = s;
+   }
 
-  /**
-   * Get the new snapshot
-   * @return The new snapshot
-   */
-  public File getNewsnapshot() {
-    return newSnapshot;
-  }
+   /**
+    * Get the new snapshot
+    * @return The new snapshot
+    */
+   public File getNewsnapshot()
+   {
+      return newSnapshot;
+   }
 
-  /**
-   * Set the new snapshot
-   * @param s The new snapshot
-   */
-  public void setNewsnapshot(File s) {
-    newSnapshot = s;
-  }
+   /**
+    * Set the new snapshot
+    * @param s The new snapshot
+    */
+   public void setNewsnapshot(File s)
+   {
+      newSnapshot = s;
+   }
 
-  /**
-   * Get the difference
-   * @return The difference
-   */
-  public int getDifference() {
-    return difference;
-  }
+   /**
+    * Get the difference
+    * @return The difference
+    */
+   public int getDifference()
+   {
+      return difference;
+   }
 
-  /**
-   * Set the difference
-   * @param d The difference
-   */
-  public void setDifference(int d) {
-    difference = d;
-  }
+   /**
+    * Set the difference
+    * @param d The difference
+    */
+   public void setDifference(int d)
+   {
+      difference = d;
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    if (oldSnapshot != null && oldSnapshot.exists() && newSnapshot != null && newSnapshot.exists()) {
-      try {
-        Snapshot os = SnapshotHelper.load(oldSnapshot);
-        Snapshot ns = SnapshotHelper.load(newSnapshot);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      if (oldSnapshot != null &&
+            oldSnapshot.exists() && newSnapshot != null && newSnapshot.exists())
+      {
+         try
+         {
+            Snapshot os = SnapshotHelper.load(oldSnapshot);
+            Snapshot ns = SnapshotHelper.load(newSnapshot);
 
-        double ott = 0;
-        for (ThreadInfo ti : os.getThreads()) {
-          ott += ti.getTotalTime();
-        }
-      
-        double ntt = 0;
-        for (ThreadInfo ti : ns.getThreads()) {
-          ntt += ti.getTotalTime();
-        }
+            double ott = 0;
+            for (ThreadInfo ti : os.getThreads())
+            {
+               ott += ti.getTotalTime();
+            }
 
-        int regression = (int)(((ntt - ott) / ott) * 100.0);
+            double ntt = 0;
+            for (ThreadInfo ti : ns.getThreads())
+            {
+               ntt += ti.getTotalTime();
+            }
 
-        if (regression >= difference) {
-          throw new BuildException("Regression between " + oldSnapshot + " and " +
-                                   newSnapshot + " at " + regression + "%");
-        }
-      } catch (IOException ioe) {
-        throw new BuildException(ioe.getMessage(), ioe);
+            int regression = (int)(((ntt - ott) / ott) * 100.0);
+
+            if (regression >= difference)
+            {
+               throw new BuildException("Regression between " +
+                     oldSnapshot + " and " + newSnapshot + " at " + regression + "%");
+            }
+         }
+         catch (IOException ioe)
+         {
+            throw new BuildException(ioe.getMessage(), ioe);
+         }
       }
-    }
-  }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RemoveClassesTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RemoveClassesTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/RemoveClassesTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,65 +34,83 @@
  * The remove classes Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class RemoveClassesTask extends AbstractTask {
+public class RemoveClassesTask extends AbstractTask
+{
 
-  /** Classes */
-  private String classes;
+   /** Classes */
+   private String classes;
 
-  /**
-   * Constructor
-   */
-  public RemoveClassesTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public RemoveClassesTask()
+   {
+      super();
+   }
 
-  /**
-   * Get the classes
-   * @return The classes
-   */
-  public String getClasses() {
-    return classes;
-  }
+   /**
+    * Get the classes
+    * @return The classes
+    */
+   public String getClasses()
+   {
+      return classes;
+   }
 
-  /**
-   * Set the classes
-   * @param c The classes
-   */
-  public void setClasses(String c) {
-    classes = c;
-  }
+   /**
+    * Set the classes
+    * @param c The classes
+    */
+   public void setClasses(String c)
+   {
+      classes = c;
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      if (classes != null && classes.trim().length() > 0) {
-        InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-        
-        remotingClient =  new org.jboss.remoting.Client(locator);
-        remotingClient.connect();
-        
-        StringTokenizer st = new StringTokenizer(classes, ", ");
-        while (st.hasMoreTokens()) {
-          String token = st.nextToken();
-          Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {token});
-          String response = (String)remotingClient.invoke(cmd);
-        }
-      
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         if (classes != null &&
+               classes.trim().length() > 0)
+         {
+            InvokerLocator locator = new InvokerLocator(getProtocol() +
+                  "://" + getHost() + ":" + getPort());
+
+            remotingClient = new org.jboss.remoting.Client(locator);
+            remotingClient.connect();
+
+            StringTokenizer st = new StringTokenizer(classes, ", ");
+            while (st.hasMoreTokens())
+            {
+               String token = st.nextToken();
+               Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {token});
+               String response = (String)remotingClient.invoke(cmd);
+            }
+
+         }
       }
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
       }
-    }
-  }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/SaveTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/SaveTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/SaveTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -36,87 +36,108 @@
  * The save Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SaveTask extends AbstractTask {
+public class SaveTask extends AbstractTask
+{
 
-  /** The snapshot */
-  private int snapshot;
+   /** The snapshot */
+   private int snapshot;
 
-  /** Destination */
-  private File destination;
+   /** Destination */
+   private File destination;
 
-  /**
-   * Constructor
-   */
-  public SaveTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public SaveTask()
+   {
+      super();
+   }
 
-  /**
-   * Get the snapshot
-   * @return The snapshot
-   */
-  public int getSnapshot() {
-    return snapshot;
-  }
+   /**
+    * Get the snapshot
+    * @return The snapshot
+    */
+   public int getSnapshot()
+   {
+      return snapshot;
+   }
 
-  /**
-   * Set the snapshot
-   * @param s The snapshot
-   */
-  public void setSnapshot(int s) {
-    snapshot = s;
-  }
+   /**
+    * Set the snapshot
+    * @param s The snapshot
+    */
+   public void setSnapshot(int s)
+   {
+      snapshot = s;
+   }
 
-  /**
-   * Get the destination
-   * @return The destination
-   */
-  public File getDestination() {
-    return destination;
-  }
+   /**
+    * Get the destination
+    * @return The destination
+    */
+   public File getDestination()
+   {
+      return destination;
+   }
 
-  /**
-   * Set the destination
-   * @param d The destination
-   */
-  public void setDestination(File d) {
-    destination = d;
-  }
+   /**
+    * Set the destination
+    * @param d The destination
+    */
+   public void setDestination(File d)
+   {
+      destination = d;
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.SAVE, new Object[] {Integer.valueOf(snapshot)});
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.SAVE, new Object[] {Integer.valueOf(snapshot)});
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient =  new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
-      
-      if (snapshot != null) {
-        if (getDestination() == null) {
-          SnapshotHelper.save(snapshot);
-        } else {
-          SnapshotHelper.save(snapshot, getDestination());
-        }
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
+
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
+
+         if (snapshot != null)
+         {
+            if (getDestination() == null)
+            {
+               SnapshotHelper.save(snapshot);
+            }
+            else
+            {
+               SnapshotHelper.save(snapshot, getDestination());
+            }
+         }
+
       }
-      
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
       }
-    }
-  }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The start profiler Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class StartProfilerTask extends AbstractTask {
+public class StartProfilerTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public StartProfilerTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public StartProfilerTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.START_PROFILER);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.START_PROFILER);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient =  new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
-      
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
+
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,41 +32,54 @@
  * The stop profiler Ant task
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class StopProfilerTask extends AbstractTask {
+public class StopProfilerTask extends AbstractTask
+{
 
-  /**
-   * Constructor
-   */
-  public StopProfilerTask() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public StopProfilerTask()
+   {
+      super();
+   }
 
-  /**
-   * Execute Ant task
-   * @exception BuildException If an error occurs
-   */
-  public void execute() throws BuildException {
-    org.jboss.remoting.Client remotingClient = null;
-    try {
-      Command cmd = new Command(CommandType.STOP_PROFILER);
+   /**
+    * Execute Ant task
+    * @exception BuildException If an error occurs
+    */
+   public void execute() throws BuildException
+   {
+      org.jboss.remoting.Client remotingClient = null;
+      try
+      {
+         Command cmd = new Command(CommandType.STOP_PROFILER);
 
-      InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
-      
-      remotingClient = new org.jboss.remoting.Client(locator);
-      remotingClient.connect();
-      
-      String response = (String)remotingClient.invoke(cmd);
-      
-    } catch (Throwable t) {
-      throw new BuildException(t.getMessage(), t);
-    } finally {
-      if (remotingClient != null) {
-        try {
-          remotingClient.disconnect();
-        } catch (Throwable it) {
-          // Ignore
-        }
+         InvokerLocator locator = new InvokerLocator(getProtocol() +
+               "://" + getHost() + ":" + getPort());
+
+         remotingClient = new org.jboss.remoting.Client(locator);
+         remotingClient.connect();
+
+         String response = (String)remotingClient.invoke(cmd);
+
       }
-    }
-  }
+      catch (Throwable t)
+      {
+         throw new BuildException(t.getMessage(), t);
+      }
+      finally
+      {
+         if (remotingClient != null)
+         {
+            try
+            {
+               remotingClient.disconnect();
+            }
+            catch (Throwable it)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/as/Communicator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/as/Communicator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/as/Communicator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -36,364 +36,441 @@
  * The communicator class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Communicator implements CommunicatorMBean {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Communicator.class);
+public class Communicator implements CommunicatorMBean
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Communicator.class);
 
-  /** Host */
-  private String host;
+   /** Host */
+   private String host;
 
-  /** Socket */
-  private boolean socket;
+   /** Socket */
+   private boolean socket;
 
-  /** Socket port */
-  private int socketPort;
+   /** Socket port */
+   private int socketPort;
 
-  /** Socket connector */
-  private Connector socketConnector;
+   /** Socket connector */
+   private Connector socketConnector;
 
-  /** RMI */
-  private boolean rmi;
+   /** RMI */
+   private boolean rmi;
 
-  /** RMI port */
-  private int rmiPort;
+   /** RMI port */
+   private int rmiPort;
 
-  /** RMI connector */
-  private Connector rmiConnector;
+   /** RMI connector */
+   private Connector rmiConnector;
 
-  /** HTTP */
-  private boolean http;
+   /** HTTP */
+   private boolean http;
 
-  /** HTTP port */
-  private int httpPort;
+   /** HTTP port */
+   private int httpPort;
 
-  /** HTTP connector */
-  private Connector httpConnector;
+   /** HTTP connector */
+   private Connector httpConnector;
 
-  /** Communicator initialized */
-  private boolean initialized;
+   /** Communicator initialized */
+   private boolean initialized;
 
-  /**
-   * Constructor
-   */
-  public Communicator() {
-    host = System.getProperty("jboss.bind.address");
-    if (host == null || host.trim().equals("")) {
-      try {
-        host = InetAddress.getLocalHost().getHostName();
-      } catch (Throwable t) {
-        host = "localhost";
+   /**
+    * Constructor
+    */
+   public Communicator()
+   {
+      host = System.getProperty("jboss.bind.address");
+      if (host == null ||
+            host.trim().equals(""))
+      {
+         try
+         {
+            host = InetAddress.getLocalHost().getHostName();
+         }
+         catch (Throwable t)
+         {
+            host = "localhost";
+         }
       }
-    }
 
-    socket = true;
-    socketPort = 5400;
-    socketConnector = null;
+      socket = true;
+      socketPort = 5400;
+      socketConnector = null;
 
-    rmi = false;
-    rmiPort = 5401;
-    rmiConnector = null;
+      rmi = false;
+      rmiPort = 5401;
+      rmiConnector = null;
 
-    http = false;
-    httpPort = 5402;
-    httpConnector = null;
+      http = false;
+      httpPort = 5402;
+      httpConnector = null;
 
-    initialized = false;
-  }
+      initialized = false;
+   }
 
-  /**
-   * Get the host
-   * @return The host
-   */
-  public String getHost() {
-    return host;
-  }
+   /**
+    * Get the host
+    * @return The host
+    */
+   public String getHost()
+   {
+      return host;
+   }
 
-  /**
-   * Is socket enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isSocket() {
-    return socket;
-  }
+   /**
+    * Is socket enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isSocket()
+   {
+      return socket;
+   }
 
-  /**
-   * Enable / disable socket
-   * @param b True for enable; false for disable
-   */
-  public void setSocket(boolean b) {
-    try {
-      if (initialized && socket && !b) {
-        stopSocket();
+   /**
+    * Enable / disable socket
+    * @param b True for enable; false for disable
+    */
+   public void setSocket(boolean b)
+   {
+      try
+      {
+         if (initialized &&
+               socket && !b)
+         {
+            stopSocket();
+         }
+         if (initialized &&
+               !socket && b)
+         {
+            startSocket();
+         }
       }
-      if (initialized && !socket && b) {
-        startSocket();
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
 
-    socket = b;
-  }
+      socket = b;
+   }
 
-  /**
-   * Get the socket port
-   * @return The port
-   */
-  public int getSocketPort() {
-    return socketPort;
-  }
+   /**
+    * Get the socket port
+    * @return The port
+    */
+   public int getSocketPort()
+   {
+      return socketPort;
+   }
 
-  /**
-   * Set the socket port
-   * @param p The socket port
-   */
-  public void setSocketPort(int p) {
-    socketPort = p;
+   /**
+    * Set the socket port
+    * @param p The socket port
+    */
+   public void setSocketPort(int p)
+   {
+      socketPort = p;
 
-    try {
-      if (initialized && socket) {
-        stopSocket();
-        startSocket();
+      try
+      {
+         if (initialized &&
+               socket)
+         {
+            stopSocket();
+            startSocket();
+         }
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
-  }
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
+      }
+   }
 
-  /**
-   * Is rmi enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isRmi() {
-    return rmi;
-  }
+   /**
+    * Is rmi enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isRmi()
+   {
+      return rmi;
+   }
 
-  /**
-   * Enable / disable rmi
-   * @param b True for enable; false for disable
-   */
-  public void setRmi(boolean b) {
-    try {
-      if (initialized && rmi && !b) {
-        stopRMI();
+   /**
+    * Enable / disable rmi
+    * @param b True for enable; false for disable
+    */
+   public void setRmi(boolean b)
+   {
+      try
+      {
+         if (initialized &&
+               rmi && !b)
+         {
+            stopRMI();
+         }
+         if (initialized &&
+               !rmi && b)
+         {
+            startRMI();
+         }
       }
-      if (initialized && !rmi && b) {
-        startRMI();
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
 
-    rmi = b;
-  }
+      rmi = b;
+   }
 
-  /**
-   * Get the rmi port
-   * @return The port
-   */
-  public int getRmiPort() {
-    return rmiPort;
-  }
+   /**
+    * Get the rmi port
+    * @return The port
+    */
+   public int getRmiPort()
+   {
+      return rmiPort;
+   }
 
-  /**
-   * Set the rmi port
-   * @param p The rmi port
-   */
-  public void setRmiPort(int p) {
-    rmiPort = p;
+   /**
+    * Set the rmi port
+    * @param p The rmi port
+    */
+   public void setRmiPort(int p)
+   {
+      rmiPort = p;
 
-    try {
-      if (initialized && rmi) {
-        stopRMI();
-        startRMI();
+      try
+      {
+         if (initialized &&
+               rmi)
+         {
+            stopRMI();
+            startRMI();
+         }
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
-  }
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
+      }
+   }
 
-  /**
-   * Is http enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isHttp() {
-    return http;
-  }
+   /**
+    * Is http enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isHttp()
+   {
+      return http;
+   }
 
-  /**
-   * Enable / disable http
-   * @param b True for enable; false for disable
-   */
-  public void setHttp(boolean b) {
-    try {
-      if (initialized && http && !b) {
-        stopHTTP();
+   /**
+    * Enable / disable http
+    * @param b True for enable; false for disable
+    */
+   public void setHttp(boolean b)
+   {
+      try
+      {
+         if (initialized &&
+               http && !b)
+         {
+            stopHTTP();
+         }
+         if (initialized &&
+               !http && b)
+         {
+            startHTTP();
+         }
       }
-      if (initialized && !http && b) {
-        startHTTP();
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
 
-    http = b;
-  }
+      http = b;
+   }
 
-  /**
-   * Get the http port
-   * @return The port
-   */
-  public int getHttpPort() {
-    return httpPort;
-  }
+   /**
+    * Get the http port
+    * @return The port
+    */
+   public int getHttpPort()
+   {
+      return httpPort;
+   }
 
-  /**
-   * Set the http port
-   * @param p The http port
-   */
-  public void setHttpPort(int p) {
-    httpPort = p;
+   /**
+    * Set the http port
+    * @param p The http port
+    */
+   public void setHttpPort(int p)
+   {
+      httpPort = p;
 
-    try {
-      if (initialized && http) {
-        stopHTTP();
-        startHTTP();
+      try
+      {
+         if (initialized &&
+               http)
+         {
+            stopHTTP();
+            startHTTP();
+         }
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-    }
-  }
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
+      }
+   }
 
-  /**
-   * Start the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void start() throws Exception {
-    log.info("JBoss Profiler: Communicator for " + Version.FULL_VERSION);
+   /**
+    * Start the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void start() throws Exception
+   {
+      log.info("JBoss Profiler: Communicator for " +
+            Version.FULL_VERSION);
 
-    try {
-      if (socket) {
-        startSocket();
+      try
+      {
+         if (socket)
+         {
+            startSocket();
+         }
+         if (rmi)
+         {
+            startRMI();
+         }
+         if (http)
+         {
+            startHTTP();
+         }
       }
-      if (rmi) {
-        startRMI();
+      catch (Exception e)
+      {
+         log.error(e.getMessage(), e);
+         throw e;
       }
-      if (http) {
-        startHTTP();
+
+      initialized = true;
+   }
+
+   /**
+    * Stop the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void stop() throws Exception
+   {
+      stopSocket();
+      stopRMI();
+      stopHTTP();
+
+      initialized = false;
+
+      log.info("JBoss Profiler: Communicator stopped");
+   }
+
+   /**
+    * Start socket
+    * @exception Exception If an error occurs
+    */
+   private void startSocket() throws Exception
+   {
+      InvokerLocator locator = new InvokerLocator("socket://" +
+            host + ":" + Integer.toString(socketPort));
+
+      socketConnector = new Connector(locator);
+      socketConnector.create();
+
+      SocketHandler socketHandler = new SocketHandler();
+
+      socketConnector.addInvocationHandler("jboss-profiler-socket", socketHandler);
+      socketConnector.start();
+
+      log.info("JBoss Profiler: Socket=" +
+            host + ":" + Integer.toString(socketPort));
+   }
+
+   /**
+    * Stop socket
+    * @exception Exception If an error occurs
+    */
+   private void stopSocket() throws Exception
+   {
+      if (socketConnector != null)
+      {
+         socketConnector.stop();
+         socketConnector.destroy();
       }
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-      throw e;
-    }
+      socketConnector = null;
+   }
 
-    initialized = true;
-  }
+   /**
+    * Start RMI
+    * @exception Exception If an error occurs
+    */
+   private void startRMI() throws Exception
+   {
+      InvokerLocator locator = new InvokerLocator("rmi://" +
+            host + ":" + Integer.toString(rmiPort));
 
-  /**
-   * Stop the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void stop() throws Exception {
-    stopSocket();
-    stopRMI();
-    stopHTTP();
+      rmiConnector = new Connector(locator);
+      rmiConnector.create();
 
-    initialized = false;
+      RmiHandler rmiHandler = new RmiHandler();
 
-    log.info("JBoss Profiler: Communicator stopped");
-  }
+      rmiConnector.addInvocationHandler("jboss-profiler-rmi", rmiHandler);
+      rmiConnector.start();
 
-  /**
-   * Start socket
-   * @exception Exception If an error occurs
-   */
-  private void startSocket() throws Exception {
-    InvokerLocator locator = 
-      new InvokerLocator("socket://" + host + ":" + Integer.toString(socketPort));
-    
-    socketConnector = new Connector(locator);
-    socketConnector.create();
-    
-    SocketHandler socketHandler = new SocketHandler();
-    
-    socketConnector.addInvocationHandler("jboss-profiler-socket", socketHandler);
-    socketConnector.start();
-    
-    log.info("JBoss Profiler: Socket=" + host + ":" + Integer.toString(socketPort));
-  }
+      log.info("JBoss Profiler: Rmi=" +
+            host + ":" + Integer.toString(rmiPort));
+   }
 
-  /**
-   * Stop socket
-   * @exception Exception If an error occurs
-   */
-  private void stopSocket() throws Exception {
-    if (socketConnector != null) {
-      socketConnector.stop();
-      socketConnector.destroy();
-    }
-    socketConnector = null;
-  }
+   /**
+    * Stop RMI
+    * @exception Exception If an error occurs
+    */
+   private void stopRMI() throws Exception
+   {
+      if (rmiConnector != null)
+      {
+         rmiConnector.stop();
+         rmiConnector.destroy();
+      }
+      rmiConnector = null;
+   }
 
-  /**
-   * Start RMI
-   * @exception Exception If an error occurs
-   */
-  private void startRMI() throws Exception {
-    InvokerLocator locator = 
-      new InvokerLocator("rmi://" + host + ":" + Integer.toString(rmiPort));
-    
-    rmiConnector = new Connector(locator);
-    rmiConnector.create();
-    
-    RmiHandler rmiHandler = new RmiHandler();
-    
-    rmiConnector.addInvocationHandler("jboss-profiler-rmi", rmiHandler);
-    rmiConnector.start();
-    
-    log.info("JBoss Profiler: Rmi=" + host + ":" + Integer.toString(rmiPort));
-  }
+   /**
+    * Start HTTP
+    * @exception Exception If an error occurs
+    */
+   private void startHTTP() throws Exception
+   {
+      InvokerLocator locator = new InvokerLocator("http://" +
+            host + ":" + Integer.toString(httpPort));
 
-  /**
-   * Stop RMI
-   * @exception Exception If an error occurs
-   */
-  private void stopRMI() throws Exception {
-    if (rmiConnector != null) {
-      rmiConnector.stop();
-      rmiConnector.destroy();
-    }
-    rmiConnector = null;
-  }
+      httpConnector = new Connector(locator);
+      httpConnector.create();
 
-  /**
-   * Start HTTP
-   * @exception Exception If an error occurs
-   */
-  private void startHTTP() throws Exception {
-    InvokerLocator locator = 
-      new InvokerLocator("http://" + host + ":" + Integer.toString(httpPort));
-    
-    httpConnector = new Connector(locator);
-    httpConnector.create();
-    
-    HttpHandler httpHandler = new HttpHandler();
-    
-    httpConnector.addInvocationHandler("jboss-profiler-http", httpHandler);
-    httpConnector.start();
-        
-    log.info("JBoss Profiler: Http=" + host + ":" + Integer.toString(httpPort));
-  }
+      HttpHandler httpHandler = new HttpHandler();
 
-  /**
-   * Stop HTTP
-   * @exception Exception If an error occurs
-   */
-  private void stopHTTP() throws Exception {
-    if (httpConnector != null) {
-      httpConnector.stop();
-      httpConnector.destroy();
-    }
-    httpConnector = null;
-  }
+      httpConnector.addInvocationHandler("jboss-profiler-http", httpHandler);
+      httpConnector.start();
+
+      log.info("JBoss Profiler: Http=" +
+            host + ":" + Integer.toString(httpPort));
+   }
+
+   /**
+    * Stop HTTP
+    * @exception Exception If an error occurs
+    */
+   private void stopHTTP() throws Exception
+   {
+      if (httpConnector != null)
+      {
+         httpConnector.stop();
+         httpConnector.destroy();
+      }
+      httpConnector = null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/as/CommunicatorMBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/as/CommunicatorMBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/as/CommunicatorMBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,95 +25,96 @@
  * The communicator mbean
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface CommunicatorMBean {
+public interface CommunicatorMBean
+{
 
-  /**
-   * Get the host
-   * @return The host
-   */
-  public String getHost();
+   /**
+    * Get the host
+    * @return The host
+    */
+   public String getHost();
 
-  /**
-   * Is socket enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isSocket();
+   /**
+    * Is socket enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isSocket();
 
-  /**
-   * Enable / disable socket
-   * @param b True for enable; false for disable
-   */
-  public void setSocket(boolean b);
+   /**
+    * Enable / disable socket
+    * @param b True for enable; false for disable
+    */
+   public void setSocket(boolean b);
 
-  /**
-   * Get the socket port
-   * @return The port
-   */
-  public int getSocketPort();
+   /**
+    * Get the socket port
+    * @return The port
+    */
+   public int getSocketPort();
 
-  /**
-   * Set the socket port
-   * @param p The socket port
-   */
-  public void setSocketPort(int p);
+   /**
+    * Set the socket port
+    * @param p The socket port
+    */
+   public void setSocketPort(int p);
 
-  /**
-   * Is rmi enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isRmi();
+   /**
+    * Is rmi enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isRmi();
 
-  /**
-   * Enable / disable rmi
-   * @param b True for enable; false for disable
-   */
-  public void setRmi(boolean b);
+   /**
+    * Enable / disable rmi
+    * @param b True for enable; false for disable
+    */
+   public void setRmi(boolean b);
 
-  /**
-   * Get the rmi port
-   * @return The port
-   */
-  public int getRmiPort();
+   /**
+    * Get the rmi port
+    * @return The port
+    */
+   public int getRmiPort();
 
-  /**
-   * Set the rmi port
-   * @param p The rmi port
-   */
-  public void setRmiPort(int p);
+   /**
+    * Set the rmi port
+    * @param p The rmi port
+    */
+   public void setRmiPort(int p);
 
-  /**
-   * Is http enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isHttp();
+   /**
+    * Is http enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isHttp();
 
-  /**
-   * Enable / disable http
-   * @param b True for enable; false for disable
-   */
-  public void setHttp(boolean b);
+   /**
+    * Enable / disable http
+    * @param b True for enable; false for disable
+    */
+   public void setHttp(boolean b);
 
-  /**
-   * Get the http port
-   * @return The port
-   */
-  public int getHttpPort();
+   /**
+    * Get the http port
+    * @return The port
+    */
+   public int getHttpPort();
 
-  /**
-   * Set the http port
-   * @param p The http port
-   */
-  public void setHttpPort(int p);
+   /**
+    * Set the http port
+    * @param p The http port
+    */
+   public void setHttpPort(int p);
 
-  /**
-   * Start the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void start() throws Exception;
+   /**
+    * Start the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void start() throws Exception;
 
-  /**
-   * Stop the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void stop() throws Exception;
+   /**
+    * Stop the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void stop() throws Exception;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/as/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/as/Profiler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/as/Profiler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -33,193 +33,224 @@
  * The profiler mbean class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Profiler implements ProfilerMBean {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Profiler.class);
+public class Profiler implements ProfilerMBean
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Profiler.class);
 
-  /**
-   * Constructor
-   */
-  public Profiler() {
-  }
+   /**
+    * Constructor
+    */
+   public Profiler()
+   {
+   }
 
-  /**
-   * Is the profiler enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isEnabled() {
-    return Agent.isEnabled();
-  }
+   /**
+    * Is the profiler enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isEnabled()
+   {
+      return Agent.isEnabled();
+   }
 
-  /**
-   * Is the profiler running ?
-   * @return True if running; otherwise false
-   */
-  public boolean isRunning() {
-    return org.jboss.profiler.agent.Profiler.isRunning();
-  }
+   /**
+    * Is the profiler running ?
+    * @return True if running; otherwise false
+    */
+   public boolean isRunning()
+   {
+      return org.jboss.profiler.agent.Profiler.isRunning();
+   }
 
-  /**
-   * Is the profiler using a memory store ?
-   * @return True if memory store; otherwise false
-   */
-  public boolean isMemory() {
-    return Agent.isMemoryStore();
-  }
+   /**
+    * Is the profiler using a memory store ?
+    * @return True if memory store; otherwise false
+    */
+   public boolean isMemory()
+   {
+      return Agent.isMemoryStore();
+   }
 
-  /**
-   * Is the profiler using a file store ?
-   * @return True if file store; otherwise false
-   */
-  public boolean isFile() {
-    return !Agent.isMemoryStore();
-  }
+   /**
+    * Is the profiler using a file store ?
+    * @return True if file store; otherwise false
+    */
+   public boolean isFile()
+   {
+      return !Agent.isMemoryStore();
+   }
 
-  /**
-   * Is EJB ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isEJB() {
-    return Agent.isEJB();
-  }
+   /**
+    * Is EJB ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isEJB()
+   {
+      return Agent.isEJB();
+   }
 
-  /**
-   * Is Servlet ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isServlet() {
-    return Agent.isServlet();
-  }
+   /**
+    * Is Servlet ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isServlet()
+   {
+      return Agent.isServlet();
+   }
 
-  /**
-   * Is JSF ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isJSF() {
-    return Agent.isJSF();
-  }
+   /**
+    * Is JSF ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isJSF()
+   {
+      return Agent.isJSF();
+   }
 
-  /**
-   * Is JMX ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isJMX() {
-    return Agent.isJMX();
-  }
+   /**
+    * Is JMX ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isJMX()
+   {
+      return Agent.isJMX();
+   }
 
-  /**
-   * Is RMI ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isRMI() {
-    return Agent.isRMI();
-  }
+   /**
+    * Is RMI ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isRMI()
+   {
+      return Agent.isRMI();
+   }
 
-  /**
-   * Is CORBA ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isCORBA() {
-    return Agent.isCORBA();
-  }
+   /**
+    * Is CORBA ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isCORBA()
+   {
+      return Agent.isCORBA();
+   }
 
-  /**
-   * Start the profiler
-   */
-  public void startProfiler() {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.START_PROFILER));
-  }
+   /**
+    * Start the profiler
+    */
+   public void startProfiler()
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.START_PROFILER));
+   }
 
-  /**
-   * Stop the profiler
-   */
-  public void stopProfiler() {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.STOP_PROFILER));
-  }
+   /**
+    * Stop the profiler
+    */
+   public void stopProfiler()
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.STOP_PROFILER));
+   }
 
-  /**
-   * Enable the profiler
-   */
-  public void enableProfiler() {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.ENABLE));
-  }
+   /**
+    * Enable the profiler
+    */
+   public void enableProfiler()
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.ENABLE));
+   }
 
-  /**
-   * Disable the profiler
-   */
-  public void disableProfiler() {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.DISABLE));
-  }
+   /**
+    * Disable the profiler
+    */
+   public void disableProfiler()
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.DISABLE));
+   }
 
-  /**
-   * Add classes
-   * @param classes The classes
-   * @param v The visibility
-   */
-  public void addClasses(String classes, String v) {
-    LocalHandler lh = new LocalHandler();
+   /**
+    * Add classes
+    * @param classes The classes
+    * @param v The visibility
+    */
+   public void addClasses(String classes, String v)
+   {
+      LocalHandler lh = new LocalHandler();
 
-    if (v == null || v.trim().equals("")) {
-      v = "public";
-    }
+      if (v == null ||
+            v.trim().equals(""))
+      {
+         v = "public";
+      }
 
-    Visibility vi = null;
-    if (v.equalsIgnoreCase("private")) {
-      vi = Visibility.PRIVATE;
-    } else if (v.equalsIgnoreCase("protected")) {
-      vi = Visibility.PROTECTED;
-    } else if (v.equalsIgnoreCase("package")) {
-      vi = Visibility.PACKAGE;
-    } else {
-      vi = Visibility.PUBLIC;
-    }
+      Visibility vi = null;
+      if (v.equalsIgnoreCase("private"))
+      {
+         vi = Visibility.PRIVATE;
+      }
+      else if (v.equalsIgnoreCase("protected"))
+      {
+         vi = Visibility.PROTECTED;
+      }
+      else if (v.equalsIgnoreCase("package"))
+      {
+         vi = Visibility.PACKAGE;
+      }
+      else
+      {
+         vi = Visibility.PUBLIC;
+      }
 
-    lh.handleCommand(new Command(CommandType.ADD_CLASSES, new Object[] {classes, vi}));
-  }
+      lh.handleCommand(new Command(CommandType.ADD_CLASSES, new Object[] {classes, vi}));
+   }
 
-  /**
-   * Remove classes
-   * @param classes The classes
-   */
-  public void removeClasses(String classes) {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.REMOVE_CLASSES, new Object[] {classes}));
-  }
+   /**
+    * Remove classes
+    * @param classes The classes
+    */
+   public void removeClasses(String classes)
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.REMOVE_CLASSES, new Object[] {classes}));
+   }
 
-  /**
-   * List classes
-   * @return The classes
-   */
-  public String[] listClasses() {
-    LocalHandler lh = new LocalHandler();
-    return (String[])lh.handleCommand(new Command(CommandType.LIST_CLASSES));
-  }
+   /**
+    * List classes
+    * @return The classes
+    */
+   public String[] listClasses()
+   {
+      LocalHandler lh = new LocalHandler();
+      return (String[])lh.handleCommand(new Command(CommandType.LIST_CLASSES));
+   }
 
-  /**
-   * Clear snapshots
-   */
-  public void clearSnapshots() {
-    LocalHandler lh = new LocalHandler();
-    lh.handleCommand(new Command(CommandType.CLEAR_SNAPSHOTS));
-  }
+   /**
+    * Clear snapshots
+    */
+   public void clearSnapshots()
+   {
+      LocalHandler lh = new LocalHandler();
+      lh.handleCommand(new Command(CommandType.CLEAR_SNAPSHOTS));
+   }
 
-  /**
-   * Start the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void start() throws Exception {
-    log.info("JBoss Profiler: ProfilerMBean started");
-  }
+   /**
+    * Start the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void start() throws Exception
+   {
+      log.info("JBoss Profiler: ProfilerMBean started");
+   }
 
-  /**
-   * Stop the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void stop() throws Exception {
-    log.info("JBoss Profiler: ProfilerMBean stopped");
-  }
+   /**
+    * Stop the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void stop() throws Exception
+   {
+      log.info("JBoss Profiler: ProfilerMBean stopped");
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/as/ProfilerMBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/as/ProfilerMBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/as/ProfilerMBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,127 +21,127 @@
  */
 package org.jboss.profiler.as;
 
-import org.jboss.profiler.shared.Visibility;
 
 /**
  * The profiler mbean
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface ProfilerMBean {
+public interface ProfilerMBean
+{
 
-  /**
-   * Is the profiler enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isEnabled();
+   /**
+    * Is the profiler enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isEnabled();
 
-  /**
-   * Is the profiler running ?
-   * @return True if running; otherwise false
-   */
-  public boolean isRunning();
+   /**
+    * Is the profiler running ?
+    * @return True if running; otherwise false
+    */
+   public boolean isRunning();
 
-  /**
-   * Is the profiler using a memory store ?
-   * @return True if memory store; otherwise false
-   */
-  public boolean isMemory();
+   /**
+    * Is the profiler using a memory store ?
+    * @return True if memory store; otherwise false
+    */
+   public boolean isMemory();
 
-  /**
-   * Is the profiler using a file store ?
-   * @return True if file store; otherwise false
-   */
-  public boolean isFile();
+   /**
+    * Is the profiler using a file store ?
+    * @return True if file store; otherwise false
+    */
+   public boolean isFile();
 
-  /**
-   * Is EJB ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isEJB();
+   /**
+    * Is EJB ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isEJB();
 
-  /**
-   * Is Servlet ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isServlet();
+   /**
+    * Is Servlet ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isServlet();
 
-  /**
-   * Is JSF ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isJSF();
+   /**
+    * Is JSF ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isJSF();
 
-  /**
-   * Is JMX ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isJMX();
+   /**
+    * Is JMX ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isJMX();
 
-  /**
-   * Is RMI ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isRMI();
+   /**
+    * Is RMI ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isRMI();
 
-  /**
-   * Is CORBA ?
-   * @return True if enabled; otherwise false
-   */
-  public boolean isCORBA();
+   /**
+    * Is CORBA ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isCORBA();
 
-  /**
-   * Start the profiler
-   */
-  public void startProfiler();
+   /**
+    * Start the profiler
+    */
+   public void startProfiler();
 
-  /**
-   * Stop the profiler
-   */
-  public void stopProfiler();
+   /**
+    * Stop the profiler
+    */
+   public void stopProfiler();
 
-  /**
-   * Enable the profiler
-   */
-  public void enableProfiler();
+   /**
+    * Enable the profiler
+    */
+   public void enableProfiler();
 
-  /**
-   * Disable the profiler
-   */
-  public void disableProfiler();
+   /**
+    * Disable the profiler
+    */
+   public void disableProfiler();
 
-  /**
-   * Add classes
-   * @param classes The classes
-   * @param v The visibility
-   */
-  public void addClasses(String classes, String v);
+   /**
+    * Add classes
+    * @param classes The classes
+    * @param v The visibility
+    */
+   public void addClasses(String classes, String v);
 
-  /**
-   * Remove classes
-   * @param classes The classes
-   */
-  public void removeClasses(String classes);
+   /**
+    * Remove classes
+    * @param classes The classes
+    */
+   public void removeClasses(String classes);
 
-  /**
-   * List classes
-   * @return The classes
-   */
-  public String[] listClasses();
+   /**
+    * List classes
+    * @return The classes
+    */
+   public String[] listClasses();
 
-  /**
-   * Clear snapshots
-   */
-  public void clearSnapshots();
+   /**
+    * Clear snapshots
+    */
+   public void clearSnapshots();
 
-  /**
-   * Start the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void start() throws Exception;
+   /**
+    * Start the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void start() throws Exception;
 
-  /**
-   * Stop the service
-   * @exception Exception Thrown if an exception occurs
-   */
-  public void stop() throws Exception;
+   /**
+    * Stop the service
+    * @exception Exception Thrown if an exception occurs
+    */
+   public void stop() throws Exception;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,55 +28,73 @@
  * Frame comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class CombinedFrameComparator implements Comparator<CombinedFrameInfo>, Serializable {
+public class CombinedFrameComparator implements Comparator<CombinedFrameInfo>, Serializable
+{
 
-  /** Method: TOTAL TIME */
-  public static final int TOTAL_TIME = 0;
+   /** Method: TOTAL TIME */
+   public static final int TOTAL_TIME = 0;
 
-  /** Method: TOTAL TIME AVG */
-  public static final int TOTAL_TIME_AVG = 1;
+   /** Method: TOTAL TIME AVG */
+   public static final int TOTAL_TIME_AVG = 1;
 
-  /** The method */
-  private int method;
+   /** The method */
+   private int method;
 
-  /**
-   * Constructor
-   * @param method The method
-   */
-  public CombinedFrameComparator(int method) {
-    this.method = method;
-  }
+   /**
+    * Constructor
+    * @param method The method
+    */
+   public CombinedFrameComparator(int method)
+   {
+      this.method = method;
+   }
 
-  /**
-   * Compare two objects
-   * @param fa Combined frame info
-   * @param fb Combined frame info
-   * @return Positive if fb greater than fa; zero if equal otherwise negative
-   */
-  public int compare(CombinedFrameInfo fa, CombinedFrameInfo fb) {
-    double va;
-    double vb;
+   /**
+    * Compare two objects
+    * @param fa Combined frame info
+    * @param fb Combined frame info
+    * @return Positive if fb greater than fa; zero if equal otherwise negative
+    */
+   public int compare(CombinedFrameInfo fa, CombinedFrameInfo fb)
+   {
+      double va;
+      double vb;
 
-    if (method == TOTAL_TIME) {
-      va = fa.getTotalTime();
-      vb = fb.getTotalTime();
-    } else {
-      va = fa.getTotalTime() / fa.getCount();
-      vb = fb.getTotalTime() / fb.getCount();
-    }
+      if (method == TOTAL_TIME)
+      {
+         va = fa.getTotalTime();
+         vb = fb.getTotalTime();
+      }
+      else
+      {
+         va = fa.getTotalTime() /
+               fa.getCount();
+         vb = fb.getTotalTime() /
+               fb.getCount();
+      }
 
-    if (va < vb) {
-      return 1;
-    } else if (va == vb) { 
-      if (fa.getCount() < fb.getCount()) {
-        return 1;
-      } else if (fa.getCount() == fb.getCount()) { 
-        return fa.getPrettyName().compareTo(fb.getPrettyName());
-      } else {
-        return -1;
+      if (va < vb)
+      {
+         return 1;
       }
-    } else {
-      return -1;
-    }
-  }
+      else if (va == vb)
+      {
+         if (fa.getCount() < fb.getCount())
+         {
+            return 1;
+         }
+         else if (fa.getCount() == fb.getCount())
+         {
+            return fa.getPrettyName().compareTo(fb.getPrettyName());
+         }
+         else
+         {
+            return -1;
+         }
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/CombinedFrameInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,131 +21,144 @@
  */
 package org.jboss.profiler.client;
 
-import org.jboss.profiler.shared.FrameInfo;
 
 /**
  * The combined frame info class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class CombinedFrameInfo {
-  /** The class name */
-  private String className;
+public class CombinedFrameInfo
+{
+   /** The class name */
+   private String className;
 
-  /** The pretty name */
-  private String prettyName;
+   /** The pretty name */
+   private String prettyName;
 
-  /** The count */
-  private long count;
+   /** The count */
+   private long count;
 
-  /** The time */
-  private double time;
+   /** The time */
+   private double time;
 
-  /** The percent */
-  private double percent;
-  
-  /** The wait */
-  private double wait;
+   /** The percent */
+   private double percent;
 
-  /**
-   * Constructor
-   * @param className The class name
-   * @param prettyName The pretty name
-   */
-  public CombinedFrameInfo(String className, String prettyName) {
-    this.className = className;
-    this.prettyName = prettyName;
-    this.count = 0;
-    this.time = 0.0;
-    this.percent = 0.0;
-    this.wait = 0.0;
-  }
-  
-  /**
-   * Get the count (#)
-   * @return The count
-   */
-  public long getCount() {
-    return count;
-  }
-  
-  /**
-   * Get the time (ms)
-   * @return The time
-   */
-  public double getTotalTime() {
-    return time;
-  }
-  
-  /**
-   * Get the percent (%)
-   * @return The percent
-   */
-  public double getPercent() {
-    return percent;
-  }
-  
-  /**
-   * Get the class name
-   * @return The class name
-   */
-  public String getClassName() {
-    return className;
-  }
-  
-  /**
-   * Get the pretty name
-   * @return The pretty name
-   */
-  public String getPrettyName() {
-    return prettyName;
-  }
-  
-  /**
-   * Get the time (ms)
-   * @return The time
-   */
-  public double getWaitTime() {
-    return wait;
-  }
-  
-  /**
-   * Increase the count (#)
-   * @param c The count
-   */
-  public void increaseCount(long c) {
-    count += c;
-  }
-  
-  /**
-   * Increase the time (ms)
-   * @param t The time
-   */
-  public void increaseTotalTime(double t) {
-    time += t;
-  }
-  
-  /**
-   * Increase the percent (%)
-   * @param p The percent
-   */
-  public void increasePercent(double p) {
-    percent += p;
-  }
+   /** The wait */
+   private double wait;
 
-  /**
-   * Increase the wait time (ms)
-   * @param t The wait time
-   */
-  public void increaseWaitTime(double t) {
-    wait += t;
-  }
+   /**
+    * Constructor
+    * @param className The class name
+    * @param prettyName The pretty name
+    */
+   public CombinedFrameInfo(String className, String prettyName)
+   {
+      this.className = className;
+      this.prettyName = prettyName;
+      this.count = 0;
+      this.time = 0.0;
+      this.percent = 0.0;
+      this.wait = 0.0;
+   }
 
-  /**
-   * Get the string representation
-   * @return The string
-   */
-  @Override
-  public String toString() {
-    return className + "," + prettyName + "," + count + "," + time  + "," + percent  + "," + wait;  
-  }
+   /**
+    * Get the count (#)
+    * @return The count
+    */
+   public long getCount()
+   {
+      return count;
+   }
+
+   /**
+    * Get the time (ms)
+    * @return The time
+    */
+   public double getTotalTime()
+   {
+      return time;
+   }
+
+   /**
+    * Get the percent (%)
+    * @return The percent
+    */
+   public double getPercent()
+   {
+      return percent;
+   }
+
+   /**
+    * Get the class name
+    * @return The class name
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Get the pretty name
+    * @return The pretty name
+    */
+   public String getPrettyName()
+   {
+      return prettyName;
+   }
+
+   /**
+    * Get the time (ms)
+    * @return The time
+    */
+   public double getWaitTime()
+   {
+      return wait;
+   }
+
+   /**
+    * Increase the count (#)
+    * @param c The count
+    */
+   public void increaseCount(long c)
+   {
+      count += c;
+   }
+
+   /**
+    * Increase the time (ms)
+    * @param t The time
+    */
+   public void increaseTotalTime(double t)
+   {
+      time += t;
+   }
+
+   /**
+    * Increase the percent (%)
+    * @param p The percent
+    */
+   public void increasePercent(double p)
+   {
+      percent += p;
+   }
+
+   /**
+    * Increase the wait time (ms)
+    * @param t The wait time
+    */
+   public void increaseWaitTime(double t)
+   {
+      wait += t;
+   }
+
+   /**
+    * Get the string representation
+    * @return The string
+    */
+   @Override
+   public String toString()
+   {
+      return className +
+            "," + prettyName + "," + count + "," + time + "," + percent + "," + wait;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/DifferenceUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/DifferenceUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/DifferenceUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,20 +21,14 @@
  */
 package org.jboss.profiler.client;
 
-import org.jboss.profiler.shared.AllocationInfo;
-import org.jboss.profiler.shared.ClassInfo;
 import org.jboss.profiler.shared.FrameInfo;
-import org.jboss.profiler.shared.MethodInfo;
-import org.jboss.profiler.shared.MethodRepository;
 import org.jboss.profiler.shared.Snapshot;
 import org.jboss.profiler.shared.ThreadInfo;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
-import java.io.Writer;
 import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
@@ -51,359 +45,426 @@
  * The difference utility class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class DifferenceUtil extends SnapshotUtil {
-  /** The logger */
-  private static Logger log = Logger.getLogger(DifferenceUtil.class);
+public class DifferenceUtil extends SnapshotUtil
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(DifferenceUtil.class);
 
-  /**
-   * Constructor
-   */
-  public DifferenceUtil() {
-    super();
-  }
+   /**
+    * Constructor
+    */
+   public DifferenceUtil()
+   {
+      super();
+   }
 
-  /**
-   * Constructor
-   * @param threshold The threshold
-   */
-  public DifferenceUtil(double threshold) {
-    super(threshold);
-  }
+   /**
+    * Constructor
+    * @param threshold The threshold
+    */
+   public DifferenceUtil(double threshold)
+   {
+      super(threshold);
+   }
 
-  /**
-   * Dump the difference between two snapshots to a directory
-   * @param os The old snapshot
-   * @param ns The new snapshot
-   * @param d The directory
-   * @exception Exception If an error occurs
-   */
-  public void dump(Snapshot os, Snapshot ns, File d) throws Exception {
-    if (os != null && ns != null) {
-      StringBuffer sb = new StringBuffer();
-      DecimalFormat df = new DecimalFormat("00");
-      DecimalFormat df3 = new DecimalFormat("000");
+   /**
+    * Dump the difference between two snapshots to a directory
+    * @param os The old snapshot
+    * @param ns The new snapshot
+    * @param d The directory
+    * @exception Exception If an error occurs
+    */
+   public void dump(Snapshot os, Snapshot ns, File d) throws Exception
+   {
+      if (os != null &&
+            ns != null)
+      {
+         StringBuffer sb = new StringBuffer();
+         DecimalFormat df = new DecimalFormat("00");
+         DecimalFormat df3 = new DecimalFormat("000");
 
-      Calendar c = Calendar.getInstance();
-      c.setTime(os.getFrom());
+         Calendar c = Calendar.getInstance();
+         c.setTime(os.getFrom());
 
-      sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
-      sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
-      sb = sb.append(df.format(c.get(Calendar.DATE)));
-      sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
-      sb = sb.append(df.format(c.get(Calendar.MINUTE)));
-      sb = sb.append(df.format(c.get(Calendar.SECOND)));
-      sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
+         sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
+         sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
+         sb = sb.append(df.format(c.get(Calendar.DATE)));
+         sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
+         sb = sb.append(df.format(c.get(Calendar.MINUTE)));
+         sb = sb.append(df.format(c.get(Calendar.SECOND)));
+         sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
 
-      sb = sb.append("-");
-      
-      c.setTime(ns.getTo());
-      sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
-      sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
-      sb = sb.append(df.format(c.get(Calendar.DATE)));
-      sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
-      sb = sb.append(df.format(c.get(Calendar.MINUTE)));
-      sb = sb.append(df.format(c.get(Calendar.SECOND)));
-      sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
+         sb = sb.append("-");
 
-      File dir = new File(d, sb.toString());
-      dir.mkdirs();
+         c.setTime(ns.getTo());
+         sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
+         sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
+         sb = sb.append(df.format(c.get(Calendar.DATE)));
+         sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
+         sb = sb.append(df.format(c.get(Calendar.MINUTE)));
+         sb = sb.append(df.format(c.get(Calendar.SECOND)));
+         sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
 
-      String directory = dir.getPath() + File.separator;
+         File dir = new File(d, sb.toString());
+         dir.mkdirs();
 
-      Map<String, List<CombinedFrameInfo>> oInfo = getInformation(os);
-      List<TimedClassInfo> oClasses = getTimedClasses(os.getClasses(), oInfo);
+         String directory = dir.getPath() +
+               File.separator;
 
-      Map<String, List<CombinedFrameInfo>> nInfo = getInformation(ns);
-      List<TimedClassInfo> nClasses = getTimedClasses(ns.getClasses(), nInfo);
+         Map<String, List<CombinedFrameInfo>> oInfo = getInformation(os);
+         List<TimedClassInfo> oClasses = getTimedClasses(os.getClasses(), oInfo);
 
-      dumpThreads(ns.getMethodRepository(), ns.getThreads(), directory);
-      dumpOverview(ns, nInfo, nClasses, directory);
-      dumpMethods(oInfo, nInfo, directory);
-      dumpHotspots(nInfo, directory);
-      dumpClasses(nClasses, nInfo, ns.getAllocations(), directory);
-    }
-  }
+         Map<String, List<CombinedFrameInfo>> nInfo = getInformation(ns);
+         List<TimedClassInfo> nClasses = getTimedClasses(ns.getClasses(), nInfo);
 
-  /**
-   * Dump the threads to a file writer
-   * @param os The old threads
-   * @param ns The new threads
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  private void dumpThreads(List<ThreadInfo> ots, List<ThreadInfo> nts, String directory) throws Exception {
-    File f = new File(directory + "threads");
-    f.mkdirs();
+         dumpThreads(ns.getMethodRepository(), ns.getThreads(), directory);
+         dumpOverview(ns, nInfo, nClasses, directory);
+         dumpMethods(oInfo, nInfo, directory);
+         dumpHotspots(nInfo, directory);
+         dumpClasses(nClasses, nInfo, ns.getAllocations(), directory);
+      }
+   }
 
-    Set<ThreadHolder> ths = matchThreads(ots, nts);
-    for (ThreadHolder th : ths) {
-      FileWriter ftw = new FileWriter(directory + "threads" + File.separator + 
-                                      "thread-" + th.getNew().getId() + ".txt");
-      BufferedWriter bw = new BufferedWriter(ftw, 8192);
+   /**
+    * Dump the threads to a file writer
+    * @param os The old threads
+    * @param ns The new threads
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   private void dumpThreads(List<ThreadInfo> ots, List<ThreadInfo> nts, String directory) throws Exception
+   {
+      File f = new File(directory +
+            "threads");
+      f.mkdirs();
 
-      bw.write("Thread: " + th.getNew().getId() + NEW_LINE);
-      bw.write("Name: " + th.getNew().getName() + NEW_LINE);
-      bw.write("Priority: " + th.getNew().getPriority() + NEW_LINE);
-      bw.write("Daemon: " + th.getNew().isDaemon() + NEW_LINE);
+      Set<ThreadHolder> ths = matchThreads(ots, nts);
+      for (ThreadHolder th : ths)
+      {
+         FileWriter ftw = new FileWriter(directory +
+               "threads" + File.separator + "thread-" + th.getNew().getId() + ".txt");
+         BufferedWriter bw = new BufferedWriter(ftw, 8192);
 
-      if (th.getNew().getGroups() != null) {
-        bw.write("Groups: ");
+         bw.write("Thread: " +
+               th.getNew().getId() + NEW_LINE);
+         bw.write("Name: " +
+               th.getNew().getName() + NEW_LINE);
+         bw.write("Priority: " +
+               th.getNew().getPriority() + NEW_LINE);
+         bw.write("Daemon: " +
+               th.getNew().isDaemon() + NEW_LINE);
 
-        Iterator it = th.getNew().getGroups().iterator();
-        while (it.hasNext()) {
-          String g = (String)it.next();
-          bw.write(g);
-          if (it.hasNext()) {
-            bw.write(" -> ");
-          }
-        }
+         if (th.getNew().getGroups() != null)
+         {
+            bw.write("Groups: ");
 
-        bw.write(NEW_LINE);
-      }
-      
-      bw.write(NEW_LINE);
+            Iterator it = th.getNew().getGroups().iterator();
+            while (it.hasNext())
+            {
+               String g = (String)it.next();
+               bw.write(g);
+               if (it.hasNext())
+               {
+                  bw.write(" -> ");
+               }
+            }
 
-      /*
-      int frameNumber = 1;
+            bw.write(NEW_LINE);
+         }
 
-      for (FrameInfo fi: th.getNew().getFrames()) {
-        dumpFrame(fi, frameNumber, bw);
-        frameNumber++;
-        bw.write(NEW_LINE);
+         bw.write(NEW_LINE);
+
+         /*
+         int frameNumber = 1;
+
+         for (FrameInfo fi: th.getNew().getFrames()) {
+           dumpFrame(fi, frameNumber, bw);
+           frameNumber++;
+           bw.write(NEW_LINE);
+         }
+         */
+
+         bw.flush();
+         bw.close();
       }
-      */
+   }
 
-      bw.flush();
-      bw.close();
-    }
-  }
+   /**
+    * Dump the methods
+    * @param oInfo The old information
+    * @param nInfo The new information
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpMethods(Map<String, List<CombinedFrameInfo>> oInfo, Map<String, List<CombinedFrameInfo>> nInfo,
+         String directory) throws Exception
+   {
 
-  /**
-   * Dump the methods
-   * @param oInfo The old information
-   * @param nInfo The new information
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpMethods(Map<String, List<CombinedFrameInfo>> oInfo, 
-                             Map<String, List<CombinedFrameInfo>> nInfo,
-                             String directory) throws Exception {
+      List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> oMap = new HashMap<String, CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> nMap = new HashMap<String, CombinedFrameInfo>();
 
-    List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
-    Map<String, CombinedFrameInfo> oMap = new HashMap<String, CombinedFrameInfo>();
-    Map<String, CombinedFrameInfo> nMap = new HashMap<String, CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> tMap = new HashMap<String, CombinedFrameInfo>();
 
-    Map<String, CombinedFrameInfo> tMap = new HashMap<String, CombinedFrameInfo>();
-    
-    Iterator it = oInfo.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      for (CombinedFrameInfo cfi : l) {
-        oMap.put(cfi.getPrettyName(), cfi);
-        tMap.put(cfi.getPrettyName(), cfi);
+      Iterator it = oInfo.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         for (CombinedFrameInfo cfi : l)
+         {
+            oMap.put(cfi.getPrettyName(), cfi);
+            tMap.put(cfi.getPrettyName(), cfi);
+         }
       }
-    }
-    it = nInfo.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      for (CombinedFrameInfo cfi : l) {
-        nMap.put(cfi.getPrettyName(), cfi);
+      it = nInfo.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         for (CombinedFrameInfo cfi : l)
+         {
+            nMap.put(cfi.getPrettyName(), cfi);
+         }
       }
-    }
 
-    it = nMap.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
+      it = nMap.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
 
-      double oTime = 0.0;
-      long oCount = 0;
-      if (oMap.containsKey(key)) {
-        CombinedFrameInfo oCfi = oMap.get(key);
-        oTime = oCfi.getTotalTime();
-        oCount = oCfi.getCount();
-        tMap.remove(key);
+         double oTime = 0.0;
+         long oCount = 0;
+         if (oMap.containsKey(key))
+         {
+            CombinedFrameInfo oCfi = oMap.get(key);
+            oTime = oCfi.getTotalTime();
+            oCount = oCfi.getCount();
+            tMap.remove(key);
+         }
+
+         CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
+         c.increaseTotalTime(cfi.getTotalTime() -
+               oTime);
+         c.increaseCount(cfi.getCount() -
+               oCount);
+
+         methods.add(c);
       }
+      it = tMap.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
 
-      CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
-      c.increaseTotalTime(cfi.getTotalTime() - oTime);
-      c.increaseCount(cfi.getCount() - oCount);
+         CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
+         c.increaseTotalTime(-cfi.getTotalTime());
+         c.increaseCount(-cfi.getCount());
 
-      methods.add(c);
-    }
-    it = tMap.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
+         methods.add(c);
+      }
 
-      CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
-      c.increaseTotalTime(-cfi.getTotalTime());
-      c.increaseCount(-cfi.getCount());
+      FileWriter fw = new FileWriter(directory +
+            "methods.txt");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-      methods.add(c);
-    }
+      bw.write("Methods:" +
+            NEW_LINE);
+      bw.write("--------" +
+            NEW_LINE);
+      bw.write("Diff Ms\tOld Ms\tNew Ms\tDiff #\tOld #\tNew #\tMethod" +
+            NEW_LINE);
 
-    FileWriter fw = new FileWriter(directory + "methods.txt");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+      Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      Collections.reverse(methods);
 
-    bw.write("Methods:" + NEW_LINE);
-    bw.write("--------" + NEW_LINE);
-    bw.write("Diff Ms\tOld Ms\tNew Ms\tDiff #\tOld #\tNew #\tMethod" + NEW_LINE);
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
-    Collections.reverse(methods);
+      int count = 0;
 
-    DecimalFormat df = new DecimalFormat("#0.00");
+      for (int i = 0; i < methods.size(); i++)
+      {
+         CombinedFrameInfo h = methods.get(i);
+         CombinedFrameInfo o = oMap.get(h.getPrettyName());
+         CombinedFrameInfo n = nMap.get(h.getPrettyName());
 
-    int count = 0;
+         double oTime = 0.0;
+         long oCount = 0;
+         if (o != null)
+         {
+            oTime = o.getTotalTime();
+            oCount = o.getCount();
+         }
+         double nTime = 0.0;
+         long nCount = 0;
+         if (n != null)
+         {
+            nTime = n.getTotalTime();
+            nCount = n.getCount();
+         }
 
-    for (int i = 0; i < methods.size(); i++) {
-      CombinedFrameInfo h = methods.get(i);
-      CombinedFrameInfo o = oMap.get(h.getPrettyName());
-      CombinedFrameInfo n = nMap.get(h.getPrettyName());
-
-      double oTime = 0.0;
-      long oCount = 0;
-      if (o != null) {
-        oTime = o.getTotalTime();
-        oCount = o.getCount();
+         if (h.getTotalTime() >= threshold ||
+               h.getTotalTime() <= -threshold)
+         {
+            bw.write(df.format(h.getTotalTime()) +
+                  "\t");
+            bw.write(df.format(oTime) +
+                  "\t");
+            bw.write(df.format(nTime) +
+                  "\t");
+            bw.write(h.getCount() +
+                  "\t");
+            bw.write(oCount +
+                  "\t");
+            bw.write(nCount +
+                  "\t");
+            bw.write(h.getPrettyName() +
+                  NEW_LINE);
+         }
+         else
+         {
+            count++;
+         }
       }
-      double nTime = 0.0;
-      long nCount = 0;
-      if (n != null) {
-        nTime = n.getTotalTime();
-        nCount = n.getCount();
-      }
 
-      if (h.getTotalTime() >= threshold || h.getTotalTime() <= -threshold) {
-        bw.write(df.format(h.getTotalTime()) + "\t");
-        bw.write(df.format(oTime) + "\t");
-        bw.write(df.format(nTime) + "\t");
-        bw.write(h.getCount() + "\t");
-        bw.write(oCount + "\t");
-        bw.write(nCount + "\t");
-        bw.write(h.getPrettyName() + NEW_LINE);
-      } else {
-        count++;
+      if (count > 0)
+      {
+         bw.write(NEW_LINE);
+         bw.write(count +
+               " methods filtered by threshold." + NEW_LINE);
       }
-    }
 
-    if (count > 0) {
-      bw.write(NEW_LINE);
-      bw.write(count + " methods filtered by threshold." + NEW_LINE);
-    }
+      bw.flush();
+      bw.close();
+   }
 
-    bw.flush();
-    bw.close();
-  }
+   /**
+    * Match the threads against each other
+    * @param ots The old threads
+    * @param nts The new threads
+    * @return The set of matched threads
+    */
+   private Set<ThreadHolder> matchThreads(List<ThreadInfo> ots, List<ThreadInfo> nts)
+   {
+      Set<ThreadHolder> result = new HashSet<ThreadHolder>();
 
-  /**
-   * Match the threads against each other
-   * @param ots The old threads
-   * @param nts The new threads
-   * @return The set of matched threads
-   */
-  private Set<ThreadHolder> matchThreads(List<ThreadInfo> ots, List<ThreadInfo> nts) {
-    Set<ThreadHolder> result = new HashSet<ThreadHolder>();
+      Set<Long> taken = new HashSet<Long>();
 
-    Set<Long> taken = new HashSet<Long>();
+      for (ThreadInfo nt : nts)
+      {
+         double[] scores = new double[ots.size()];
 
-    for (ThreadInfo nt : nts) {
-      double[] scores = new double[ots.size()];
+         for (int i = 0; i < ots.size(); i++)
+         {
+            ThreadInfo ot = ots.get(i);
+            double score = 0.0;
 
-      for (int i = 0; i < ots.size(); i++) {
-        ThreadInfo ot = ots.get(i);
-        double score = 0.0;
+            if (!taken.contains(Long.valueOf(ot.getId())))
+            {
+               score = matchThread(ot, nt);
 
-        if (!taken.contains(Long.valueOf(ot.getId()))) {
-          score = matchThread(ot, nt);
+               scores[i] = score;
+            }
+         }
 
-          scores[i] = score;
-        }
-      }
+         double score = 0.0;
+         int index = -1;
+         for (int i = 0; i < scores.length; i++)
+         {
+            if (scores[i] > score)
+            {
+               score = scores[i];
+               index = i;
+            }
+         }
 
-      double score = 0.0;
-      int index = -1;
-      for (int i = 0; i < scores.length; i++) {
-        if (scores[i] > score) {
-          score = scores[i];
-          index = i;
-        }
-      }
+         ThreadInfo ot = ots.get(index);
 
-      ThreadInfo ot = ots.get(index);
-      
-      ThreadHolder th = new ThreadHolder(ot, nt, score);
-      result.add(th);
+         ThreadHolder th = new ThreadHolder(ot, nt, score);
+         result.add(th);
 
-      taken.add(Long.valueOf(ot.getId()));
-    }
+         taken.add(Long.valueOf(ot.getId()));
+      }
 
-    return result;
-  }
+      return result;
+   }
 
-  /**
-   * Match if two threads are equal
-   * @param t1 The first thread
-   * @param t2 The second thread
-   * @return 1.0 if equal; otherwise 0.0
-   */
-  private double matchThread(ThreadInfo t1, ThreadInfo t2) {
-    return matchFrames(t1.getFrames(), t2.getFrames(), 1.0);
-  }
+   /**
+    * Match if two threads are equal
+    * @param t1 The first thread
+    * @param t2 The second thread
+    * @return 1.0 if equal; otherwise 0.0
+    */
+   private double matchThread(ThreadInfo t1, ThreadInfo t2)
+   {
+      return matchFrames(t1.getFrames(), t2.getFrames(), 1.0);
+   }
 
-  /**
-   * Match if two lists of frames are equal
-   * @param ofs The first list of frames
-   * @param nfs The second list of frames
-   * @param maximum The maximum value allowed to be returned
-   * @return Between 1.0 (full match) and 0.0 (no match)
-   */
-  private double matchFrames(List<FrameInfo> ofs, List<FrameInfo> nfs, double maximum) {
+   /**
+    * Match if two lists of frames are equal
+    * @param ofs The first list of frames
+    * @param nfs The second list of frames
+    * @param maximum The maximum value allowed to be returned
+    * @return Between 1.0 (full match) and 0.0 (no match)
+    */
+   private double matchFrames(List<FrameInfo> ofs, List<FrameInfo> nfs, double maximum)
+   {
 
-    if (ofs == null && nfs == null) {
-      return maximum;
-    }
-    if (ofs == null || nfs == null) {
-      return 0.0;
-    }
+      if (ofs == null &&
+            nfs == null)
+      {
+         return maximum;
+      }
+      if (ofs == null ||
+            nfs == null)
+      {
+         return 0.0;
+      }
 
-    double step = maximum / nfs.size();
-    double total = 0.0;
+      double step = maximum /
+            nfs.size();
+      double total = 0.0;
 
-    for (int i = 0; i < nfs.size(); i++) {
-      FrameInfo nf = nfs.get(i);
-      FrameInfo of = null;
-      if (i < ofs.size()) {
-        of = ofs.get(i);
+      for (int i = 0; i < nfs.size(); i++)
+      {
+         FrameInfo nf = nfs.get(i);
+         FrameInfo of = null;
+         if (i < ofs.size())
+         {
+            of = ofs.get(i);
 
-        // TODO - look at frame before and after if not equal to get higher score
+            // TODO - look at frame before and after if not equal to get higher score
 
-        if (nf.getChildren() != null) {
-          if (of.getChildren() != null) {
-            total += matchFrames(of.getChildren(), nf.getChildren(), step);
-          }
-        } else {
-          total += (step * matchFrame(of, nf));
-        }
+            if (nf.getChildren() != null)
+            {
+               if (of.getChildren() != null)
+               {
+                  total += matchFrames(of.getChildren(), nf.getChildren(), step);
+               }
+            }
+            else
+            {
+               total += (step * matchFrame(of, nf));
+            }
+         }
       }
-    }
-    return total;
-  }
+      return total;
+   }
 
-  /**
-   * Match if two frames are equal
-   * @param f1 The first frame
-   * @param f2 The second frame
-   * @return 1.0 if equal; otherwise 0.0
-   */
-  private double matchFrame(FrameInfo f1, FrameInfo f2) {
-    if (f1.getMethod().equals(f2.getMethod())) {
-      return 1.0;
-    }
+   /**
+    * Match if two frames are equal
+    * @param f1 The first frame
+    * @param f2 The second frame
+    * @return 1.0 if equal; otherwise 0.0
+    */
+   private double matchFrame(FrameInfo f1, FrameInfo f2)
+   {
+      if (f1.getMethod().equals(f2.getMethod()))
+      {
+         return 1.0;
+      }
 
-    return 0.0;
-  }
+      return 0.0;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/HTMLUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/HTMLUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/HTMLUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,56 +31,75 @@
  * The HTML utility class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class HTMLUtil {
-  /** The logger */
-  private static Logger log = Logger.getLogger(HTMLUtil.class);
+public class HTMLUtil
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(HTMLUtil.class);
 
-  /** New line character */
-  protected static final String NEW_LINE = System.getProperty("line.separator");
+   /** New line character */
+   protected static final String NEW_LINE = System.getProperty("line.separator");
 
-  /**
-   * Constructor
-   */
-  private HTMLUtil() {
-  }
+   /**
+    * Constructor
+    */
+   private HTMLUtil()
+   {
+   }
 
-  /**
-   * Write HTML header
-   * @param bw The buffered writer
-   * @param title The title for the page
-   * @param toplevel Is the file in top-level directory
-   * @exception Exception Thrown if an error occurs
-   */
-  public static void header(BufferedWriter bw, String title, boolean toplevel) throws Exception {
-    bw.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" " + 
-             "\"http://www.w3.org/TR/html4/loose.dtd\">" + NEW_LINE);
-    bw.write("<html>" + NEW_LINE);
-    bw.write("<head>" + NEW_LINE);
-    bw.write("  <title>" + Version.FULL_VERSION + ": " + title + "</title>" + NEW_LINE);
-    bw.write("  <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">" + NEW_LINE);
-    if (toplevel) {
-      bw.write("  <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">" + NEW_LINE);
-    } else {
-      bw.write("  <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\">" + NEW_LINE);
-    }
-    bw.write("</head>" + NEW_LINE);
-    bw.write("<body>" + NEW_LINE);
-    bw.write(NEW_LINE);
-  }
+   /**
+    * Write HTML header
+    * @param bw The buffered writer
+    * @param title The title for the page
+    * @param toplevel Is the file in top-level directory
+    * @exception Exception Thrown if an error occurs
+    */
+   public static void header(BufferedWriter bw, String title, boolean toplevel) throws Exception
+   {
+      bw.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" " +
+            "\"http://www.w3.org/TR/html4/loose.dtd\">" + NEW_LINE);
+      bw.write("<html>" +
+            NEW_LINE);
+      bw.write("<head>" +
+            NEW_LINE);
+      bw.write("  <title>" +
+            Version.FULL_VERSION + ": " + title + "</title>" + NEW_LINE);
+      bw.write("  <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">" +
+            NEW_LINE);
+      if (toplevel)
+      {
+         bw.write("  <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">" +
+               NEW_LINE);
+      }
+      else
+      {
+         bw.write("  <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\">" +
+               NEW_LINE);
+      }
+      bw.write("</head>" +
+            NEW_LINE);
+      bw.write("<body>" +
+            NEW_LINE);
+      bw.write(NEW_LINE);
+   }
 
-  /**
-   * Write HTML footer
-   * @param bw The buffered writer
-   * @exception Exception Thrown if an error occurs
-   */
-  public static void footer(BufferedWriter bw) throws Exception {
-    bw.write(NEW_LINE);
-    bw.write("<p>" + NEW_LINE);
-    bw.write("<hr>" + NEW_LINE);
-    bw.write("Generated by: <a href=\"http://www.jboss.org/jbossprofiler\">" + Version.FULL_VERSION + "</a>" +
-             NEW_LINE);
-    bw.write(NEW_LINE);
-    bw.write("</body>" + NEW_LINE);
-    bw.write("</html>" + NEW_LINE);
-  }
+   /**
+    * Write HTML footer
+    * @param bw The buffered writer
+    * @exception Exception Thrown if an error occurs
+    */
+   public static void footer(BufferedWriter bw) throws Exception
+   {
+      bw.write(NEW_LINE);
+      bw.write("<p>" +
+            NEW_LINE);
+      bw.write("<hr>" +
+            NEW_LINE);
+      bw.write("Generated by: <a href=\"http://www.jboss.org/jbossprofiler\">" +
+            Version.FULL_VERSION + "</a>" + NEW_LINE);
+      bw.write(NEW_LINE);
+      bw.write("</body>" +
+            NEW_LINE);
+      bw.write("</html>" +
+            NEW_LINE);
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -23,15 +23,12 @@
 
 import org.jboss.profiler.shared.AllocationComparator;
 import org.jboss.profiler.shared.AllocationInfo;
-import org.jboss.profiler.shared.ClassComparator;
 import org.jboss.profiler.shared.ClassInfo;
-import org.jboss.profiler.shared.FrameComparator;
 import org.jboss.profiler.shared.FrameInfo;
 import org.jboss.profiler.shared.Math;
 import org.jboss.profiler.shared.MethodInfo;
 import org.jboss.profiler.shared.MethodRepository;
 import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.shared.SnapshotHelper;
 import org.jboss.profiler.shared.ThreadComparator;
 import org.jboss.profiler.shared.ThreadInfo;
 import org.jboss.profiler.shared.ThreadInfoProxy;
@@ -49,12 +46,10 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 
 import org.jboss.logging.Logger;
@@ -63,1264 +58,1685 @@
  * The snapshot utility class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SnapshotUtil {
-  /** The logger */
-  private static Logger log = Logger.getLogger(SnapshotUtil.class);
+public class SnapshotUtil
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(SnapshotUtil.class);
 
-  /** New line character */
-  protected static final String NEW_LINE = System.getProperty("line.separator");
+   /** New line character */
+   protected static final String NEW_LINE = System.getProperty("line.separator");
 
-  /** Threshold */
-  protected double threshold;
+   /** Threshold */
+   protected double threshold;
 
-  /**
-   * Constructor
-   */
-  public SnapshotUtil() {
-    this(1.0);
-  }
+   /**
+    * Constructor
+    */
+   public SnapshotUtil()
+   {
+      this(1.0);
+   }
 
-  /**
-   * Constructor
-   * @param threshold The threshold
-   */
-  public SnapshotUtil(double threshold) {
-    this.threshold = threshold;
-  }
+   /**
+    * Constructor
+    * @param threshold The threshold
+    */
+   public SnapshotUtil(double threshold)
+   {
+      this.threshold = threshold;
+   }
 
-  /**
-   * Get information about the snapshot
-   * @param snapshot The snapshot
-   * @return The information
-   */
-  public Map<String, List<CombinedFrameInfo>> getInformation(Snapshot snapshot) {
-    Map<String, Map<String, CombinedFrameInfo>> data = 
-      new HashMap<String, Map<String, CombinedFrameInfo>>();
+   /**
+    * Get information about the snapshot
+    * @param snapshot The snapshot
+    * @return The information
+    */
+   public Map<String, List<CombinedFrameInfo>> getInformation(Snapshot snapshot)
+   {
+      Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
 
-    long tt = 0;
-    for (ThreadInfo ti : snapshot.getThreads()) {
-      tt += ti.getTotalTime();
+      long tt = 0;
+      for (ThreadInfo ti : snapshot.getThreads())
+      {
+         tt += ti.getTotalTime();
 
-      if (ti instanceof ThreadInfoProxy) {
-        ThreadInfoProxy tip = (ThreadInfoProxy)ti;
-        tip.resetFrames();
+         if (ti instanceof ThreadInfoProxy)
+         {
+            ThreadInfoProxy tip = (ThreadInfoProxy)ti;
+            tip.resetFrames();
+         }
       }
-    }
 
-    for (ThreadInfo ti : snapshot.getThreads()) {
-      for (FrameInfo fi : ti.getFrames()) {
-        frameInformation(snapshot.getMethodRepository(), fi, tt, data);
-      }
+      for (ThreadInfo ti : snapshot.getThreads())
+      {
+         for (FrameInfo fi : ti.getFrames())
+         {
+            frameInformation(snapshot.getMethodRepository(), fi, tt, data);
+         }
 
-      if (ti instanceof ThreadInfoProxy) {
-        ThreadInfoProxy tip = (ThreadInfoProxy)ti;
-        tip.resetFrames();
+         if (ti instanceof ThreadInfoProxy)
+         {
+            ThreadInfoProxy tip = (ThreadInfoProxy)ti;
+            tip.resetFrames();
+         }
       }
-    }
 
-    Map<String, List<CombinedFrameInfo>> result = new HashMap<String, List<CombinedFrameInfo>>();
+      Map<String, List<CombinedFrameInfo>> result = new HashMap<String, List<CombinedFrameInfo>>();
 
-    Iterator it = data.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
-      
-      result.put(key, new ArrayList<CombinedFrameInfo>(value.values()));
-    }
+      Iterator it = data.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
 
-    return result;
-  }
+         result.put(key, new ArrayList<CombinedFrameInfo>(value.values()));
+      }
 
-  /**
-   * Generate frame information
-   * @param mr The method repository
-   * @param fi The frame
-   * @param tt The total time (ns)
-   * @param data The data
-   */
-  private void frameInformation(MethodRepository mr, 
-                                FrameInfo fi, 
-                                long tt, 
-                                Map<String, Map<String, CombinedFrameInfo>> data) {
+      return result;
+   }
 
-    MethodInfo mi = mr.getInfo(fi.getMethod());
-    Map<String, CombinedFrameInfo> classData = data.get(mi.getClassName());
-      
-    if (classData == null) {
-      classData = new HashMap<String, CombinedFrameInfo>();
-      data.put(mi.getClassName(), classData);
-    }
+   /**
+    * Generate frame information
+    * @param mr The method repository
+    * @param fi The frame
+    * @param tt The total time (ns)
+    * @param data The data
+    */
+   private void frameInformation(MethodRepository mr, FrameInfo fi, long tt,
+         Map<String, Map<String, CombinedFrameInfo>> data)
+   {
 
-    String prettyName = Util.getPrettyName(mi);
-    CombinedFrameInfo methodData = classData.get(prettyName);
-    
-    if (methodData == null) {
-      methodData = new CombinedFrameInfo(mi.getClassName(), prettyName);
-      classData.put(prettyName, methodData);
-    }
-    
-    long net = fi.getNetTime();
-    double percent = Math.toPercent(net, (double)tt);
-    double time = Math.nanoToMilli(net);
-    
-    methodData.increaseCount(fi.getCount());
-    methodData.increaseTotalTime(time);
-    methodData.increasePercent(percent);
-    methodData.increaseWaitTime(Math.nanoToMilli(fi.getWaitTime()));
+      MethodInfo mi = mr.getInfo(fi.getMethod());
+      Map<String, CombinedFrameInfo> classData = data.get(mi.getClassName());
 
-    List<FrameInfo> l = fi.getChildren();
-    if (l != null) {
-      for (FrameInfo child : l) {
-        frameInformation(mr, child, tt, data);
+      if (classData == null)
+      {
+         classData = new HashMap<String, CombinedFrameInfo>();
+         data.put(mi.getClassName(), classData);
       }
-    }
-  }
 
-  /**
-   * Get the timed classes
-   * @param classes The classes
-   * @param info The information
-   * @return The timed classes
-   */
-  public List<TimedClassInfo> getTimedClasses(List<ClassInfo> classes,
-                                              Map<String, List<CombinedFrameInfo>> info) {
-    List<TimedClassInfo> result = new ArrayList<TimedClassInfo>();
+      String prettyName = Util.getPrettyName(mi);
+      CombinedFrameInfo methodData = classData.get(prettyName);
 
-    for (ClassInfo ci : classes) {
-      List<CombinedFrameInfo> l = info.get(ci.getClassName());
-
-      double time = 0.0;
-      double wait = 0.0;
-      
-      if (l != null) {
-        for (CombinedFrameInfo cfi : l) {
-          time += cfi.getTotalTime();
-          wait += cfi.getWaitTime();
-        }
+      if (methodData == null)
+      {
+         methodData = new CombinedFrameInfo(mi.getClassName(), prettyName);
+         classData.put(prettyName, methodData);
       }
 
-      TimedClassInfo tci = new TimedClassInfo(ci, time, wait);
-      result.add(tci);
-    }
+      long net = fi.getNetTime();
+      double percent = Math.toPercent(net, (double)tt);
+      double time = Math.nanoToMilli(net);
 
-    return result;
-  }
+      methodData.increaseCount(fi.getCount());
+      methodData.increaseTotalTime(time);
+      methodData.increasePercent(percent);
+      methodData.increaseWaitTime(Math.nanoToMilli(fi.getWaitTime()));
 
-  /**
-   * Dump the snapshot to a directory
-   * @param snapshot The snapshot
-   * @param d The directory
-   * @exception Exception If an error occurs
-   */
-  public void dump(Snapshot snapshot, File d) throws Exception {
-    if (snapshot != null) {
-      String directory = d.getPath() + File.separator;
+      List<FrameInfo> l = fi.getChildren();
+      if (l != null)
+      {
+         for (FrameInfo child : l)
+         {
+            frameInformation(mr, child, tt, data);
+         }
+      }
+   }
 
-      dumpThreads(snapshot.getMethodRepository(), snapshot.getThreads(), directory);
+   /**
+    * Get the timed classes
+    * @param classes The classes
+    * @param info The information
+    * @return The timed classes
+    */
+   public List<TimedClassInfo> getTimedClasses(List<ClassInfo> classes, Map<String, List<CombinedFrameInfo>> info)
+   {
+      List<TimedClassInfo> result = new ArrayList<TimedClassInfo>();
 
-      Map<String, List<CombinedFrameInfo>> info = getInformation(snapshot);
-      List<TimedClassInfo> classes = getTimedClasses(snapshot.getClasses(), info);
+      for (ClassInfo ci : classes)
+      {
+         List<CombinedFrameInfo> l = info.get(ci.getClassName());
 
-      dumpOverview(snapshot, info, classes, directory);
-      dumpMethods(info, directory);
-      dumpHotspots(info, directory);
-      dumpPackages(info, directory);
-      dumpClasses(classes, info, snapshot.getAllocations(), directory);
-      dumpCaller(snapshot.getMethodRepository(), snapshot.getThreads(), directory);
-      dumpWaitTime(classes, directory);
+         double time = 0.0;
+         double wait = 0.0;
 
-      dumpIndex(directory);
-      dumpCSS(directory);
-    }
-  }
+         if (l != null)
+         {
+            for (CombinedFrameInfo cfi : l)
+            {
+               time += cfi.getTotalTime();
+               wait += cfi.getWaitTime();
+            }
+         }
 
-  /**
-   * Dump the overview
-   * @param snapshot The snapshot
-   * @param info The information
-   * @param classes The classes
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpOverview(Snapshot snapshot, 
-                              Map<String, List<CombinedFrameInfo>> info,
-                              List<TimedClassInfo> classes,
-                              String directory) throws Exception {
-    
-    SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMMM yyyy HH:mm:ss:SSS");
-    DecimalFormat df = new DecimalFormat("#0.00");
+         TimedClassInfo tci = new TimedClassInfo(ci, time, wait);
+         result.add(tci);
+      }
 
-    boolean odd = true;
+      return result;
+   }
 
-    FileWriter fw = new FileWriter(directory + "overview.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
-    HTMLUtil.header(bw, "Overview", true);
+   /**
+    * Dump the snapshot to a directory
+    * @param snapshot The snapshot
+    * @param d The directory
+    * @exception Exception If an error occurs
+    */
+   public void dump(Snapshot snapshot, File d) throws Exception
+   {
+      if (snapshot != null)
+      {
+         String directory = d.getPath() +
+               File.separator;
 
-    bw.write("<h1>Overview</h1>" + NEW_LINE);
-    bw.write(NEW_LINE);
+         dumpThreads(snapshot.getMethodRepository(), snapshot.getThreads(), directory);
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-    bw.write("    <td>From</td><td>" + dateFormat.format(snapshot.getFrom()) + "</td>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-    bw.write("    <td>To</td><td>" + dateFormat.format(snapshot.getTo()) + "</td>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-    bw.write("    <td>Total</td><td>" + 
-             df.format(new Date(snapshot.getTo().getTime() - snapshot.getFrom().getTime()).getTime()) + 
-             " ms</td>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    bw.write("</table>" + NEW_LINE);
+         Map<String, List<CombinedFrameInfo>> info = getInformation(snapshot);
+         List<TimedClassInfo> classes = getTimedClasses(snapshot.getClasses(), info);
 
-    Collections.sort(snapshot.getThreads(), new ThreadComparator());
+         dumpOverview(snapshot, info, classes, directory);
+         dumpMethods(info, directory);
+         dumpHotspots(info, directory);
+         dumpPackages(info, directory);
+         dumpClasses(classes, info, snapshot.getAllocations(), directory);
+         dumpCaller(snapshot.getMethodRepository(), snapshot.getThreads(), directory);
+         dumpWaitTime(classes, directory);
 
-    bw.write("<h2>Threads</h2>" + NEW_LINE);
-
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Name</th>" + NEW_LINE);
-    bw.write("     <th>Time</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    odd = true;
-    for (ThreadInfo ti : snapshot.getThreads()) {
-      if (odd) {
-        bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      } else {
-        bw.write("  <tr class=\"roweven\">" + NEW_LINE);
+         dumpIndex(directory);
+         dumpCSS(directory);
       }
-      bw.write("    <td><a href=\"threads/thread-" + ti.getId() + ".html\">Thread-" + ti.getId() + "</a></td>" + 
-               NEW_LINE);
-      bw.write("    <td>" + df.format(Math.nanoToMilli(ti.getTotalTime())) + " ms</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
+   }
 
-      if (ti instanceof ThreadInfoProxy) {
-        ThreadInfoProxy tip = (ThreadInfoProxy)ti;
-        tip.resetFrames();
-      }
+   /**
+    * Dump the overview
+    * @param snapshot The snapshot
+    * @param info The information
+    * @param classes The classes
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpOverview(Snapshot snapshot, Map<String, List<CombinedFrameInfo>> info,
+         List<TimedClassInfo> classes, String directory) throws Exception
+   {
 
-      odd = !odd;
-    }
-    bw.write("</table>" + NEW_LINE);
+      SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMMM yyyy HH:mm:ss:SSS");
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    bw.write(NEW_LINE);
-    dumpMostTime(info, bw);
-    bw.write(NEW_LINE);
-    dumpAllocations(snapshot, bw);
-    bw.write(NEW_LINE);
+      boolean odd = true;
 
-    Collections.sort(classes, new TimedClassComparator(TimedClassComparator.NAME));
+      FileWriter fw = new FileWriter(directory +
+            "overview.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
+      HTMLUtil.header(bw, "Overview", true);
 
-    bw.write("<h2>Classes</h2>" + NEW_LINE);
+      bw.write("<h1>Overview</h1>" +
+            NEW_LINE);
+      bw.write(NEW_LINE);
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Name</th>" + NEW_LINE);
-    bw.write("     <th>Type</th>" + NEW_LINE);
-    bw.write("     <th>Time</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    odd = true;
-    for (TimedClassInfo tci : classes) {
-      if (odd) {
-        bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      } else {
-        bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-      }
-      bw.write("    <td><a href=\"classes/" + tci.getClassName().replace('/', '.') + ".html\">" + 
-               Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
-      bw.write("    <td>" + Util.getDescription(tci) + "</td>" + NEW_LINE);
-      bw.write("    <td>" + df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
-      odd = !odd;
-    }
-    bw.write("</table>" + NEW_LINE);
-    
-    HTMLUtil.footer(bw);
-    bw.flush();
-    bw.close();
-  }
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr class=\"rowodd\">" +
+            NEW_LINE);
+      bw.write("    <td>From</td><td>" +
+            dateFormat.format(snapshot.getFrom()) + "</td>" + NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      bw.write("  <tr class=\"roweven\">" +
+            NEW_LINE);
+      bw.write("    <td>To</td><td>" +
+            dateFormat.format(snapshot.getTo()) + "</td>" + NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      bw.write("  <tr class=\"rowodd\">" +
+            NEW_LINE);
+      bw.write("    <td>Total</td><td>" +
+            df.format(new Date(snapshot.getTo().getTime() -
+                  snapshot.getFrom().getTime()).getTime()) + " ms</td>" + NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
-  /**
-   * Dump the threads to a file writer
-   * @param mr The method repository
-   * @param threads The threads
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpThreads(MethodRepository mr, List<ThreadInfo> threads, String directory) throws Exception {
-    File f = new File(directory + "threads");
-    f.mkdirs();
+      Collections.sort(snapshot.getThreads(), new ThreadComparator());
 
-    for (ThreadInfo ti : threads) {
-      FileWriter ftw = new FileWriter(directory + "threads" + File.separator + 
-                                      "thread-" + ti.getId() + ".html");
-      BufferedWriter bw = new BufferedWriter(ftw, 8192);
+      bw.write("<h2>Threads</h2>" +
+            NEW_LINE);
 
-      HTMLUtil.header(bw, "Thread: " + ti.getId(), false);
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Name</th>" +
+            NEW_LINE);
+      bw.write("     <th>Time</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      odd = true;
+      for (ThreadInfo ti : snapshot.getThreads())
+      {
+         if (odd)
+         {
+            bw.write("  <tr class=\"rowodd\">" +
+                  NEW_LINE);
+         }
+         else
+         {
+            bw.write("  <tr class=\"roweven\">" +
+                  NEW_LINE);
+         }
+         bw.write("    <td><a href=\"threads/thread-" +
+               ti.getId() + ".html\">Thread-" + ti.getId() + "</a></td>" + NEW_LINE);
+         bw.write("    <td>" +
+               df.format(Math.nanoToMilli(ti.getTotalTime())) + " ms</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
 
-      bw.write("<h1>Thread: " + ti.getId() + "</h1>" + NEW_LINE);
-      bw.write(NEW_LINE);
+         if (ti instanceof ThreadInfoProxy)
+         {
+            ThreadInfoProxy tip = (ThreadInfoProxy)ti;
+            tip.resetFrames();
+         }
 
-      bw.write("<table>" + NEW_LINE);
-      bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      bw.write("    <td>Thread</td><td>" + ti.getId() + "</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
-      bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-      bw.write("    <td>Name</td><td>" + ti.getName() + "</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
-      bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      bw.write("    <td>Priority</td><td>" + ti.getPriority() + "</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
-      bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-      bw.write("    <td>Daemon</td><td>" + ti.isDaemon() + "</td>" + NEW_LINE);
-      bw.write("  </tr>" + NEW_LINE);
-
-      if (ti.getGroups() != null) {
-        bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        bw.write("    <td>Groups</td><td>");
-
-        Iterator it = ti.getGroups().iterator();
-        while (it.hasNext()) {
-          String g = (String)it.next();
-          bw.write(g);
-          if (it.hasNext()) {
-            bw.write(" -> ");
-          }
-        }
-
-        bw.write("</td>" + NEW_LINE);
+         odd = !odd;
       }
-      
-      bw.write("</table>" + NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
       bw.write(NEW_LINE);
+      dumpMostTime(info, bw);
+      bw.write(NEW_LINE);
+      dumpAllocations(snapshot, bw);
+      bw.write(NEW_LINE);
 
-      int frameNumber = 1;
+      Collections.sort(classes, new TimedClassComparator(TimedClassComparator.NAME));
 
-      for (FrameInfo fi : ti.getFrames()) {
-        dumpFrame(mr, fi, frameNumber, bw);
-        frameNumber++;
-        bw.write(NEW_LINE);
+      bw.write("<h2>Classes</h2>" +
+            NEW_LINE);
+
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Name</th>" +
+            NEW_LINE);
+      bw.write("     <th>Type</th>" +
+            NEW_LINE);
+      bw.write("     <th>Time</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      odd = true;
+      for (TimedClassInfo tci : classes)
+      {
+         if (odd)
+         {
+            bw.write("  <tr class=\"rowodd\">" +
+                  NEW_LINE);
+         }
+         else
+         {
+            bw.write("  <tr class=\"roweven\">" +
+                  NEW_LINE);
+         }
+         bw.write("    <td><a href=\"classes/" +
+               tci.getClassName().replace('/', '.') + ".html\">" + Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
+         bw.write("    <td>" +
+               Util.getDescription(tci) + "</td>" + NEW_LINE);
+         bw.write("    <td>" +
+               df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
+         odd = !odd;
       }
+      bw.write("</table>" +
+            NEW_LINE);
 
       HTMLUtil.footer(bw);
-
       bw.flush();
       bw.close();
+   }
 
-      if (ti instanceof ThreadInfoProxy) {
-        ThreadInfoProxy tip = (ThreadInfoProxy)ti;
-        tip.resetFrames();
-      }
-    }
-  }
+   /**
+    * Dump the threads to a file writer
+    * @param mr The method repository
+    * @param threads The threads
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpThreads(MethodRepository mr, List<ThreadInfo> threads, String directory) throws Exception
+   {
+      File f = new File(directory +
+            "threads");
+      f.mkdirs();
 
-  /**
-   * Dump the frame to a file writer
-   * @param mr The method repository
-   * @param fi The frame
-   * @param fn The frame number
-   * @param w The writer
-   * @exception Exception If an error occurs
-   */
-  protected void dumpFrame(MethodRepository mr, FrameInfo fi, int fn, Writer w) throws Exception {
-    w.write("<h2>Frame: " + fn + "</h2>" + NEW_LINE);
+      for (ThreadInfo ti : threads)
+      {
+         FileWriter ftw = new FileWriter(directory +
+               "threads" + File.separator + "thread-" + ti.getId() + ".html");
+         BufferedWriter bw = new BufferedWriter(ftw, 8192);
 
-    w.write("<table>" + NEW_LINE);
-    w.write("  <tr>" + NEW_LINE);
-    w.write("     <th>Count</th>" + NEW_LINE);
-    w.write("     <th>Ms (T)</th>" + NEW_LINE);
-    w.write("     <th>Ms (N)</th>" + NEW_LINE);
-    w.write("     <th>% (T)</th>" + NEW_LINE);
-    w.write("     <th>% (N)</th>" + NEW_LINE);
-    w.write("     <th>Method</th>" + NEW_LINE);
-    w.write("  </tr>" + NEW_LINE);
+         HTMLUtil.header(bw, "Thread: " +
+               ti.getId(), false);
 
-    long totalTime = fi.getTotalTime();
-    dumpFrame(mr, fi, 0, (double)totalTime, w);
+         bw.write("<h1>Thread: " +
+               ti.getId() + "</h1>" + NEW_LINE);
+         bw.write(NEW_LINE);
 
-    w.write("</table>" + NEW_LINE);
-  }
+         bw.write("<table>" +
+               NEW_LINE);
+         bw.write("  <tr class=\"rowodd\">" +
+               NEW_LINE);
+         bw.write("    <td>Thread</td><td>" +
+               ti.getId() + "</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
+         bw.write("  <tr class=\"roweven\">" +
+               NEW_LINE);
+         bw.write("    <td>Name</td><td>" +
+               ti.getName() + "</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
+         bw.write("  <tr class=\"rowodd\">" +
+               NEW_LINE);
+         bw.write("    <td>Priority</td><td>" +
+               ti.getPriority() + "</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
+         bw.write("  <tr class=\"roweven\">" +
+               NEW_LINE);
+         bw.write("    <td>Daemon</td><td>" +
+               ti.isDaemon() + "</td>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
 
-  /**
-   * Dump the frame to a file writer
-   * @param mr The method repository
-   * @param fi The frame
-   * @param level The level
-   * @param tt The total time
-   * @param w The writer
-   * @exception Exception If an error occurs
-   */
-  protected void dumpFrame(MethodRepository mr, FrameInfo fi, int level, double tt, Writer w) throws Exception {
-    DecimalFormat df = new DecimalFormat("#0.00");
+         if (ti.getGroups() != null)
+         {
+            bw.write("  <tr class=\"rowodd\">" +
+                  NEW_LINE);
+            bw.write("    <td>Groups</td><td>");
 
-    long total = fi.getTotalTime();
-    long net = fi.getNetTime();
+            Iterator it = ti.getGroups().iterator();
+            while (it.hasNext())
+            {
+               String g = (String)it.next();
+               bw.write(g);
+               if (it.hasNext())
+               {
+                  bw.write(" -> ");
+               }
+            }
 
-    w.write("  <tr  class=\"roweven\">" + NEW_LINE);
-    w.write("    <td>" + fi.getCount() + "</td>" + NEW_LINE);
-    w.write("    <td>" + df.format(Math.nanoToMilli(total)) + "</td>" + NEW_LINE);
-    w.write("    <td>" + df.format(Math.nanoToMilli(net)) + "</td>" + NEW_LINE);
-    w.write("    <td>" + df.format(Math.toPercent(total, tt)) + "</td>" + NEW_LINE);
-    w.write("    <td>" + df.format(Math.toPercent(net, tt)) + "</td>" + NEW_LINE);
-    
-    w.write("    <td>");
-    for (int i = 0; i < level; i++) {
-      w.write("+");
-    }
-    if (level > 0) {
-      w.write(" ");
-    }
-    
-    MethodInfo mi = mr.getInfo(fi.getMethod());
-    w.write(Util.getPrettyName(mi));
-    w.write("    </td>" + NEW_LINE);
-    w.write("  </tr>" + NEW_LINE);
+            bw.write("</td>" +
+                  NEW_LINE);
+         }
 
-    List<FrameInfo> l = fi.getChildren();
-    if (l != null) {
-      for (FrameInfo child : l) {      
-        dumpFrame(mr, child, level + 1, tt, w);
+         bw.write("</table>" +
+               NEW_LINE);
+
+         bw.write(NEW_LINE);
+
+         int frameNumber = 1;
+
+         for (FrameInfo fi : ti.getFrames())
+         {
+            dumpFrame(mr, fi, frameNumber, bw);
+            frameNumber++;
+            bw.write(NEW_LINE);
+         }
+
+         HTMLUtil.footer(bw);
+
+         bw.flush();
+         bw.close();
+
+         if (ti instanceof ThreadInfoProxy)
+         {
+            ThreadInfoProxy tip = (ThreadInfoProxy)ti;
+            tip.resetFrames();
+         }
       }
-    }
-  }
-  
-  /**
-   * Dump the most time to a file writer
-   * @param info The information
-   * @param w The writer
-   * @exception Exception If an error occurs
-   */
-  protected void dumpMostTime(Map<String, List<CombinedFrameInfo>> info, Writer w) throws Exception {
-    w.write("<h2>Most time</h2>" + NEW_LINE);
+   }
 
-    w.write("<table>" + NEW_LINE);
-    w.write("  <tr>" + NEW_LINE);
-    w.write("     <th>Count</th>" + NEW_LINE);
-    w.write("     <th>Ms</th>" + NEW_LINE);
-    w.write("     <th>Avg</th>" + NEW_LINE);
-    w.write("     <th>%</th>" + NEW_LINE);
-    w.write("     <th>Method</th>" + NEW_LINE);
-    w.write("  </tr>" + NEW_LINE);
+   /**
+    * Dump the frame to a file writer
+    * @param mr The method repository
+    * @param fi The frame
+    * @param fn The frame number
+    * @param w The writer
+    * @exception Exception If an error occurs
+    */
+   protected void dumpFrame(MethodRepository mr, FrameInfo fi, int fn, Writer w) throws Exception
+   {
+      w.write("<h2>Frame: " +
+            fn + "</h2>" + NEW_LINE);
 
-    List<CombinedFrameInfo> allMethods = new ArrayList<CombinedFrameInfo>();
+      w.write("<table>" +
+            NEW_LINE);
+      w.write("  <tr>" +
+            NEW_LINE);
+      w.write("     <th>Count</th>" +
+            NEW_LINE);
+      w.write("     <th>Ms (T)</th>" +
+            NEW_LINE);
+      w.write("     <th>Ms (N)</th>" +
+            NEW_LINE);
+      w.write("     <th>% (T)</th>" +
+            NEW_LINE);
+      w.write("     <th>% (N)</th>" +
+            NEW_LINE);
+      w.write("     <th>Method</th>" +
+            NEW_LINE);
+      w.write("  </tr>" +
+            NEW_LINE);
 
-    Iterator it = info.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      allMethods.addAll(l);
-    }
+      long totalTime = fi.getTotalTime();
+      dumpFrame(mr, fi, 0, (double)totalTime, w);
 
-    Collections.sort(allMethods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      w.write("</table>" +
+            NEW_LINE);
+   }
 
-    DecimalFormat df = new DecimalFormat("#0.00");
-    
-    boolean odd = true;
-    for (int i = 0; i < 10 && i < allMethods.size(); i++) {
-      CombinedFrameInfo cfi = allMethods.get(i);
+   /**
+    * Dump the frame to a file writer
+    * @param mr The method repository
+    * @param fi The frame
+    * @param level The level
+    * @param tt The total time
+    * @param w The writer
+    * @exception Exception If an error occurs
+    */
+   protected void dumpFrame(MethodRepository mr, FrameInfo fi, int level, double tt, Writer w) throws Exception
+   {
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-      if (odd) {
-        w.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      } else {
-        w.write("  <tr class=\"roweven\">" + NEW_LINE);
+      long total = fi.getTotalTime();
+      long net = fi.getNetTime();
+
+      w.write("  <tr  class=\"roweven\">" +
+            NEW_LINE);
+      w.write("    <td>" +
+            fi.getCount() + "</td>" + NEW_LINE);
+      w.write("    <td>" +
+            df.format(Math.nanoToMilli(total)) + "</td>" + NEW_LINE);
+      w.write("    <td>" +
+            df.format(Math.nanoToMilli(net)) + "</td>" + NEW_LINE);
+      w.write("    <td>" +
+            df.format(Math.toPercent(total, tt)) + "</td>" + NEW_LINE);
+      w.write("    <td>" +
+            df.format(Math.toPercent(net, tt)) + "</td>" + NEW_LINE);
+
+      w.write("    <td>");
+      for (int i = 0; i < level; i++)
+      {
+         w.write("+");
       }
-      
-      w.write("    <td>" + cfi.getCount() + "</td>" + NEW_LINE);
-      w.write("    <td>" + df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
-      w.write("    <td>" + df.format(cfi.getTotalTime() / cfi.getCount()) + "</td>" + NEW_LINE);
-      w.write("    <td>" + df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
-      w.write("    <td><a href=\"classes/" + cfi.getClassName().replace('/', '.') + ".html\">" + 
-              cfi.getPrettyName() + "</a></td>" + NEW_LINE);
-      w.write("  </tr>" + NEW_LINE);
-      odd = !odd;
-    }
+      if (level > 0)
+      {
+         w.write(" ");
+      }
 
-    w.write("</table>" + NEW_LINE);
+      MethodInfo mi = mr.getInfo(fi.getMethod());
+      w.write(Util.getPrettyName(mi));
+      w.write("    </td>" +
+            NEW_LINE);
+      w.write("  </tr>" +
+            NEW_LINE);
 
-    w.write(NEW_LINE);
-    dumpHotspot(allMethods, 10, true, w);
-  }
+      List<FrameInfo> l = fi.getChildren();
+      if (l != null)
+      {
+         for (FrameInfo child : l)
+         {
+            dumpFrame(mr, child, level + 1, tt, w);
+         }
+      }
+   }
 
-  /**
-   * Dump the methods
-   * @param info The information
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpMethods(Map<String, List<CombinedFrameInfo>> info, 
-                             String directory) throws Exception {
+   /**
+    * Dump the most time to a file writer
+    * @param info The information
+    * @param w The writer
+    * @exception Exception If an error occurs
+    */
+   protected void dumpMostTime(Map<String, List<CombinedFrameInfo>> info, Writer w) throws Exception
+   {
+      w.write("<h2>Most time</h2>" +
+            NEW_LINE);
 
-    List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
+      w.write("<table>" +
+            NEW_LINE);
+      w.write("  <tr>" +
+            NEW_LINE);
+      w.write("     <th>Count</th>" +
+            NEW_LINE);
+      w.write("     <th>Ms</th>" +
+            NEW_LINE);
+      w.write("     <th>Avg</th>" +
+            NEW_LINE);
+      w.write("     <th>%</th>" +
+            NEW_LINE);
+      w.write("     <th>Method</th>" +
+            NEW_LINE);
+      w.write("  </tr>" +
+            NEW_LINE);
 
-    Iterator it = info.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      methods.addAll(l);
-    }
+      List<CombinedFrameInfo> allMethods = new ArrayList<CombinedFrameInfo>();
 
-    FileWriter fw = new FileWriter(directory + "methods.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+      Iterator it = info.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         allMethods.addAll(l);
+      }
 
-    HTMLUtil.header(bw, "Methods", true);
+      Collections.sort(allMethods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
 
-    bw.write("<h1>Methods</h1>" + NEW_LINE);
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Count</th>" + NEW_LINE);
-    bw.write("     <th>Ms</th>" + NEW_LINE);
-    bw.write("     <th>Avg</th>" + NEW_LINE);
-    bw.write("     <th>%</th>" + NEW_LINE);
-    bw.write("     <th>Method</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+      boolean odd = true;
+      for (int i = 0; i < 10 &&
+            i < allMethods.size(); i++)
+      {
+         CombinedFrameInfo cfi = allMethods.get(i);
 
-    Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+         if (odd)
+         {
+            w.write("  <tr class=\"rowodd\">" +
+                  NEW_LINE);
+         }
+         else
+         {
+            w.write("  <tr class=\"roweven\">" +
+                  NEW_LINE);
+         }
 
-    DecimalFormat df = new DecimalFormat("#0.00");
+         w.write("    <td>" +
+               cfi.getCount() + "</td>" + NEW_LINE);
+         w.write("    <td>" +
+               df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
+         w.write("    <td>" +
+               df.format(cfi.getTotalTime() /
+                     cfi.getCount()) + "</td>" + NEW_LINE);
+         w.write("    <td>" +
+               df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
+         w.write("    <td><a href=\"classes/" +
+               cfi.getClassName().replace('/', '.') + ".html\">" + cfi.getPrettyName() + "</a></td>" + NEW_LINE);
+         w.write("  </tr>" +
+               NEW_LINE);
+         odd = !odd;
+      }
 
-    boolean odd = true;
-    int count = 0;
+      w.write("</table>" +
+            NEW_LINE);
 
-    for (int i = 0; i < methods.size(); i++) {
-      CombinedFrameInfo h = methods.get(i);
+      w.write(NEW_LINE);
+      dumpHotspot(allMethods, 10, true, w);
+   }
 
-      if (h.getTotalTime() >= threshold) {
-        if (odd) {
-          bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        double avg = h.getTotalTime() / h.getCount();
+   /**
+    * Dump the methods
+    * @param info The information
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpMethods(Map<String, List<CombinedFrameInfo>> info, String directory) throws Exception
+   {
 
-        bw.write("    <td>" + h.getCount() + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(avg) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(h.getPercent()) + "</td>" + NEW_LINE);
-        bw.write("    <td><a href=\"classes/" + h.getClassName().replace('/', '.') + ".html\">" + 
-                 h.getPrettyName() + "</a></td>" + NEW_LINE);
-        bw.write("  </tr>" + NEW_LINE);
-        odd = !odd;
-      } else {
-        count++;
+      List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
+
+      Iterator it = info.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         methods.addAll(l);
       }
-    }
 
-    bw.write("</table>" + NEW_LINE);
+      FileWriter fw = new FileWriter(directory +
+            "methods.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-    if (count > 0) {
-      bw.write(NEW_LINE);
-      bw.write(count + " methods below threshold." + NEW_LINE);
-    }
+      HTMLUtil.header(bw, "Methods", true);
 
-    HTMLUtil.footer(bw);
+      bw.write("<h1>Methods</h1>" +
+            NEW_LINE);
 
-    bw.flush();
-    bw.close();
-  }
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Count</th>" +
+            NEW_LINE);
+      bw.write("     <th>Ms</th>" +
+            NEW_LINE);
+      bw.write("     <th>Avg</th>" +
+            NEW_LINE);
+      bw.write("     <th>%</th>" +
+            NEW_LINE);
+      bw.write("     <th>Method</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
 
-  /**
-   * Dump the hotspots
-   * @param info The information
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpHotspots(Map<String, List<CombinedFrameInfo>> info, 
-                              String directory) throws Exception {
+      Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
 
-    List<CombinedFrameInfo> hotspots = new ArrayList<CombinedFrameInfo>();
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    Iterator it = info.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      hotspots.addAll(l);
-    }
+      boolean odd = true;
+      int count = 0;
 
-    FileWriter fw = new FileWriter(directory + "hotspots.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+      for (int i = 0; i < methods.size(); i++)
+      {
+         CombinedFrameInfo h = methods.get(i);
 
-    HTMLUtil.header(bw, "Hotspots", true);
+         if (h.getTotalTime() >= threshold)
+         {
+            if (odd)
+            {
+               bw.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               bw.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            double avg = h.getTotalTime() /
+                  h.getCount();
 
-    bw.write("<h1>Hotspots</h1>" + NEW_LINE);
+            bw.write("    <td>" +
+                  h.getCount() + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(avg) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(h.getPercent()) + "</td>" + NEW_LINE);
+            bw.write("    <td><a href=\"classes/" +
+                  h.getClassName().replace('/', '.') + ".html\">" + h.getPrettyName() + "</a></td>" + NEW_LINE);
+            bw.write("  </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
+         else
+         {
+            count++;
+         }
+      }
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Count</th>" + NEW_LINE);
-    bw.write("     <th>Ms</th>" + NEW_LINE);
-    bw.write("     <th>Avg</th>" + NEW_LINE);
-    bw.write("     <th>%</th>" + NEW_LINE);
-    bw.write("     <th>Method</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
-    Collections.sort(hotspots, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
+      if (count > 0)
+      {
+         bw.write(NEW_LINE);
+         bw.write(count +
+               " methods below threshold." + NEW_LINE);
+      }
 
-    DecimalFormat df = new DecimalFormat("#0.00");
+      HTMLUtil.footer(bw);
 
-    boolean odd = true;
-    int count = 0;
+      bw.flush();
+      bw.close();
+   }
 
-    for (int i = 0; i < hotspots.size(); i++) {
-      CombinedFrameInfo h = hotspots.get(i);
+   /**
+    * Dump the hotspots
+    * @param info The information
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpHotspots(Map<String, List<CombinedFrameInfo>> info, String directory) throws Exception
+   {
 
-      double avg = h.getTotalTime() / h.getCount();
+      List<CombinedFrameInfo> hotspots = new ArrayList<CombinedFrameInfo>();
 
-      if (avg >= threshold) {
-        if (odd) {
-          bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        bw.write("    <td>" + h.getCount() + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(avg) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(h.getPercent()) + "</td>" + NEW_LINE);
-        bw.write("    <td><a href=\"classes/" + h.getClassName().replace('/', '.') + ".html\">" + 
-                 h.getPrettyName() + "</a></td>" + NEW_LINE);
-        bw.write("  </tr>" + NEW_LINE);
-        odd = !odd;
-      } else {
-        count++;
+      Iterator it = info.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         hotspots.addAll(l);
       }
-    }
 
-    bw.write("</table>" + NEW_LINE);
+      FileWriter fw = new FileWriter(directory +
+            "hotspots.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-    if (count > 0) {
-      bw.write(NEW_LINE);
-      bw.write(count + " methods below threshold." + NEW_LINE);
-    }
+      HTMLUtil.header(bw, "Hotspots", true);
 
-    HTMLUtil.footer(bw);
+      bw.write("<h1>Hotspots</h1>" +
+            NEW_LINE);
 
-    bw.flush();
-    bw.close();
-  }
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Count</th>" +
+            NEW_LINE);
+      bw.write("     <th>Ms</th>" +
+            NEW_LINE);
+      bw.write("     <th>Avg</th>" +
+            NEW_LINE);
+      bw.write("     <th>%</th>" +
+            NEW_LINE);
+      bw.write("     <th>Method</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
 
-  /**
-   * Dump the hotspots to a file writer
-   * @param hotspots The hotspots
-   * @param max The maximum hotspots
-   * @param include Include links
-   * @param w The writer
-   * @exception Exception If an error occurs
-   */
-  protected void dumpHotspot(List<CombinedFrameInfo> hotspots, int max, boolean include, Writer w) throws Exception {
-    w.write("<h2>Hotspots</h2>" + NEW_LINE);
-
-    if (hotspots != null) {
-      w.write("<table>" + NEW_LINE);
-      w.write("  <tr>" + NEW_LINE);
-      w.write("     <th>Count</th>" + NEW_LINE);
-      w.write("     <th>Ms</th>" + NEW_LINE);
-      w.write("     <th>Avg</th>" + NEW_LINE);
-      w.write("     <th>%</th>" + NEW_LINE);
-      w.write("     <th>Method</th>" + NEW_LINE);
-      w.write("  </tr>" + NEW_LINE);
-      
       Collections.sort(hotspots, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
 
       DecimalFormat df = new DecimalFormat("#0.00");
 
+      boolean odd = true;
       int count = 0;
-      boolean odd = true;
-      for (int i = 0; i < max && i < hotspots.size(); i++) {
-        CombinedFrameInfo h = hotspots.get(i);
-        
-        double avg = h.getTotalTime() / h.getCount();
 
-        if (avg >= threshold) {
-          if (odd) {
-            w.write("  <tr class=\"rowodd\">" + NEW_LINE);
-          } else {
-            w.write("  <tr class=\"roweven\">" + NEW_LINE);
-          }
-      
-          w.write("    <td>" + h.getCount() + "</td>" + NEW_LINE);
-          w.write("    <td>" + df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
-          w.write("    <td>" + df.format(avg) + "</td>" + NEW_LINE);
-          w.write("    <td>" + df.format(h.getPercent()) + "</td>" + NEW_LINE);
-          if (include) {
-            w.write("    <td><a href=\"classes/" + h.getClassName().replace('/', '.') + ".html\">" + 
-                    h.getPrettyName() + "</a></td>" + NEW_LINE);
-          } else {
-            w.write("    <td>" + h.getPrettyName() + "</td>" + NEW_LINE);
-          }
-          w.write("  </tr>" + NEW_LINE);
-          odd = !odd;
-        } else {
-          count++;
-        }
+      for (int i = 0; i < hotspots.size(); i++)
+      {
+         CombinedFrameInfo h = hotspots.get(i);
+
+         double avg = h.getTotalTime() /
+               h.getCount();
+
+         if (avg >= threshold)
+         {
+            if (odd)
+            {
+               bw.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               bw.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            bw.write("    <td>" +
+                  h.getCount() + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(avg) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(h.getPercent()) + "</td>" + NEW_LINE);
+            bw.write("    <td><a href=\"classes/" +
+                  h.getClassName().replace('/', '.') + ".html\">" + h.getPrettyName() + "</a></td>" + NEW_LINE);
+            bw.write("  </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
+         else
+         {
+            count++;
+         }
       }
 
-      w.write("</table>" + NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
-      if (count > 0) {
-        w.write(NEW_LINE);
-        w.write(count + " methods below threshold." + NEW_LINE);
+      if (count > 0)
+      {
+         bw.write(NEW_LINE);
+         bw.write(count +
+               " methods below threshold." + NEW_LINE);
       }
-    }
-  }
 
-  /**
-   * Dump the allocations to a file writer
-   * @param snapshot The snapshot
-   * @param w The file writer
-   * @exception Exception If an error occurs
-   */
-  protected void dumpAllocations(Snapshot snapshot, Writer w) throws Exception {
-    if (snapshot.getAllocations() != null && snapshot.getAllocations().size() > 0) {
-      Collections.sort(snapshot.getAllocations(), new AllocationComparator());
+      HTMLUtil.footer(bw);
 
-      w.write("<h2>Allocations</h2>" + NEW_LINE);
+      bw.flush();
+      bw.close();
+   }
 
-      w.write("<table>" + NEW_LINE);
-      w.write("  <tr>" + NEW_LINE);
-      w.write("     <th>Class</th>" + NEW_LINE);
-      w.write("     <th>Allocations</th>" + NEW_LINE);
-      w.write("  </tr>" + NEW_LINE);
-      
-      boolean odd = true;
-      for (AllocationInfo ai : snapshot.getAllocations()) {
-        if (odd) {
-          w.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          w.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        w.write("    <td><a href=\"classes/" + ai.getClassName().replace('/', '.') + ".html\">" + 
-                ai.getClassName() + "</a></td>" + NEW_LINE);
-        w.write("    <td>" + ai.getCount() + "</td>" + NEW_LINE);
-        w.write("  </tr>" + NEW_LINE);
-        odd = !odd;
-      }
+   /**
+    * Dump the hotspots to a file writer
+    * @param hotspots The hotspots
+    * @param max The maximum hotspots
+    * @param include Include links
+    * @param w The writer
+    * @exception Exception If an error occurs
+    */
+   protected void dumpHotspot(List<CombinedFrameInfo> hotspots, int max, boolean include, Writer w) throws Exception
+   {
+      w.write("<h2>Hotspots</h2>" +
+            NEW_LINE);
 
-      w.write("</table>" + NEW_LINE);
-    }
-  }
+      if (hotspots != null)
+      {
+         w.write("<table>" +
+               NEW_LINE);
+         w.write("  <tr>" +
+               NEW_LINE);
+         w.write("     <th>Count</th>" +
+               NEW_LINE);
+         w.write("     <th>Ms</th>" +
+               NEW_LINE);
+         w.write("     <th>Avg</th>" +
+               NEW_LINE);
+         w.write("     <th>%</th>" +
+               NEW_LINE);
+         w.write("     <th>Method</th>" +
+               NEW_LINE);
+         w.write("  </tr>" +
+               NEW_LINE);
 
-  /**
-   * Dump the classes to a file writer
-   * @param classes The classes
-   * @param info The combined frame info map
-   * @param allocs The allocations
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpClasses(List<TimedClassInfo> classes, 
-                             Map<String, List<CombinedFrameInfo>> info,
-                             List<AllocationInfo> allocs,
-                             String directory) throws Exception {
-    File f = new File(directory + "classes");
-    f.mkdirs();
+         Collections.sort(hotspots, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
 
-    Collections.sort(classes, new TimedClassComparator(TimedClassComparator.TOTAL_TIME));
+         DecimalFormat df = new DecimalFormat("#0.00");
 
-    DecimalFormat df = new DecimalFormat("#0.00");
-    
-    FileWriter fw = new FileWriter(directory + "classes.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+         int count = 0;
+         boolean odd = true;
+         for (int i = 0; i < max &&
+               i < hotspots.size(); i++)
+         {
+            CombinedFrameInfo h = hotspots.get(i);
 
-    HTMLUtil.header(bw, "Classes", true);
+            double avg = h.getTotalTime() /
+                  h.getCount();
 
-    bw.write("<h1>Classes</h1>" + NEW_LINE);
-    
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Class</th>" + NEW_LINE);
-    bw.write("     <th>Type</th>" + NEW_LINE);
-    bw.write("     <th>Time</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+            if (avg >= threshold)
+            {
+               if (odd)
+               {
+                  w.write("  <tr class=\"rowodd\">" +
+                        NEW_LINE);
+               }
+               else
+               {
+                  w.write("  <tr class=\"roweven\">" +
+                        NEW_LINE);
+               }
 
-    boolean odd = true;
-    for (TimedClassInfo tci : classes) {
-      if (odd) {
-        bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      } else {
-        bw.write("  <tr class=\"roweven\">" + NEW_LINE);
+               w.write("    <td>" +
+                     h.getCount() + "</td>" + NEW_LINE);
+               w.write("    <td>" +
+                     df.format(h.getTotalTime()) + "</td>" + NEW_LINE);
+               w.write("    <td>" +
+                     df.format(avg) + "</td>" + NEW_LINE);
+               w.write("    <td>" +
+                     df.format(h.getPercent()) + "</td>" + NEW_LINE);
+               if (include)
+               {
+                  w.write("    <td><a href=\"classes/" +
+                        h.getClassName().replace('/', '.') + ".html\">" + h.getPrettyName() + "</a></td>" + NEW_LINE);
+               }
+               else
+               {
+                  w.write("    <td>" +
+                        h.getPrettyName() + "</td>" + NEW_LINE);
+               }
+               w.write("  </tr>" +
+                     NEW_LINE);
+               odd = !odd;
+            }
+            else
+            {
+               count++;
+            }
+         }
+
+         w.write("</table>" +
+               NEW_LINE);
+
+         if (count > 0)
+         {
+            w.write(NEW_LINE);
+            w.write(count +
+                  " methods below threshold." + NEW_LINE);
+         }
       }
+   }
 
-      bw.write("    <td><a href=\"classes/" + tci.getClassName().replace('/', '.') + ".html\">" + 
-               Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
-      bw.write("    <td>" + Util.getDescription(tci) + "</td>" + NEW_LINE);
-      bw.write("    <td>" + df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
+   /**
+    * Dump the allocations to a file writer
+    * @param snapshot The snapshot
+    * @param w The file writer
+    * @exception Exception If an error occurs
+    */
+   protected void dumpAllocations(Snapshot snapshot, Writer w) throws Exception
+   {
+      if (snapshot.getAllocations() != null &&
+            snapshot.getAllocations().size() > 0)
+      {
+         Collections.sort(snapshot.getAllocations(), new AllocationComparator());
 
-      bw.write("  </tr>" + NEW_LINE);
-      odd = !odd;
+         w.write("<h2>Allocations</h2>" +
+               NEW_LINE);
 
-      List<CombinedFrameInfo> l = info.get(tci.getClassName());
-      dumpClass(tci, l, allocs, directory);
-    }
+         w.write("<table>" +
+               NEW_LINE);
+         w.write("  <tr>" +
+               NEW_LINE);
+         w.write("     <th>Class</th>" +
+               NEW_LINE);
+         w.write("     <th>Allocations</th>" +
+               NEW_LINE);
+         w.write("  </tr>" +
+               NEW_LINE);
 
-    bw.write("</table>" + NEW_LINE);
+         boolean odd = true;
+         for (AllocationInfo ai : snapshot.getAllocations())
+         {
+            if (odd)
+            {
+               w.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               w.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            w.write("    <td><a href=\"classes/" +
+                  ai.getClassName().replace('/', '.') + ".html\">" + ai.getClassName() + "</a></td>" + NEW_LINE);
+            w.write("    <td>" +
+                  ai.getCount() + "</td>" + NEW_LINE);
+            w.write("  </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
 
-    HTMLUtil.footer(bw);
+         w.write("</table>" +
+               NEW_LINE);
+      }
+   }
 
-    bw.flush();
-    bw.close();
-  }
+   /**
+    * Dump the classes to a file writer
+    * @param classes The classes
+    * @param info The combined frame info map
+    * @param allocs The allocations
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpClasses(List<TimedClassInfo> classes, Map<String, List<CombinedFrameInfo>> info,
+         List<AllocationInfo> allocs, String directory) throws Exception
+   {
+      File f = new File(directory +
+            "classes");
+      f.mkdirs();
 
-  /**
-   * Dump the class to a file writer
-   * @param tci The timed class
-   * @param cfs The combined frames
-   * @param allocs The allocations
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpClass(TimedClassInfo tci, 
-                           List<CombinedFrameInfo> cfs, 
-                           List<AllocationInfo> allocs,
-                           String directory) throws Exception {
+      Collections.sort(classes, new TimedClassComparator(TimedClassComparator.TOTAL_TIME));
 
-    String prettyClassName = Util.getPrettyName(tci);
-    FileWriter fcw = new FileWriter(directory + "classes" + File.separator + 
-                                    prettyClassName + ".html");
-    BufferedWriter bw = new BufferedWriter(fcw, 8192);
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    HTMLUtil.header(bw, "Class: " + prettyClassName, false);
-    
-    bw.write("<h1>" + Util.getPrettyName(tci) + " (" + Util.getDescription(tci) + ")</h1>" + NEW_LINE);
-    
-    DecimalFormat df = new DecimalFormat("#0.00");
+      FileWriter fw = new FileWriter(directory +
+            "classes.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-    bw.write("    <td>Total time</td><td>" + df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
-    bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-    bw.write("    <td>Wait time</td><td>" + df.format(tci.getWaitTime()) + " ms</td>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+      HTMLUtil.header(bw, "Classes", true);
 
-    if (allocs != null && allocs.size() > 0) {
-      bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-      long alloc = 0;
-      boolean found = false;
+      bw.write("<h1>Classes</h1>" +
+            NEW_LINE);
 
-      for (int i = 0; !found && i < allocs.size(); i++) {
-        AllocationInfo ai = allocs.get(i);
-        if (ai.getClassName().equals(prettyClassName)) {
-          alloc = ai.getCount();
-          found = true;
-        }
-      }
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Class</th>" +
+            NEW_LINE);
+      bw.write("     <th>Type</th>" +
+            NEW_LINE);
+      bw.write("     <th>Time</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
 
-      if (alloc < 2) {
-        bw.write("    <td>Allocation</td><td>" + alloc + "</td>" + NEW_LINE);
-      } else {
-        bw.write("    <td>Allocations</td><td>" + alloc + "</td>" + NEW_LINE);
-      }
-      bw.write("  </tr>" + NEW_LINE);
-    }
+      boolean odd = true;
+      for (TimedClassInfo tci : classes)
+      {
+         if (odd)
+         {
+            bw.write("  <tr class=\"rowodd\">" +
+                  NEW_LINE);
+         }
+         else
+         {
+            bw.write("  <tr class=\"roweven\">" +
+                  NEW_LINE);
+         }
 
-    bw.write("</table>" + NEW_LINE);
+         bw.write("    <td><a href=\"classes/" +
+               tci.getClassName().replace('/', '.') + ".html\">" + Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
+         bw.write("    <td>" +
+               Util.getDescription(tci) + "</td>" + NEW_LINE);
+         bw.write("    <td>" +
+               df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
 
-    bw.write("<h2>Callers</h2>" + NEW_LINE);
+         bw.write("  </tr>" +
+               NEW_LINE);
+         odd = !odd;
 
-    bw.write("<a href=\"../caller/" + prettyClassName + ".html\">Report</a></td>" + NEW_LINE);
-    
-    bw.write(NEW_LINE);
-    
-    bw.write("<h2>Methods</h2>" + NEW_LINE);
+         List<CombinedFrameInfo> l = info.get(tci.getClassName());
+         dumpClass(tci, l, allocs, directory);
+      }
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Count</th>" + NEW_LINE);
-    bw.write("     <th>Ms</th>" + NEW_LINE);
-    bw.write("     <th>% (C)</th>" + NEW_LINE);
-    bw.write("     <th>% (T)</th>" + NEW_LINE);
-    bw.write("     <th>Method</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
-    if (cfs != null) {
-      Collections.sort(cfs, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      HTMLUtil.footer(bw);
 
-      boolean odd = true;
-      for (CombinedFrameInfo cfi : cfs) {
-        if (odd) {
-          bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        bw.write("    <td>" + cfi.getCount() + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + cfi.getPrettyName() + "</td>" + NEW_LINE);
-        bw.write("  </tr>" + NEW_LINE);
-        odd = !odd;
-      }
-    }
+      bw.flush();
+      bw.close();
+   }
 
-    bw.write("</table>" + NEW_LINE);
-    
-    bw.write(NEW_LINE);
-    dumpHotspot(cfs, Integer.MAX_VALUE, false, bw);
-    
-    HTMLUtil.footer(bw);
+   /**
+    * Dump the class to a file writer
+    * @param tci The timed class
+    * @param cfs The combined frames
+    * @param allocs The allocations
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpClass(TimedClassInfo tci, List<CombinedFrameInfo> cfs, List<AllocationInfo> allocs,
+         String directory) throws Exception
+   {
 
-    bw.flush();
-    bw.close();
-  }
+      String prettyClassName = Util.getPrettyName(tci);
+      FileWriter fcw = new FileWriter(directory +
+            "classes" + File.separator + prettyClassName + ".html");
+      BufferedWriter bw = new BufferedWriter(fcw, 8192);
 
-  /**
-   * Dump the packages to a file writer
-   * @param info The combined frame information
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpPackages(Map<String, List<CombinedFrameInfo>> info,
-                              String directory) throws Exception {
-    FileWriter fw = new FileWriter(directory + "packages.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+      HTMLUtil.header(bw, "Class: " +
+            prettyClassName, false);
 
-    DecimalFormat df = new DecimalFormat("#0.00");
-    
-    HTMLUtil.header(bw, "Packages", true);
+      bw.write("<h1>" +
+            Util.getPrettyName(tci) + " (" + Util.getDescription(tci) + ")</h1>" + NEW_LINE);
 
-    bw.write("<h1>Packages</h1>" + NEW_LINE);
-    
-    Map<String, CombinedFrameInfo> packages = new HashMap<String, CombinedFrameInfo>();
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    Iterator it = info.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      List<CombinedFrameInfo> value = (List<CombinedFrameInfo>)entry.getValue();
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr class=\"rowodd\">" +
+            NEW_LINE);
+      bw.write("    <td>Total time</td><td>" +
+            df.format(tci.getTotalTime()) + " ms</td>" + NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+      bw.write("  <tr class=\"roweven\">" +
+            NEW_LINE);
+      bw.write("    <td>Wait time</td><td>" +
+            df.format(tci.getWaitTime()) + " ms</td>" + NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
 
-      for (CombinedFrameInfo cfi : value) {
-        String cn = cfi.getClassName();
-        cn = cn.replace('/', '.');
-        if (cn.lastIndexOf(".") != -1) {
-          cn = cn.substring(0, cn.lastIndexOf("."));
-        }
+      if (allocs != null &&
+            allocs.size() > 0)
+      {
+         bw.write("  <tr class=\"rowodd\">" +
+               NEW_LINE);
+         long alloc = 0;
+         boolean found = false;
 
-        CombinedFrameInfo ci = packages.get(cn);
-        if (ci == null) {
-          ci = new CombinedFrameInfo(cn, cn);
-        }
-        ci.increaseTotalTime(cfi.getTotalTime());
-        ci.increasePercent(cfi.getPercent());
-        packages.put(cn, ci);
+         for (int i = 0; !found &&
+               i < allocs.size(); i++)
+         {
+            AllocationInfo ai = allocs.get(i);
+            if (ai.getClassName().equals(prettyClassName))
+            {
+               alloc = ai.getCount();
+               found = true;
+            }
+         }
+
+         if (alloc < 2)
+         {
+            bw.write("    <td>Allocation</td><td>" +
+                  alloc + "</td>" + NEW_LINE);
+         }
+         else
+         {
+            bw.write("    <td>Allocations</td><td>" +
+                  alloc + "</td>" + NEW_LINE);
+         }
+         bw.write("  </tr>" +
+               NEW_LINE);
       }
-    }
 
-    List<CombinedFrameInfo> result = new ArrayList<CombinedFrameInfo>(packages.values());
-    Collections.sort(result, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      bw.write("</table>" +
+            NEW_LINE);
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>%</th>" + NEW_LINE);
-    bw.write("     <th>Ms</th>" + NEW_LINE);
-    bw.write("     <th>Package</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+      bw.write("<h2>Callers</h2>" +
+            NEW_LINE);
 
-    boolean odd = true;
+      bw.write("<a href=\"../caller/" +
+            prettyClassName + ".html\">Report</a></td>" + NEW_LINE);
 
-    int count = 0;
+      bw.write(NEW_LINE);
 
-    for (CombinedFrameInfo cfi : result) { 
-      if (cfi.getTotalTime() > threshold) {
-        if (odd) {
-          bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        bw.write("    <td>" + df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + cfi.getClassName() + "</td>" + NEW_LINE);
-        bw.write("   </tr>" + NEW_LINE);
-        odd = !odd;
-      } else {
-        count++;
+      bw.write("<h2>Methods</h2>" +
+            NEW_LINE);
+
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Count</th>" +
+            NEW_LINE);
+      bw.write("     <th>Ms</th>" +
+            NEW_LINE);
+      bw.write("     <th>% (C)</th>" +
+            NEW_LINE);
+      bw.write("     <th>% (T)</th>" +
+            NEW_LINE);
+      bw.write("     <th>Method</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+
+      if (cfs != null)
+      {
+         Collections.sort(cfs, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+
+         boolean odd = true;
+         for (CombinedFrameInfo cfi : cfs)
+         {
+            if (odd)
+            {
+               bw.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               bw.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            bw.write("    <td>" +
+                  cfi.getCount() + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  cfi.getPrettyName() + "</td>" + NEW_LINE);
+            bw.write("  </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
       }
-    }
 
-    bw.write("</table>" + NEW_LINE);
+      bw.write("</table>" +
+            NEW_LINE);
 
-    if (count > 0) {
       bw.write(NEW_LINE);
-      bw.write(count + " packages below threshold." + NEW_LINE);
-    }
+      dumpHotspot(cfs, Integer.MAX_VALUE, false, bw);
 
-    HTMLUtil.footer(bw);
+      HTMLUtil.footer(bw);
 
-    bw.flush();
-    bw.close();
-  }
+      bw.flush();
+      bw.close();
+   }
 
-  /**
-   * Dump the caller information to a file writer
-   * @param methodRepository The method repository
-   * @param threads The threads
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpCaller(MethodRepository methodRepository, 
-                            List<ThreadInfo> threads, 
-                            String directory) throws Exception {
+   /**
+    * Dump the packages to a file writer
+    * @param info The combined frame information
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpPackages(Map<String, List<CombinedFrameInfo>> info, String directory) throws Exception
+   {
+      FileWriter fw = new FileWriter(directory +
+            "packages.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-    File f = new File(directory + "caller");
-    f.mkdirs();
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-    Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
+      HTMLUtil.header(bw, "Packages", true);
 
-    for (ThreadInfo ti : threads) {
-      for (FrameInfo fi : ti.getFrames()) {
-        getCallerInformation(methodRepository, fi, data);
+      bw.write("<h1>Packages</h1>" +
+            NEW_LINE);
+
+      Map<String, CombinedFrameInfo> packages = new HashMap<String, CombinedFrameInfo>();
+
+      Iterator it = info.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         List<CombinedFrameInfo> value = (List<CombinedFrameInfo>)entry.getValue();
+
+         for (CombinedFrameInfo cfi : value)
+         {
+            String cn = cfi.getClassName();
+            cn = cn.replace('/', '.');
+            if (cn.lastIndexOf(".") != -1)
+            {
+               cn = cn.substring(0, cn.lastIndexOf("."));
+            }
+
+            CombinedFrameInfo ci = packages.get(cn);
+            if (ci == null)
+            {
+               ci = new CombinedFrameInfo(cn, cn);
+            }
+            ci.increaseTotalTime(cfi.getTotalTime());
+            ci.increasePercent(cfi.getPercent());
+            packages.put(cn, ci);
+         }
       }
 
-      if (ti instanceof ThreadInfoProxy) {
-        ThreadInfoProxy tip = (ThreadInfoProxy)ti;
-        tip.resetFrames();
+      List<CombinedFrameInfo> result = new ArrayList<CombinedFrameInfo>(packages.values());
+      Collections.sort(result, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>%</th>" +
+            NEW_LINE);
+      bw.write("     <th>Ms</th>" +
+            NEW_LINE);
+      bw.write("     <th>Package</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
+
+      boolean odd = true;
+
+      int count = 0;
+
+      for (CombinedFrameInfo cfi : result)
+      {
+         if (cfi.getTotalTime() > threshold)
+         {
+            if (odd)
+            {
+               bw.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               bw.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            bw.write("    <td>" +
+                  df.format(cfi.getPercent()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  cfi.getClassName() + "</td>" + NEW_LINE);
+            bw.write("   </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
+         else
+         {
+            count++;
+         }
       }
-    }
 
-    DecimalFormat df = new DecimalFormat("#0.00");
+      bw.write("</table>" +
+            NEW_LINE);
 
-    Iterator dit = data.entrySet().iterator();
-    while (dit.hasNext()) {
-      Map.Entry entry = (Map.Entry)dit.next();
+      if (count > 0)
+      {
+         bw.write(NEW_LINE);
+         bw.write(count +
+               " packages below threshold." + NEW_LINE);
+      }
 
-      String key = (String)entry.getKey();
-      Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
+      HTMLUtil.footer(bw);
 
-      FileWriter ftw = new FileWriter(directory + "caller" + File.separator + 
-                                      key.replace('/', '.') + ".html");
-      BufferedWriter bw = new BufferedWriter(ftw, 8192);
+      bw.flush();
+      bw.close();
+   }
 
-      HTMLUtil.header(bw, "Caller: " + key.replace('/', '.'), false);
+   /**
+    * Dump the caller information to a file writer
+    * @param methodRepository The method repository
+    * @param threads The threads
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpCaller(MethodRepository methodRepository, List<ThreadInfo> threads, String directory)
+      throws Exception
+   {
 
-      bw.write("<h1>Callers of " + key.replace('/', '.') + "</h1>" + NEW_LINE);
-      bw.write(NEW_LINE);
+      File f = new File(directory +
+            "caller");
+      f.mkdirs();
 
-      Map<String, List<CombinedFrameInfo>> m = new HashMap<String, List<CombinedFrameInfo>>();
+      Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
 
-      Iterator vit = value.values().iterator();
-      while (vit.hasNext()) {
-        CombinedFrameInfo cfi = (CombinedFrameInfo)vit.next();
+      for (ThreadInfo ti : threads)
+      {
+         for (FrameInfo fi : ti.getFrames())
+         {
+            getCallerInformation(methodRepository, fi, data);
+         }
 
-        List<CombinedFrameInfo> l = m.get(cfi.getClassName());
-        if (l == null) {
-          l = new ArrayList<CombinedFrameInfo>();
-          m.put(cfi.getClassName(), l);
-        }
-        l.add(cfi);
+         if (ti instanceof ThreadInfoProxy)
+         {
+            ThreadInfoProxy tip = (ThreadInfoProxy)ti;
+            tip.resetFrames();
+         }
       }
 
-      Iterator mit = m.entrySet().iterator();
-      while (mit.hasNext()) {
-        Map.Entry mentry = (Map.Entry)mit.next();
-        
-        String methodName = (String)mentry.getKey();
-        List<CombinedFrameInfo> callers = (List<CombinedFrameInfo>)mentry.getValue();
+      DecimalFormat df = new DecimalFormat("#0.00");
 
-        Collections.sort(callers, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      Iterator dit = data.entrySet().iterator();
+      while (dit.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)dit.next();
 
-        bw.write("<h2>" + methodName + "</h2>" + NEW_LINE);
+         String key = (String)entry.getKey();
+         Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
 
-        bw.write("<table>" + NEW_LINE);
-        bw.write("  <tr>" + NEW_LINE);
-        bw.write("     <th>Count</th>" + NEW_LINE);
-        bw.write("     <th>Avg</th>" + NEW_LINE);
-        bw.write("     <th>Ms</th>" + NEW_LINE);
-        bw.write("     <th>Method</th>" + NEW_LINE);
-        bw.write("  </tr>" + NEW_LINE);
-        
-        boolean odd = true;
+         FileWriter ftw = new FileWriter(directory +
+               "caller" + File.separator + key.replace('/', '.') + ".html");
+         BufferedWriter bw = new BufferedWriter(ftw, 8192);
 
-        for (CombinedFrameInfo cfi : callers) {
-          if (odd) {
-            bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-          } else {
-            bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-          }
-          bw.write("    <td>" + cfi.getCount() + "</td>" + NEW_LINE);
-          bw.write("    <td>" + df.format(cfi.getTotalTime() / (double)cfi.getCount()) + "</td>" + NEW_LINE);
-          bw.write("    <td>" + df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
-          bw.write("    <td>" + cfi.getPrettyName() + "</td>" + NEW_LINE);
-          bw.write("   </tr>" + NEW_LINE);
-          odd = !odd;
-        }
+         HTMLUtil.header(bw, "Caller: " +
+               key.replace('/', '.'), false);
 
-        bw.write("</table>" + NEW_LINE);
-        bw.write(NEW_LINE);
-      }
+         bw.write("<h1>Callers of " +
+               key.replace('/', '.') + "</h1>" + NEW_LINE);
+         bw.write(NEW_LINE);
 
-      HTMLUtil.footer(bw);
+         Map<String, List<CombinedFrameInfo>> m = new HashMap<String, List<CombinedFrameInfo>>();
 
-      bw.flush();
-      bw.close();
-    }
-  }
+         Iterator vit = value.values().iterator();
+         while (vit.hasNext())
+         {
+            CombinedFrameInfo cfi = (CombinedFrameInfo)vit.next();
 
-  /**
-   * Dump the wait time to a file writer
-   * @param classes The classes
-   * @param directory The directory
-   * @exception Exception If an error occurs
-   */
-  protected void dumpWaitTime(List<TimedClassInfo> classes, 
-                              String directory) throws Exception {
-    Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
+            List<CombinedFrameInfo> l = m.get(cfi.getClassName());
+            if (l == null)
+            {
+               l = new ArrayList<CombinedFrameInfo>();
+               m.put(cfi.getClassName(), l);
+            }
+            l.add(cfi);
+         }
 
-    DecimalFormat df = new DecimalFormat("#0.00");
-    
-    FileWriter fw = new FileWriter(directory + "waittime.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+         Iterator mit = m.entrySet().iterator();
+         while (mit.hasNext())
+         {
+            Map.Entry mentry = (Map.Entry)mit.next();
 
-    HTMLUtil.header(bw, "Wait time", true);
+            String methodName = (String)mentry.getKey();
+            List<CombinedFrameInfo> callers = (List<CombinedFrameInfo>)mentry.getValue();
 
-    bw.write("<h1>Wait time</h1>" + NEW_LINE);
-    bw.write(NEW_LINE);
+            Collections.sort(callers, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
 
-    bw.write("<h2>Classes</h2>" + NEW_LINE);
+            bw.write("<h2>" +
+                  methodName + "</h2>" + NEW_LINE);
 
-    bw.write("<table>" + NEW_LINE);
-    bw.write("  <tr>" + NEW_LINE);
-    bw.write("     <th>Class</th>" + NEW_LINE);
-    bw.write("     <th>Type</th>" + NEW_LINE);
-    bw.write("     <th>Time</th>" + NEW_LINE);
-    bw.write("  </tr>" + NEW_LINE);
+            bw.write("<table>" +
+                  NEW_LINE);
+            bw.write("  <tr>" +
+                  NEW_LINE);
+            bw.write("     <th>Count</th>" +
+                  NEW_LINE);
+            bw.write("     <th>Avg</th>" +
+                  NEW_LINE);
+            bw.write("     <th>Ms</th>" +
+                  NEW_LINE);
+            bw.write("     <th>Method</th>" +
+                  NEW_LINE);
+            bw.write("  </tr>" +
+                  NEW_LINE);
 
-    boolean odd = true;
-    int count = 0;
+            boolean odd = true;
 
-    for (TimedClassInfo tci : classes) {
-      if (tci.getWaitTime() >= threshold) {
-        if (odd) {
-          bw.write("  <tr class=\"rowodd\">" + NEW_LINE);
-        } else {
-          bw.write("  <tr class=\"roweven\">" + NEW_LINE);
-        }
-        bw.write("    <td><a href=\"classes/" + tci.getClassName().replace('/', '.') + ".html\">" + 
-                 Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
-        bw.write("    <td>" + Util.getDescription(tci) + "</td>" + NEW_LINE);
-        bw.write("    <td>" + df.format(tci.getWaitTime()) + " ms</td>" + NEW_LINE);
-        bw.write("   </tr>" + NEW_LINE);
-        odd = !odd;
-      } else {
-        count++;
+            for (CombinedFrameInfo cfi : callers)
+            {
+               if (odd)
+               {
+                  bw.write("  <tr class=\"rowodd\">" +
+                        NEW_LINE);
+               }
+               else
+               {
+                  bw.write("  <tr class=\"roweven\">" +
+                        NEW_LINE);
+               }
+               bw.write("    <td>" +
+                     cfi.getCount() + "</td>" + NEW_LINE);
+               bw.write("    <td>" +
+                     df.format(cfi.getTotalTime() /
+                           (double)cfi.getCount()) + "</td>" + NEW_LINE);
+               bw.write("    <td>" +
+                     df.format(cfi.getTotalTime()) + "</td>" + NEW_LINE);
+               bw.write("    <td>" +
+                     cfi.getPrettyName() + "</td>" + NEW_LINE);
+               bw.write("   </tr>" +
+                     NEW_LINE);
+               odd = !odd;
+            }
+
+            bw.write("</table>" +
+                  NEW_LINE);
+            bw.write(NEW_LINE);
+         }
+
+         HTMLUtil.footer(bw);
+
+         bw.flush();
+         bw.close();
       }
-    }
+   }
 
-    bw.write("</table>" + NEW_LINE);
+   /**
+    * Dump the wait time to a file writer
+    * @param classes The classes
+    * @param directory The directory
+    * @exception Exception If an error occurs
+    */
+   protected void dumpWaitTime(List<TimedClassInfo> classes, String directory) throws Exception
+   {
+      Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
 
-    if (count > 0) {
+      DecimalFormat df = new DecimalFormat("#0.00");
+
+      FileWriter fw = new FileWriter(directory +
+            "waittime.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
+
+      HTMLUtil.header(bw, "Wait time", true);
+
+      bw.write("<h1>Wait time</h1>" +
+            NEW_LINE);
       bw.write(NEW_LINE);
-      bw.write(count + " classes below threshold." + NEW_LINE);
-    }
 
-    HTMLUtil.footer(bw);
+      bw.write("<h2>Classes</h2>" +
+            NEW_LINE);
 
-    bw.flush();
-    bw.close();
-  }
+      bw.write("<table>" +
+            NEW_LINE);
+      bw.write("  <tr>" +
+            NEW_LINE);
+      bw.write("     <th>Class</th>" +
+            NEW_LINE);
+      bw.write("     <th>Type</th>" +
+            NEW_LINE);
+      bw.write("     <th>Time</th>" +
+            NEW_LINE);
+      bw.write("  </tr>" +
+            NEW_LINE);
 
-  /**
-   * Get caller information
-   * @param mr The method repository
-   * @param fi The frame
-   * @param data The data
-   */
-  protected void getCallerInformation(MethodRepository mr, 
-                                      FrameInfo fi, 
-                                      Map<String, Map<String, CombinedFrameInfo>> data) {
+      boolean odd = true;
+      int count = 0;
 
-    MethodInfo mi = mr.getInfo(fi.getMethod());
-    Map<String, CombinedFrameInfo> entry = data.get(mi.getClassName());
-    if (entry == null) {
-      entry = new HashMap<String, CombinedFrameInfo>();
-      data.put(mi.getClassName(), entry);
-    }
-    if (fi.getParent() != null) {
-      MethodInfo pmi = mr.getInfo(fi.getParent().getMethod());
-      String parentName = Util.getPrettyName(pmi);
-      CombinedFrameInfo cfi = entry.get(parentName);
-      if (cfi == null) {
-        cfi = new CombinedFrameInfo(Util.getPrettyName(mi), parentName);
-        entry.put(parentName, cfi);
+      for (TimedClassInfo tci : classes)
+      {
+         if (tci.getWaitTime() >= threshold)
+         {
+            if (odd)
+            {
+               bw.write("  <tr class=\"rowodd\">" +
+                     NEW_LINE);
+            }
+            else
+            {
+               bw.write("  <tr class=\"roweven\">" +
+                     NEW_LINE);
+            }
+            bw.write("    <td><a href=\"classes/" +
+                  tci.getClassName().replace('/', '.') + ".html\">" + Util.getPrettyName(tci) + "</a></td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  Util.getDescription(tci) + "</td>" + NEW_LINE);
+            bw.write("    <td>" +
+                  df.format(tci.getWaitTime()) + " ms</td>" + NEW_LINE);
+            bw.write("   </tr>" +
+                  NEW_LINE);
+            odd = !odd;
+         }
+         else
+         {
+            count++;
+         }
       }
 
-      cfi.increaseCount(fi.getParent().getCount());
-      cfi.increaseTotalTime(Math.nanoToMilli(fi.getParent().getNetTime()));
-    }
+      bw.write("</table>" +
+            NEW_LINE);
 
-    if (fi.getChildren() != null && fi.getChildren().size() > 0) {
-      for (FrameInfo child : fi.getChildren()) {
-        getCallerInformation(mr, child, data);
+      if (count > 0)
+      {
+         bw.write(NEW_LINE);
+         bw.write(count +
+               " classes below threshold." + NEW_LINE);
       }
-    }
-  }
 
-  /**
-   * Dump index.html
-   * @param outputDir where the reports go
-   * @exception Exception Thrown if an error occurs
-   */
-  private void dumpIndex(String outputDir) throws Exception {
-    FileWriter fw = new FileWriter(outputDir + "index.html");
-    BufferedWriter bw = new BufferedWriter(fw, 8192);
+      HTMLUtil.footer(bw);
 
-    HTMLUtil.header(bw, "Main", true);
+      bw.flush();
+      bw.close();
+   }
 
-    bw.write("<h1>" + Version.FULL_VERSION + "</h1>" + NEW_LINE);
-    bw.write(NEW_LINE);
+   /**
+    * Get caller information
+    * @param mr The method repository
+    * @param fi The frame
+    * @param data The data
+    */
+   protected void getCallerInformation(MethodRepository mr, FrameInfo fi,
+         Map<String, Map<String, CombinedFrameInfo>> data)
+   {
 
-    bw.write("<h2>Reports</h2>" + NEW_LINE);
-    bw.write(NEW_LINE);
+      MethodInfo mi = mr.getInfo(fi.getMethod());
+      Map<String, CombinedFrameInfo> entry = data.get(mi.getClassName());
+      if (entry == null)
+      {
+         entry = new HashMap<String, CombinedFrameInfo>();
+         data.put(mi.getClassName(), entry);
+      }
+      if (fi.getParent() != null)
+      {
+         MethodInfo pmi = mr.getInfo(fi.getParent().getMethod());
+         String parentName = Util.getPrettyName(pmi);
+         CombinedFrameInfo cfi = entry.get(parentName);
+         if (cfi == null)
+         {
+            cfi = new CombinedFrameInfo(Util.getPrettyName(mi), parentName);
+            entry.put(parentName, cfi);
+         }
 
-    bw.write("<ul>" + NEW_LINE);
+         cfi.increaseCount(fi.getParent().getCount());
+         cfi.increaseTotalTime(Math.nanoToMilli(fi.getParent().getNetTime()));
+      }
 
-    bw.write("<li><a href=\"overview.html\">Overview</a></li>");
-    bw.write("<li><a href=\"hotspots.html\">Hotspots</a></li>");
-    bw.write("<li><a href=\"packages.html\">Packages</a></li>");
-    bw.write("<li><a href=\"classes.html\">Classes</a></li>");
-    bw.write("<li><a href=\"methods.html\">Methods</a></li>");
-    bw.write("<li><a href=\"waittime.html\">Wait time</a></li>");
+      if (fi.getChildren() != null &&
+            fi.getChildren().size() > 0)
+      {
+         for (FrameInfo child : fi.getChildren())
+         {
+            getCallerInformation(mr, child, data);
+         }
+      }
+   }
 
-    bw.write("</ul>" + NEW_LINE);
+   /**
+    * Dump index.html
+    * @param outputDir where the reports go
+    * @exception Exception Thrown if an error occurs
+    */
+   private void dumpIndex(String outputDir) throws Exception
+   {
+      FileWriter fw = new FileWriter(outputDir +
+            "index.html");
+      BufferedWriter bw = new BufferedWriter(fw, 8192);
 
-    HTMLUtil.footer(bw);
+      HTMLUtil.header(bw, "Main", true);
 
-    bw.flush();
-    bw.close();
-  }
+      bw.write("<h1>" +
+            Version.FULL_VERSION + "</h1>" + NEW_LINE);
+      bw.write(NEW_LINE);
 
-  /**
-   * Dump CSS files
-   * @param outputDir where the reports go
-   * @exception Exception Thrown if an error occurs
-   */
-  private void dumpCSS(String outputDir) throws Exception {
-    byte buffer[] = new byte[8192];
-    int bytesRead;
-    
-    InputStream is = null;
-    OutputStream os = null;
-    try {
-      is = Thread.currentThread().getContextClassLoader().getResourceAsStream("style.css");
-      os = new FileOutputStream(outputDir + "style.css");
-      
-      while ((bytesRead = is.read(buffer)) != -1) {
-        os.write(buffer, 0, bytesRead);
-      }
+      bw.write("<h2>Reports</h2>" +
+            NEW_LINE);
+      bw.write(NEW_LINE);
 
-      os.flush();
-    } finally {
-      try {
-        if (is != null) {
-          is.close();
-        }
-      } catch (IOException ioe) {
-        // Ignore
+      bw.write("<ul>" +
+            NEW_LINE);
+
+      bw.write("<li><a href=\"overview.html\">Overview</a></li>");
+      bw.write("<li><a href=\"hotspots.html\">Hotspots</a></li>");
+      bw.write("<li><a href=\"packages.html\">Packages</a></li>");
+      bw.write("<li><a href=\"classes.html\">Classes</a></li>");
+      bw.write("<li><a href=\"methods.html\">Methods</a></li>");
+      bw.write("<li><a href=\"waittime.html\">Wait time</a></li>");
+
+      bw.write("</ul>" +
+            NEW_LINE);
+
+      HTMLUtil.footer(bw);
+
+      bw.flush();
+      bw.close();
+   }
+
+   /**
+    * Dump CSS files
+    * @param outputDir where the reports go
+    * @exception Exception Thrown if an error occurs
+    */
+   private void dumpCSS(String outputDir) throws Exception
+   {
+      byte buffer[] = new byte[8192];
+      int bytesRead;
+
+      InputStream is = null;
+      OutputStream os = null;
+      try
+      {
+         is = Thread.currentThread().getContextClassLoader().getResourceAsStream("style.css");
+         os = new FileOutputStream(outputDir +
+               "style.css");
+
+         while ((bytesRead = is.read(buffer)) != -1)
+         {
+            os.write(buffer, 0, bytesRead);
+         }
+
+         os.flush();
       }
+      finally
+      {
+         try
+         {
+            if (is != null)
+            {
+               is.close();
+            }
+         }
+         catch (IOException ioe)
+         {
+            // Ignore
+         }
 
-      try {
-        if (os != null) {
-          os.close();
-        }
-      } catch (IOException ioe) {
-        // Ignore
+         try
+         {
+            if (os != null)
+            {
+               os.close();
+            }
+         }
+         catch (IOException ioe)
+         {
+            // Ignore
+         }
       }
-    }
-  }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/ThreadHolder.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/ThreadHolder.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/ThreadHolder.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,50 +27,55 @@
  * The thread info holder class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ThreadHolder {
+public class ThreadHolder
+{
 
-  /** The score */
-  private double score;
+   /** The score */
+   private double score;
 
-  /** The old thread */
-  private ThreadInfo oldThread;
+   /** The old thread */
+   private ThreadInfo oldThread;
 
-  /** The new thread */
-  private ThreadInfo newThread;
+   /** The new thread */
+   private ThreadInfo newThread;
 
-  /**
-   * Constructor
-   * @param ot The old thread
-   * @param nt The new thread
-   * @param sc The score
-   */
-  public ThreadHolder(ThreadInfo ot, ThreadInfo nt, double sc) {
-    oldThread = ot;
-    newThread = nt;
-    score = sc;
-  }
+   /**
+    * Constructor
+    * @param ot The old thread
+    * @param nt The new thread
+    * @param sc The score
+    */
+   public ThreadHolder(ThreadInfo ot, ThreadInfo nt, double sc)
+   {
+      oldThread = ot;
+      newThread = nt;
+      score = sc;
+   }
 
-  /**
-   * Get the old thread
-   * @return The old thread
-   */
-  public ThreadInfo getOld() {
-    return oldThread;
-  }
-  
-  /**
-   * Get the new thread
-   * @return The new thread
-   */
-  public ThreadInfo getNew() {
-    return newThread;
-  }
-  
-  /**
-   * Get the score
-   * @return The score
-   */
-  public double getScore() {
-    return score;
-  }
+   /**
+    * Get the old thread
+    * @return The old thread
+    */
+   public ThreadInfo getOld()
+   {
+      return oldThread;
+   }
+
+   /**
+    * Get the new thread
+    * @return The new thread
+    */
+   public ThreadInfo getNew()
+   {
+      return newThread;
+   }
+
+   /**
+    * Get the score
+    * @return The score
+    */
+   public double getScore()
+   {
+      return score;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,54 +28,72 @@
  * Timed class comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class TimedClassComparator implements Comparator<TimedClassInfo>, Serializable {
+public class TimedClassComparator implements Comparator<TimedClassInfo>, Serializable
+{
 
-  /** Method: TOTAL TIME */
-  public static final int TOTAL_TIME = 0;
+   /** Method: TOTAL TIME */
+   public static final int TOTAL_TIME = 0;
 
-  /** Method: NAME */
-  public static final int NAME = 1;
+   /** Method: NAME */
+   public static final int NAME = 1;
 
-  /** Method: WAIT TIME */
-  public static final int WAIT_TIME = 2;
+   /** Method: WAIT TIME */
+   public static final int WAIT_TIME = 2;
 
-  /** The method */
-  private int method;
-  
-  /**
-   * Constructor
-   * @param method The method
-   */
-  public TimedClassComparator(int method) {
-    this.method = method;
-  }
+   /** The method */
+   private int method;
 
-  /**
-   * Compare two objects
-   * @param ta Timed class info
-   * @param tb Timed class info
-   * @return Positive if tb greater than ta; zero if equal otherwise negative
-   */
-  public int compare(TimedClassInfo ta, TimedClassInfo tb) {
-    if (method == TOTAL_TIME) {
-      if (ta.getTotalTime() < tb.getTotalTime()) {
-        return 1;
-      } else if (ta.getTotalTime() == tb.getTotalTime()) {
-        return ta.getClassName().compareTo(tb.getClassName());
-      } else {
-        return -1;
+   /**
+    * Constructor
+    * @param method The method
+    */
+   public TimedClassComparator(int method)
+   {
+      this.method = method;
+   }
+
+   /**
+    * Compare two objects
+    * @param ta Timed class info
+    * @param tb Timed class info
+    * @return Positive if tb greater than ta; zero if equal otherwise negative
+    */
+   public int compare(TimedClassInfo ta, TimedClassInfo tb)
+   {
+      if (method == TOTAL_TIME)
+      {
+         if (ta.getTotalTime() < tb.getTotalTime())
+         {
+            return 1;
+         }
+         else if (ta.getTotalTime() == tb.getTotalTime())
+         {
+            return ta.getClassName().compareTo(tb.getClassName());
+         }
+         else
+         {
+            return -1;
+         }
       }
-    } else if (method == NAME) {
-      return ta.getClassName().compareTo(tb.getClassName());
-    } else if (method == WAIT_TIME) {
-      if (ta.getWaitTime() < tb.getWaitTime()) {
-        return 1;
-      } else if (ta.getWaitTime() == tb.getWaitTime()) {
-        return ta.getClassName().compareTo(tb.getClassName());
-      } else {
-        return -1;
+      else if (method == NAME)
+      {
+         return ta.getClassName().compareTo(tb.getClassName());
       }
-    }
-    return 0;
-  }
+      else if (method == WAIT_TIME)
+      {
+         if (ta.getWaitTime() < tb.getWaitTime())
+         {
+            return 1;
+         }
+         else if (ta.getWaitTime() == tb.getWaitTime())
+         {
+            return ta.getClassName().compareTo(tb.getClassName());
+         }
+         else
+         {
+            return -1;
+         }
+      }
+      return 0;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -23,54 +23,58 @@
 
 import org.jboss.profiler.shared.ClassInfo;
 
-import java.io.Serializable;
-
 /**
  * Represents a timed class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class TimedClassInfo extends ClassInfo {
+public class TimedClassInfo extends ClassInfo
+{
 
-  /** The time */
-  private double time;
-  
-  /** The wait time */
-  private double wait;
-  
-  /**
-   * Constructor
-   * @param ci The class info
-   * @param time The total time (ms)
-   * @param wait The wait time (ms)
-   */
-  public TimedClassInfo(ClassInfo ci, double time, double wait) {
-    super(ci.getClassName(), ci.getClassType());
-    this.time = time;
-    this.wait = wait;
-  }
+   /** The time */
+   private double time;
 
-  /**
-   * Get the time (ms)
-   * @return The time
-   */
-  public double getTotalTime() {
-    return time;
-  }
+   /** The wait time */
+   private double wait;
 
-  /**
-   * Get the wait time (ms)
-   * @return The wait time
-   */
-  public double getWaitTime() {
-    return wait;
-  }
+   /**
+    * Constructor
+    * @param ci The class info
+    * @param time The total time (ms)
+    * @param wait The wait time (ms)
+    */
+   public TimedClassInfo(ClassInfo ci, double time, double wait)
+   {
+      super(ci.getClassName(), ci.getClassType());
+      this.time = time;
+      this.wait = wait;
+   }
 
-  /**
-   * Get the string representation
-   * @return The string
-   */
-  @Override
-  public String toString() {
-    return super.toString() + "," + time + "," + wait; 
-  }
+   /**
+    * Get the time (ms)
+    * @return The time
+    */
+   public double getTotalTime()
+   {
+      return time;
+   }
+
+   /**
+    * Get the wait time (ms)
+    * @return The wait time
+    */
+   public double getWaitTime()
+   {
+      return wait;
+   }
+
+   /**
+    * Get the string representation
+    * @return The string
+    */
+   @Override
+   public String toString()
+   {
+      return super.toString() +
+            "," + time + "," + wait;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/Util.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/Util.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/Util.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,211 +34,289 @@
  * The utility class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Util {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Util.class);
+public class Util
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Util.class);
 
-  /** The plugins */
-  private static List<Plugin> plugins;
+   /** The plugins */
+   private static List<Plugin> plugins;
 
-  /**
-   * Set the list of plugins
-   * @param ps The plugins
-   */
-  public static void setPlugins(List<Plugin> ps) {
-    plugins = ps;
-  }
+   /**
+    * Set the list of plugins
+    * @param ps The plugins
+    */
+   public static void setPlugins(List<Plugin> ps)
+   {
+      plugins = ps;
+   }
 
-  /**
-   * Get the class type description
-   * @param ci The class info
-   * @return The description
-   */
-  public static String getDescription(ClassInfo ci) {
-    if (ClassType.POJO == ci.getClassType()) {
-      return "POJO";
-    } else if (ClassType.THROWABLE == ci.getClassType()) {
-      return "THROWABLE";
-    } else if (ClassType.EJB_SESSION == ci.getClassType()) {
-      return "EJB_SESSION";
-    } else if (ClassType.EJB_ENTITY == ci.getClassType()) {
-      return "EJB_ENTITY";
-    } else if (ClassType.EJB_MESSAGE == ci.getClassType()) {
-      return "EJB_MESSAGE";
-    } else if (ClassType.SERVLET == ci.getClassType()) {
-      return "SERVLET";
-    } else if (ClassType.SERVLET_FILTER == ci.getClassType()) {
-      return "SERVLET_FILTER";
-    } else if (ClassType.JSP == ci.getClassType()) {
-      return "JSP";
-    } else if (ClassType.JMX_MBEAN == ci.getClassType()) {
-      return "JMX_MBEAN";
-    } else if (ClassType.JSF_CONVERTER == ci.getClassType()) {
-      return "JSF_CONVERTER";
-    } else if (ClassType.JSF_MANAGED_BEAN == ci.getClassType()) {
-      return "JSF_MANAGED_BEAN";
-    } else if (ClassType.RMI_REMOTE == ci.getClassType()) {
-      return "RMI_REMOTE";
-    } else if (ClassType.RMI_SERVER == ci.getClassType()) {
-      return "RMI_SERVER";
-    } else if (ClassType.CORBA_OBJECT == ci.getClassType()) {
-      return "CORBA_OBJECT";
-    } else if (ClassType.CORBA_SERVANT == ci.getClassType()) {
-      return "CORBA_SERVANT";
-    }
+   /**
+    * Get the class type description
+    * @param ci The class info
+    * @return The description
+    */
+   public static String getDescription(ClassInfo ci)
+   {
+      if (ClassType.POJO == ci.getClassType())
+      {
+         return "POJO";
+      }
+      else if (ClassType.THROWABLE == ci.getClassType())
+      {
+         return "THROWABLE";
+      }
+      else if (ClassType.EJB_SESSION == ci.getClassType())
+      {
+         return "EJB_SESSION";
+      }
+      else if (ClassType.EJB_ENTITY == ci.getClassType())
+      {
+         return "EJB_ENTITY";
+      }
+      else if (ClassType.EJB_MESSAGE == ci.getClassType())
+      {
+         return "EJB_MESSAGE";
+      }
+      else if (ClassType.SERVLET == ci.getClassType())
+      {
+         return "SERVLET";
+      }
+      else if (ClassType.SERVLET_FILTER == ci.getClassType())
+      {
+         return "SERVLET_FILTER";
+      }
+      else if (ClassType.JSP == ci.getClassType())
+      {
+         return "JSP";
+      }
+      else if (ClassType.JMX_MBEAN == ci.getClassType())
+      {
+         return "JMX_MBEAN";
+      }
+      else if (ClassType.JSF_CONVERTER == ci.getClassType())
+      {
+         return "JSF_CONVERTER";
+      }
+      else if (ClassType.JSF_MANAGED_BEAN == ci.getClassType())
+      {
+         return "JSF_MANAGED_BEAN";
+      }
+      else if (ClassType.RMI_REMOTE == ci.getClassType())
+      {
+         return "RMI_REMOTE";
+      }
+      else if (ClassType.RMI_SERVER == ci.getClassType())
+      {
+         return "RMI_SERVER";
+      }
+      else if (ClassType.CORBA_OBJECT == ci.getClassType())
+      {
+         return "CORBA_OBJECT";
+      }
+      else if (ClassType.CORBA_SERVANT == ci.getClassType())
+      {
+         return "CORBA_SERVANT";
+      }
 
-    if (plugins != null) {
-      for (Plugin p : plugins) {
-        String description = p.getDescription(ci.getClassType());
-        if (description != null) {
-          return description;
-        }
+      if (plugins != null)
+      {
+         for (Plugin p : plugins)
+         {
+            String description = p.getDescription(ci.getClassType());
+            if (description != null)
+            {
+               return description;
+            }
+         }
       }
-    }
 
-    return "UNKNOWN (" + ci.getClassType() + ")";
-  }
+      return "UNKNOWN (" +
+            ci.getClassType() + ")";
+   }
 
-  /**
-   * Get pretty name
-   * @param ci The class info
-   * @return The pretty name
-   */
-  public static String getPrettyName(ClassInfo ci) {
-    return ci.getClassName().replace('/', '.');
-  }
+   /**
+    * Get pretty name
+    * @param ci The class info
+    * @return The pretty name
+    */
+   public static String getPrettyName(ClassInfo ci)
+   {
+      return ci.getClassName().replace('/', '.');
+   }
 
-  /**
-   * Get pretty name
-   * @param mi The method info
-   * @return The pretty name
-   */
-  public static String getPrettyName(MethodInfo mi) {
-    // Javassist
-    if (mi.getMethodName().endsWith(")")) {
-      int start = mi.getMethodName().indexOf("(");
-      int dot = mi.getMethodName().indexOf(".");
+   /**
+    * Get pretty name
+    * @param mi The method info
+    * @return The pretty name
+    */
+   public static String getPrettyName(MethodInfo mi)
+   {
+      // Javassist
+      if (mi.getMethodName().endsWith(")"))
+      {
+         int start = mi.getMethodName().indexOf("(");
+         int dot = mi.getMethodName().indexOf(".");
 
-      StringBuffer sb = new StringBuffer(mi.getMethodName().substring(0, start));
+         StringBuffer sb = new StringBuffer(mi.getMethodName().substring(0, start));
 
-      if (dot != -1 && dot < start) {
-        int lastDot = sb.lastIndexOf(".");
+         if (dot != -1 &&
+               dot < start)
+         {
+            int lastDot = sb.lastIndexOf(".");
 
-        if (!mi.getClassName().endsWith(sb.substring(lastDot + 1, start))) {
-          sb.setCharAt(lastDot, '#');
-        } else {
-          sb = sb.append("#");
-        }
-      }
+            if (!mi.getClassName().endsWith(sb.substring(lastDot + 1, start)))
+            {
+               sb.setCharAt(lastDot, '#');
+            }
+            else
+            {
+               sb = sb.append("#");
+            }
+         }
 
-      sb = sb.append("(");
+         sb = sb.append("(");
 
-      if (start + 1 < mi.getMethodName().indexOf(")")) {
-        String[] params = mi.getMethodName().substring(start + 1, mi.getMethodName().indexOf(")")).split(",");
-        for (int i = 0; i < params.length; i++) {
-          String clz = params[i];
+         if (start + 1 < mi.getMethodName().indexOf(")"))
+         {
+            String[] params = mi.getMethodName().substring(start + 1, mi.getMethodName().indexOf(")")).split(",");
+            for (int i = 0; i < params.length; i++)
+            {
+               String clz = params[i];
 
-          int jl = clz.indexOf("java.lang");
-          if (jl != -1) {
-            if (clz.indexOf(".", jl + 10) == -1) {
-              clz = clz.replace("java.lang.", "");
+               int jl = clz.indexOf("java.lang");
+               if (jl != -1)
+               {
+                  if (clz.indexOf(".", jl + 10) == -1)
+                  {
+                     clz = clz.replace("java.lang.", "");
+                  }
+               }
+
+               sb = sb.append(clz);
+
+               if (i < params.length - 1)
+               {
+                  sb = sb.append(", ");
+               }
             }
-          }
+         }
 
-          sb = sb.append(clz);
+         sb = sb.append(")");
 
-          if (i < params.length - 1) {
-            sb = sb.append(", ");
-          }
-        }
+         return sb.toString();
       }
 
-      sb = sb.append(")");
+      // ASM
+      StringBuffer sb = new StringBuffer(mi.getClassName().replace('/', '.'));
+      sb = sb.append('#');
 
-      return sb.toString();
-    }
+      String m = mi.getMethodName();
 
-    // ASM
-    StringBuffer sb = new StringBuffer(mi.getClassName().replace('/', '.'));
-    sb = sb.append('#');
+      m = m.replace('/', '.');
+      m = m.substring(0, m.indexOf(")") + 1);
 
-    String m = mi.getMethodName();
+      int start = m.indexOf("(");
+      int end = m.indexOf(")");
 
-    m = m.replace('/', '.');
-    m = m.substring(0, m.indexOf(")") + 1);
+      sb = sb.append(m.substring(0, start + 1));
 
-    int start = m.indexOf("(");
-    int end = m.indexOf(")");
+      if (start + 1 != end)
+      {
+         String input = m.substring(start + 1, end);
+         String postfix = "";
 
-    sb = sb.append(m.substring(0, start + 1));
+         while (input != null &&
+               input.length() > 0)
+         {
+            char c = input.charAt(0);
 
-    if (start + 1 != end) {
-      String input = m.substring(start + 1, end);
-      String postfix = "";
+            while (c == '[')
+            {
+               postfix += "[]";
+               input = input.substring(1);
+               c = input.charAt(0);
+            }
 
-      while (input != null && input.length() > 0) {
-        char c = input.charAt(0);
+            if (c == 'Z')
+            {
+               sb = sb.append("boolean");
+               input = input.substring(1);
+            }
+            else if (c == 'B')
+            {
+               sb = sb.append("byte");
+               input = input.substring(1);
+            }
+            else if (c == 'C')
+            {
+               sb = sb.append("char");
+               input = input.substring(1);
+            }
+            else if (c == 'D')
+            {
+               sb = sb.append("double");
+               input = input.substring(1);
+            }
+            else if (c == 'F')
+            {
+               sb = sb.append("float");
+               input = input.substring(1);
+            }
+            else if (c == 'I')
+            {
+               sb = sb.append("int");
+               input = input.substring(1);
+            }
+            else if (c == 'J')
+            {
+               sb = sb.append("long");
+               input = input.substring(1);
+            }
+            else if (c == 'S')
+            {
+               sb = sb.append("short");
+               input = input.substring(1);
+            }
+            else
+            {
+               int cEnd = input.indexOf(";");
+               String clz = input.substring(1, cEnd);
+               if (cEnd + 1 < input.length())
+               {
+                  input = input.substring(cEnd + 1);
+               }
+               else
+               {
+                  input = "";
+               }
+               int jl = clz.indexOf("java.lang");
+               if (jl != -1)
+               {
+                  if (clz.indexOf(".", jl + 10) == -1)
+                  {
+                     clz = clz.replace("java.lang.", "");
+                  }
+               }
+               sb = sb.append(clz);
+            }
 
-        while (c == '[') {
-          postfix += "[]";
-          input = input.substring(1);
-          c = input.charAt(0);
-        }
+            if (postfix.length() > 0)
+            {
+               sb = sb.append(postfix);
+               postfix = "";
+            }
 
-        if (c == 'Z') {
-          sb = sb.append("boolean");
-          input = input.substring(1);
-        } else if (c == 'B') {
-          sb = sb.append("byte");
-          input = input.substring(1);
-        } else if (c == 'C') {
-          sb = sb.append("char");
-          input = input.substring(1);
-        } else if (c == 'D') {
-          sb = sb.append("double");
-          input = input.substring(1);
-        } else if (c == 'F') {
-          sb = sb.append("float");
-          input = input.substring(1); 
-        } else if (c == 'I') {
-          sb = sb.append("int");
-          input = input.substring(1);
-        } else if (c == 'J') {
-          sb = sb.append("long");
-          input = input.substring(1);
-        } else if (c == 'S') {
-          sb = sb.append("short");
-          input = input.substring(1);
-        } else {
-          int cEnd = input.indexOf(";");
-          String clz = input.substring(1, cEnd);
-          if (cEnd + 1 < input.length()) {
-            input = input.substring(cEnd + 1);
-          } else {
-            input = "";
-          }
-          int jl = clz.indexOf("java.lang");
-          if (jl != -1) {
-            if (clz.indexOf(".", jl + 10) == -1) {
-              clz = clz.replace("java.lang.", "");
+            if (input != null &&
+                  input.length() > 0)
+            {
+               sb = sb.append(", ");
             }
-          }
-          sb = sb.append(clz);
-        }
-
-        if (postfix.length() > 0) {
-          sb = sb.append(postfix);
-          postfix = "";
-        }
-
-        if (input != null && input.length() > 0) {
-          sb = sb.append(", ");
-        }
+         }
       }
-    }
 
-    sb = sb.append(")");
+      sb = sb.append(")");
 
-    return sb.toString();
-  }
+      return sb.toString();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -36,10 +36,7 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.text.DecimalFormat;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
 import org.jboss.logging.Logger;
@@ -49,361 +46,494 @@
  * The client
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Client {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Client.class);
+public class Client
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Client.class);
 
-  /**
-   * The usage method
-   */
-  private static void usage() {
-    System.out.println("Usage: Client [-h host] [-p port] <command>");
-    System.out.println("       startProfiler  : Start the profiler");
-    System.out.println("       stopProfiler   : Stop the profiler");
-    System.out.println("       snapshot       : Take a snapshot");
-    System.out.println("       getSnapshot    : Get a snapshot");
-    System.out.println("       listSnapshots  : List snapshots");
-    System.out.println("       clearSnapshots : Clear snapshots");
-    System.out.println("       gc             : Trigger garbage collection");
-    System.out.println("       enable         : Enable the profiler");
-    System.out.println("       disable        : Disable the profiler");
-    System.out.println("       load           : Load a snapshot");
-    System.out.println("       save           : Save a snapshot");
-    System.out.println("       diff           : Difference between snapshots");
-    System.out.println("       add            : Add classes (repository must be enabled)");
-    System.out.println("       remove         : Remove classes (repository must be enabled)");
-    System.out.println("       list           : List classes");
-  }
+   /**
+    * The usage method
+    */
+   private static void usage()
+   {
+      System.out.println("Usage: Client [-h host] [-p port] <command>");
+      System.out.println("       startProfiler  : Start the profiler");
+      System.out.println("       stopProfiler   : Stop the profiler");
+      System.out.println("       snapshot       : Take a snapshot");
+      System.out.println("       getSnapshot    : Get a snapshot");
+      System.out.println("       listSnapshots  : List snapshots");
+      System.out.println("       clearSnapshots : Clear snapshots");
+      System.out.println("       gc             : Trigger garbage collection");
+      System.out.println("       enable         : Enable the profiler");
+      System.out.println("       disable        : Disable the profiler");
+      System.out.println("       load           : Load a snapshot");
+      System.out.println("       save           : Save a snapshot");
+      System.out.println("       diff           : Difference between snapshots");
+      System.out.println("       add            : Add classes (repository must be enabled)");
+      System.out.println("       remove         : Remove classes (repository must be enabled)");
+      System.out.println("       list           : List classes");
+   }
 
-  /**
-   * The emain method
-   * @param args The arguments
-   */
-  public static void main(String[] args) {
-    if (args.length > 0) {
-      try {
-        String protocol = "socket";
-        String host = "localhost";
-        int port = 5400;
-        double threshold = 1.0;
-        String saveLocation = ".";
+   /**
+    * The emain method
+    * @param args The arguments
+    */
+   public static void main(String[] args)
+   {
+      if (args.length > 0)
+      {
+         try
+         {
+            String protocol = "socket";
+            String host = "localhost";
+            int port = 5400;
+            double threshold = 1.0;
+            String saveLocation = ".";
 
-        Properties properties = new Properties();
-        String propertiesFile = System.getProperty("jboss-profiler-client.properties");
-        boolean loaded = false;
-    
-        if (propertiesFile != null) {
-          FileInputStream fis = null;
-          try {
-            fis = new FileInputStream(propertiesFile);
-            properties.load(fis);
-            loaded = true;
-          } catch (IOException e) {
-            System.err.println("Unable to open " + propertiesFile);
-          } finally {
-            if (fis != null) {
-              try {
-                fis.close();
-              } catch (IOException ioe) {
-                // Nothing to do
-              }
+            Properties properties = new Properties();
+            String propertiesFile = System.getProperty("jboss-profiler-client.properties");
+            boolean loaded = false;
+
+            if (propertiesFile != null)
+            {
+               FileInputStream fis = null;
+               try
+               {
+                  fis = new FileInputStream(propertiesFile);
+                  properties.load(fis);
+                  loaded = true;
+               }
+               catch (IOException e)
+               {
+                  System.err.println("Unable to open " +
+                        propertiesFile);
+               }
+               finally
+               {
+                  if (fis != null)
+                  {
+                     try
+                     {
+                        fis.close();
+                     }
+                     catch (IOException ioe)
+                     {
+                        // Nothing to do
+                     }
+                  }
+               }
             }
-          }
-        }
-        if (!loaded) {
-          InputStream is = null;
-          try {
-            ClassLoader cl = Thread.currentThread().getContextClassLoader();
-            is = cl.getResourceAsStream("jboss-profiler-client.properties");
-            properties.load(is);
-            loaded = true;
-          } catch (Exception ie) {
-            // Properties file not found
-          } finally {
-            if (is != null) {
-              try {
-                is.close();
-              } catch (IOException ioe) {
-                // Nothing to do
-              }
+            if (!loaded)
+            {
+               InputStream is = null;
+               try
+               {
+                  ClassLoader cl = Thread.currentThread().getContextClassLoader();
+                  is = cl.getResourceAsStream("jboss-profiler-client.properties");
+                  properties.load(is);
+                  loaded = true;
+               }
+               catch (Exception ie)
+               {
+                  // Properties file not found
+               }
+               finally
+               {
+                  if (is != null)
+                  {
+                     try
+                     {
+                        is.close();
+                     }
+                     catch (IOException ioe)
+                     {
+                        // Nothing to do
+                     }
+                  }
+               }
             }
-          }
-        }
 
-        if (loaded) {
-          protocol = properties.getProperty("protocol", "socket");
-          host = properties.getProperty("host", "localhost");
-          port = Integer.valueOf(properties.getProperty("port", "5400"));
-          threshold = Double.valueOf(properties.getProperty("threshold", "1.0"));
-          saveLocation = properties.getProperty("savelocation", ".");
-          List<Plugin> plugins = PluginHelper.load(properties);
-          if (plugins.size() > 0) {
-            Util.setPlugins(plugins);
-          }
-        }
+            if (loaded)
+            {
+               protocol = properties.getProperty("protocol", "socket");
+               host = properties.getProperty("host", "localhost");
+               port = Integer.valueOf(properties.getProperty("port", "5400"));
+               threshold = Double.valueOf(properties.getProperty("threshold", "1.0"));
+               saveLocation = properties.getProperty("savelocation", ".");
+               List<Plugin> plugins = PluginHelper.load(properties);
+               if (plugins.size() > 0)
+               {
+                  Util.setPlugins(plugins);
+               }
+            }
 
-        if (!saveLocation.endsWith(File.separator)) {
-          saveLocation += File.separator;
-        }
-        
-        int i = 0;
+            if (!saveLocation.endsWith(File.separator))
+            {
+               saveLocation += File.separator;
+            }
 
-        if ("-h".equalsIgnoreCase(args[i])) {
-          i++;
-          host = args[i];
-          i++;
-        }
-        if ("-p".equalsIgnoreCase(args[i])) {
-          i++;
-          port = Integer.valueOf(args[i]);
-          i++;
-        }
+            int i = 0;
 
-        String cmdStr = args[i];
-        i++;
+            if ("-h".equalsIgnoreCase(args[i]))
+            {
+               i++;
+               host = args[i];
+               i++;
+            }
+            if ("-p".equalsIgnoreCase(args[i]))
+            {
+               i++;
+               port = Integer.valueOf(args[i]);
+               i++;
+            }
 
-        Command cmd = null;
-      
-        if (cmdStr.equalsIgnoreCase("startProfiler")) {
-          cmd = new Command(CommandType.START_PROFILER);
-        } else if (cmdStr.equalsIgnoreCase("stopProfiler")) {
-          cmd = new Command(CommandType.STOP_PROFILER);
-        } else if (cmdStr.equalsIgnoreCase("snapshot")) {
-          String output = null;
-          if (i < args.length) {
-            output = args[i];
+            String cmdStr = args[i];
             i++;
-          }
-          cmd = new Command(CommandType.SNAPSHOT, new Object[] {output});
-        } else if (cmdStr.equalsIgnoreCase("getSnapshot")) {
-          Integer number = null;
-          String output = null;
-          if (i < args.length) {
-            number = Integer.valueOf(args[i]);
-            i++;
-          }
-          if (i < args.length) {
-            output = args[i];
-            i++;
-          }
-          cmd = new Command(CommandType.GET_SNAPSHOT, new Object[] {number, output});
-        } else if (cmdStr.equalsIgnoreCase("listSnapshots")) {
-          cmd = new Command(CommandType.LIST_SNAPSHOTS);
-        } else if (cmdStr.equalsIgnoreCase("clearSnapshots")) {
-          cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
-        } else if (cmdStr.equalsIgnoreCase("gc")) {
-          cmd = new Command(CommandType.GC);
-        } else if (cmdStr.equalsIgnoreCase("enable")) {
-          cmd = new Command(CommandType.ENABLE);
-        } else if (cmdStr.equalsIgnoreCase("disable")) {
-          cmd = new Command(CommandType.DISABLE);
-        } else if (cmdStr.equalsIgnoreCase("load")) {
-          String input = null;
-          String output = null;
-          if (i < args.length) {
-            input = args[i];
-            i++;
-          }
-          if (i < args.length) {
-            output = args[i];
-            i++;
-          }
-          cmd = new Command(CommandType.LOAD, new Object[] {input, output});
-        } else if (cmdStr.equalsIgnoreCase("save")) {
-          Integer number = null;
-          String filename = null;
 
-          if (i < args.length) {
-            number = Integer.valueOf(args[i]);
-            i++;
-          }
-          if (i < args.length) {
-            filename = args[i];
-            i++;
-          }
-          cmd = new Command(CommandType.SAVE, new Object[] {number, filename});
+            Command cmd = null;
 
-        } else if (cmdStr.equalsIgnoreCase("diff")) {
-          String filename1 = null;
-          String filename2 = null;
+            if (cmdStr.equalsIgnoreCase("startProfiler"))
+            {
+               cmd = new Command(CommandType.START_PROFILER);
+            }
+            else if (cmdStr.equalsIgnoreCase("stopProfiler"))
+            {
+               cmd = new Command(CommandType.STOP_PROFILER);
+            }
+            else if (cmdStr.equalsIgnoreCase("snapshot"))
+            {
+               String output = null;
+               if (i < args.length)
+               {
+                  output = args[i];
+                  i++;
+               }
+               cmd = new Command(CommandType.SNAPSHOT, new Object[] {output});
+            }
+            else if (cmdStr.equalsIgnoreCase("getSnapshot"))
+            {
+               Integer number = null;
+               String output = null;
+               if (i < args.length)
+               {
+                  number = Integer.valueOf(args[i]);
+                  i++;
+               }
+               if (i < args.length)
+               {
+                  output = args[i];
+                  i++;
+               }
+               cmd = new Command(CommandType.GET_SNAPSHOT, new Object[] {number, output});
+            }
+            else if (cmdStr.equalsIgnoreCase("listSnapshots"))
+            {
+               cmd = new Command(CommandType.LIST_SNAPSHOTS);
+            }
+            else if (cmdStr.equalsIgnoreCase("clearSnapshots"))
+            {
+               cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
+            }
+            else if (cmdStr.equalsIgnoreCase("gc"))
+            {
+               cmd = new Command(CommandType.GC);
+            }
+            else if (cmdStr.equalsIgnoreCase("enable"))
+            {
+               cmd = new Command(CommandType.ENABLE);
+            }
+            else if (cmdStr.equalsIgnoreCase("disable"))
+            {
+               cmd = new Command(CommandType.DISABLE);
+            }
+            else if (cmdStr.equalsIgnoreCase("load"))
+            {
+               String input = null;
+               String output = null;
+               if (i < args.length)
+               {
+                  input = args[i];
+                  i++;
+               }
+               if (i < args.length)
+               {
+                  output = args[i];
+                  i++;
+               }
+               cmd = new Command(CommandType.LOAD, new Object[] {input, output});
+            }
+            else if (cmdStr.equalsIgnoreCase("save"))
+            {
+               Integer number = null;
+               String filename = null;
 
-          if (i < args.length) {
-            filename1 = args[i];
-            i++;
-          }
-          if (i < args.length) {
-            filename2 = args[i];
-            i++;
-          }
-          cmd = new Command(CommandType.DIFFERENCE, new Object[] {filename1, filename2});
-        } else if (cmdStr.equalsIgnoreCase("add")) {
-          if (i + 1 < args.length) {
-            String clz = args[i];
-            Visibility v = Visibility.PUBLIC;
-            if (args[i + 1].equalsIgnoreCase("private")) {
-              v = Visibility.PRIVATE;
-            } else if (args[i + 1].equalsIgnoreCase("protected")) {
-              v = Visibility.PROTECTED;
-            } else if (args[i + 1].equalsIgnoreCase("package")) {
-              v = Visibility.PACKAGE;
+               if (i < args.length)
+               {
+                  number = Integer.valueOf(args[i]);
+                  i++;
+               }
+               if (i < args.length)
+               {
+                  filename = args[i];
+                  i++;
+               }
+               cmd = new Command(CommandType.SAVE, new Object[] {number, filename});
+
             }
-            cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
-            i++;
-            i++;
-          }
-        } else if (cmdStr.equalsIgnoreCase("remove")) {
-          if (i < args.length) {
-            cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {args[i]});
-            i++;
-          }
-        } else if (cmdStr.equalsIgnoreCase("list")) {
-          cmd = new Command(CommandType.LIST_CLASSES);
-        } else {
-          usage();
-          return;
-        }
+            else if (cmdStr.equalsIgnoreCase("diff"))
+            {
+               String filename1 = null;
+               String filename2 = null;
 
-        if (cmd != null) {
-          InvokerLocator locator = new InvokerLocator(protocol + "://" + host + ":" + port);
-        
-          org.jboss.remoting.Client remotingClient = 
-            new org.jboss.remoting.Client(locator);
-          remotingClient.connect();
-        
-          if (cmd.getCommand() == CommandType.START_PROFILER ||
-              cmd.getCommand() == CommandType.STOP_PROFILER ||
-              cmd.getCommand() == CommandType.CLEAR_SNAPSHOTS ||
-              cmd.getCommand() == CommandType.GC ||
-              cmd.getCommand() == CommandType.ENABLE ||
-              cmd.getCommand() == CommandType.DISABLE ||
-              cmd.getCommand() == CommandType.ADD_CLASSES ||
-              cmd.getCommand() == CommandType.REMOVE_CLASSES) {
-            String response = (String)remotingClient.invoke(cmd);
-          } else if (cmd.getCommand() == CommandType.SNAPSHOT) {
-            Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
-            if (snapshot != null) {
-              String dir = null;
+               if (i < args.length)
+               {
+                  filename1 = args[i];
+                  i++;
+               }
+               if (i < args.length)
+               {
+                  filename2 = args[i];
+                  i++;
+               }
+               cmd = new Command(CommandType.DIFFERENCE, new Object[] {filename1, filename2});
+            }
+            else if (cmdStr.equalsIgnoreCase("add"))
+            {
+               if (i + 1 < args.length)
+               {
+                  String clz = args[i];
+                  Visibility v = Visibility.PUBLIC;
+                  if (args[i + 1].equalsIgnoreCase("private"))
+                  {
+                     v = Visibility.PRIVATE;
+                  }
+                  else if (args[i + 1].equalsIgnoreCase("protected"))
+                  {
+                     v = Visibility.PROTECTED;
+                  }
+                  else if (args[i + 1].equalsIgnoreCase("package"))
+                  {
+                     v = Visibility.PACKAGE;
+                  }
+                  cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
+                  i++;
+                  i++;
+               }
+            }
+            else if (cmdStr.equalsIgnoreCase("remove"))
+            {
+               if (i < args.length)
+               {
+                  cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {args[i]});
+                  i++;
+               }
+            }
+            else if (cmdStr.equalsIgnoreCase("list"))
+            {
+               cmd = new Command(CommandType.LIST_CLASSES);
+            }
+            else
+            {
+               usage();
+               return;
+            }
 
-              if (cmd.getArguments()[0] == null) {
-                dir = saveLocation + SnapshotHelper.getName(snapshot);
-              } else {
-                dir = (String)cmd.getArguments()[0];
-              }
+            if (cmd != null)
+            {
+               InvokerLocator locator = new InvokerLocator(protocol +
+                     "://" + host + ":" + port);
 
-              File d = new File(dir);
-              d.mkdirs();
+               org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+               remotingClient.connect();
 
-              SnapshotUtil su = new SnapshotUtil(threshold);
-              su.dump(snapshot, d);
-            }
-          } else if (cmd.getCommand() == CommandType.GET_SNAPSHOT) {
-            Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
-            if (snapshot != null) {
-              String dir = null;
+               if (cmd.getCommand() == CommandType.START_PROFILER ||
+                     cmd.getCommand() == CommandType.STOP_PROFILER || cmd.getCommand() == CommandType.CLEAR_SNAPSHOTS ||
+                     cmd.getCommand() == CommandType.GC || cmd.getCommand() == CommandType.ENABLE ||
+                     cmd.getCommand() == CommandType.DISABLE || cmd.getCommand() == CommandType.ADD_CLASSES ||
+                     cmd.getCommand() == CommandType.REMOVE_CLASSES)
+               {
+                  String response = (String)remotingClient.invoke(cmd);
+               }
+               else if (cmd.getCommand() == CommandType.SNAPSHOT)
+               {
+                  Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
+                  if (snapshot != null)
+                  {
+                     String dir = null;
 
-              if (cmd.getArguments()[1] == null) {
-                dir = saveLocation + SnapshotHelper.getName(snapshot);
-              } else {
-                dir = (String)cmd.getArguments()[1];
-              }
+                     if (cmd.getArguments()[0] == null)
+                     {
+                        dir = saveLocation +
+                              SnapshotHelper.getName(snapshot);
+                     }
+                     else
+                     {
+                        dir = (String)cmd.getArguments()[0];
+                     }
 
-              File d = new File(dir);
-              d.mkdirs();
+                     File d = new File(dir);
+                     d.mkdirs();
 
-              SnapshotUtil su = new SnapshotUtil(threshold);
-              su.dump(snapshot, d);
-            }
-          } else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS ||
-                     cmd.getCommand() == CommandType.LIST_CLASSES) {
-            String[] result = (String[])remotingClient.invoke(cmd);
-            if (result != null) {
-              for (int j = 0; j < result.length; j++) {
-                System.out.println(result[j]);
-              }
-            }
-          } else if (cmd.getCommand() == CommandType.LOAD) {
-            File file = new File((String)cmd.getArguments()[0]);
-            if (file.exists()) {
-              Snapshot snapshot = null;
+                     SnapshotUtil su = new SnapshotUtil(threshold);
+                     su.dump(snapshot, d);
+                  }
+               }
+               else if (cmd.getCommand() == CommandType.GET_SNAPSHOT)
+               {
+                  Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
+                  if (snapshot != null)
+                  {
+                     String dir = null;
 
-              if (file.isFile()) {
-                snapshot = SnapshotHelper.load(file);
-              } else if (file.isDirectory()) {
-                snapshot = SnapshotHelper.generate(file);
-              }
+                     if (cmd.getArguments()[1] == null)
+                     {
+                        dir = saveLocation +
+                              SnapshotHelper.getName(snapshot);
+                     }
+                     else
+                     {
+                        dir = (String)cmd.getArguments()[1];
+                     }
 
-              if (snapshot != null) {
-                String dir = null;
+                     File d = new File(dir);
+                     d.mkdirs();
 
-                if (cmd.getArguments()[1] == null) {
-                  dir = saveLocation + SnapshotHelper.getName(snapshot);
-                } else {
-                  dir = (String)cmd.getArguments()[1];
-                }
+                     SnapshotUtil su = new SnapshotUtil(threshold);
+                     su.dump(snapshot, d);
+                  }
+               }
+               else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS ||
+                     cmd.getCommand() == CommandType.LIST_CLASSES)
+               {
+                  String[] result = (String[])remotingClient.invoke(cmd);
+                  if (result != null)
+                  {
+                     for (int j = 0; j < result.length; j++)
+                     {
+                        System.out.println(result[j]);
+                     }
+                  }
+               }
+               else if (cmd.getCommand() == CommandType.LOAD)
+               {
+                  File file = new File((String)cmd.getArguments()[0]);
+                  if (file.exists())
+                  {
+                     Snapshot snapshot = null;
 
-                File d = new File(dir);
-                d.mkdirs();
+                     if (file.isFile())
+                     {
+                        snapshot = SnapshotHelper.load(file);
+                     }
+                     else if (file.isDirectory())
+                     {
+                        snapshot = SnapshotHelper.generate(file);
+                     }
 
-                SnapshotUtil su = new SnapshotUtil(threshold);
-                su.dump(snapshot, d);
-              }
-            }
-          } else if (cmd.getCommand() == CommandType.SAVE) {
-            Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
-            
-            if (snapshot != null) {
-              String name = null;
-              if (cmd.getArguments()[1] == null) {
-                name = saveLocation + SnapshotHelper.getName(snapshot);
-              } else {
-                name = (String)cmd.getArguments()[1];
-              }
-              SnapshotHelper.save(snapshot, new File(name));
-            }
-          } else if (cmd.getCommand() == CommandType.DIFFERENCE) {
-            File of = null;
-            if (cmd.getArguments()[0] != null) {
-              of = new File((String)cmd.getArguments()[0]);
-            }
-            File nf = null;
-            if (cmd.getArguments()[1] != null) {
-              nf = new File((String)cmd.getArguments()[1]);
-            }
+                     if (snapshot != null)
+                     {
+                        String dir = null;
 
-            Snapshot os = null;
-            Snapshot ns = null;
+                        if (cmd.getArguments()[1] == null)
+                        {
+                           dir = saveLocation +
+                                 SnapshotHelper.getName(snapshot);
+                        }
+                        else
+                        {
+                           dir = (String)cmd.getArguments()[1];
+                        }
 
-            if (of != null && of.exists()) {
-              if (of.isFile()) {
-                os = SnapshotHelper.load(of);
-              } else if (of.isDirectory()) {
-                os = SnapshotHelper.generate(of);
-              }
-            }
+                        File d = new File(dir);
+                        d.mkdirs();
 
-            if (nf != null && nf.exists()) {
-              if (nf.isFile()) {
-                ns = SnapshotHelper.load(nf);
-              } else if (nf.isDirectory()) {
-                ns = SnapshotHelper.generate(nf);
-              }
-            }
+                        SnapshotUtil su = new SnapshotUtil(threshold);
+                        su.dump(snapshot, d);
+                     }
+                  }
+               }
+               else if (cmd.getCommand() == CommandType.SAVE)
+               {
+                  Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
 
-            if (os != null && ns != null) {
-              DifferenceUtil du = new DifferenceUtil(threshold);
+                  if (snapshot != null)
+                  {
+                     String name = null;
+                     if (cmd.getArguments()[1] == null)
+                     {
+                        name = saveLocation +
+                              SnapshotHelper.getName(snapshot);
+                     }
+                     else
+                     {
+                        name = (String)cmd.getArguments()[1];
+                     }
+                     SnapshotHelper.save(snapshot, new File(name));
+                  }
+               }
+               else if (cmd.getCommand() == CommandType.DIFFERENCE)
+               {
+                  File of = null;
+                  if (cmd.getArguments()[0] != null)
+                  {
+                     of = new File((String)cmd.getArguments()[0]);
+                  }
+                  File nf = null;
+                  if (cmd.getArguments()[1] != null)
+                  {
+                     nf = new File((String)cmd.getArguments()[1]);
+                  }
 
-              File f = new File(saveLocation);
-              du.dump(os, ns, f);
+                  Snapshot os = null;
+                  Snapshot ns = null;
+
+                  if (of != null &&
+                        of.exists())
+                  {
+                     if (of.isFile())
+                     {
+                        os = SnapshotHelper.load(of);
+                     }
+                     else if (of.isDirectory())
+                     {
+                        os = SnapshotHelper.generate(of);
+                     }
+                  }
+
+                  if (nf != null &&
+                        nf.exists())
+                  {
+                     if (nf.isFile())
+                     {
+                        ns = SnapshotHelper.load(nf);
+                     }
+                     else if (nf.isDirectory())
+                     {
+                        ns = SnapshotHelper.generate(nf);
+                     }
+                  }
+
+                  if (os != null &&
+                        ns != null)
+                  {
+                     DifferenceUtil du = new DifferenceUtil(threshold);
+
+                     File f = new File(saveLocation);
+                     du.dump(os, ns, f);
+                  }
+               }
+
+               remotingClient.disconnect();
             }
-          }
-          
-          remotingClient.disconnect();
-        }
-      } catch (Throwable t) {
-        log.error(t.getMessage(), t);
+         }
+         catch (Throwable t)
+         {
+            log.error(t.getMessage(), t);
+         }
       }
-    } else {
-      usage();
-    }
-  }
+      else
+      {
+         usage();
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ArchiveUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ArchiveUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ArchiveUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,128 +34,146 @@
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
 
-import org.jboss.logging.Logger;
-
 /**
  * An archive utility for JAR type files
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
  */
-public class ArchiveUtil {
+public class ArchiveUtil
+{
 
-  /**
-   * Constructor
-   */
-  private ArchiveUtil() {
-  }
+   /**
+    * Constructor
+    */
+   private ArchiveUtil()
+   {
+   }
 
-  /**
-   * Compress a directory to a file
-   * @param directory The directory
-   * @param file The file
-   * @exception IOException Thrown if an error occurs
-   */
-  public static void compress(File directory, File file) throws IOException {
-    FileOutputStream fos = new FileOutputStream(file);
-    BufferedOutputStream bos = new BufferedOutputStream(fos);
-    JarOutputStream jos = new JarOutputStream(bos);
-    jos.setLevel(9);
+   /**
+    * Compress a directory to a file
+    * @param directory The directory
+    * @param file The file
+    * @exception IOException Thrown if an error occurs
+    */
+   public static void compress(File directory, File file) throws IOException
+   {
+      FileOutputStream fos = new FileOutputStream(file);
+      BufferedOutputStream bos = new BufferedOutputStream(fos);
+      JarOutputStream jos = new JarOutputStream(bos);
+      jos.setLevel(9);
 
-    jarDirectory(directory.getPath(), directory.getPath(), jos);
+      jarDirectory(directory.getPath(), directory.getPath(), jos);
 
-    jos.flush();
-    jos.close();
-  }
+      jos.flush();
+      jos.close();
+   }
 
-  private static void jarDirectory(String root, String directory, JarOutputStream jos) throws IOException { 
-    File jarDirectory = new File(directory);
-    String[] dirList = jarDirectory.list(); 
-    byte[] readBuffer = new byte[2156]; 
-    int bytesIn = 0; 
-    
-    for (int i = 0; i < dirList.length; i++) { 
-      File f = new File(jarDirectory, dirList[i]); 
-      if (f.isDirectory()) { 
-        String filePath = f.getPath(); 
-        jarDirectory(root, filePath, jos); 
-        continue; 
-      } 
-      
-      FileInputStream fis = new FileInputStream(f); 
+   private static void jarDirectory(String root, String directory, JarOutputStream jos) throws IOException
+   {
+      File jarDirectory = new File(directory);
+      String[] dirList = jarDirectory.list();
+      byte[] readBuffer = new byte[2156];
+      int bytesIn = 0;
 
-      String name = f.getPath();
-      if (name.startsWith(root)) {
-        int offset = root.length() + File.separator.length(); 
-        name = name.substring(offset);
+      for (int i = 0; i < dirList.length; i++)
+      {
+         File f = new File(jarDirectory, dirList[i]);
+         if (f.isDirectory())
+         {
+            String filePath = f.getPath();
+            jarDirectory(root, filePath, jos);
+            continue;
+         }
+
+         FileInputStream fis = new FileInputStream(f);
+
+         String name = f.getPath();
+         if (name.startsWith(root))
+         {
+            int offset = root.length() +
+                  File.separator.length();
+            name = name.substring(offset);
+         }
+
+         JarEntry anEntry = new JarEntry(name);
+         jos.putNextEntry(anEntry);
+
+         while ((bytesIn = fis.read(readBuffer)) != -1)
+         {
+            jos.write(readBuffer, 0, bytesIn);
+         }
+         fis.close();
       }
+   }
 
-      JarEntry anEntry = new JarEntry(name); 
-      jos.putNextEntry(anEntry); 
-      
-      while ((bytesIn = fis.read(readBuffer)) != -1) { 
-        jos.write(readBuffer, 0, bytesIn); 
-      } 
-      fis.close(); 
-    } 
-  } 
+   /**
+    * Extract a JAR type file
+    * @param file The file
+    * @param directory The directory where the file should be extracted
+    * @return The root of the extracted JAR file
+    * @exception IOException Thrown if an error occurs
+    */
+   public static File extract(File file, File directory) throws IOException
+   {
+      if (file == null)
+      {
+         throw new IllegalArgumentException("File is null");
+      }
 
-  /**
-   * Extract a JAR type file
-   * @param file The file
-   * @param directory The directory where the file should be extracted
-   * @return The root of the extracted JAR file
-   * @exception IOException Thrown if an error occurs
-   */
-  public static File extract(File file, File directory) throws IOException {
-    if (file == null) {
-      throw new IllegalArgumentException("File is null");
-    }
+      if (directory == null)
+      {
+         throw new IllegalArgumentException("Directory is null");
+      }
 
-    if (directory == null) {
-      throw new IllegalArgumentException("Directory is null");
-    }
+      File target = new File(directory, file.getName());
 
-    File target = new File(directory, file.getName());
+      if (target.exists())
+      {
+         FileUtil.recursiveDelete(target);
+      }
 
-    if (target.exists()) {
-      FileUtil.recursiveDelete(target);
-    }
+      target.mkdirs();
 
-    target.mkdirs();
+      JarFile jar = new JarFile(file);
+      Enumeration<JarEntry> entries = jar.entries();
 
-    JarFile jar = new JarFile(file);
-    Enumeration<JarEntry> entries = jar.entries();
+      while (entries.hasMoreElements())
+      {
+         JarEntry je = entries.nextElement();
+         File copy = new File(target, je.getName());
 
-    while (entries.hasMoreElements()) {
-      JarEntry je = entries.nextElement();
-      File copy = new File(target, je.getName());
+         int idx = copy.getAbsolutePath().lastIndexOf("/");
+         if (idx != -1)
+         {
+            File f = new File(copy.getAbsolutePath().substring(0, idx));
+            f.mkdirs();
+         }
 
-      int idx = copy.getAbsolutePath().lastIndexOf("/");
-      if (idx != -1) {
-        File f = new File(copy.getAbsolutePath().substring(0, idx));
-        f.mkdirs();
-      }
+         if (!je.isDirectory())
+         {
+            InputStream in = new BufferedInputStream(jar.getInputStream(je));
+            OutputStream out = new BufferedOutputStream(new FileOutputStream(copy));
 
-      if (!je.isDirectory()) {
-        InputStream in = new BufferedInputStream(jar.getInputStream(je));
-        OutputStream out = new BufferedOutputStream(new FileOutputStream(copy));
+            byte[] buffer = new byte[4096];
+            for (;;)
+            {
+               int nBytes = in.read(buffer);
+               if (nBytes <= 0)
+               {
+                  break;
+               }
 
-        byte[] buffer = new byte[4096];
-        for (;;) {
-          int nBytes = in.read(buffer);
-          if (nBytes <= 0) {
-            break;
-          }
-
-          out.write(buffer, 0, nBytes);
-        }
-        out.flush();
-        out.close();
-        in.close();
-      } else {
-        copy.mkdirs();
+               out.write(buffer, 0, nBytes);
+            }
+            out.flush();
+            out.close();
+            in.close();
+         }
+         else
+         {
+            copy.mkdirs();
+         }
       }
-    }
 
-    return target;
-  }
+      return target;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassInstrumenter.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassInstrumenter.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassInstrumenter.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -23,11 +23,9 @@
 
 import org.jboss.profiler.shared.Visibility;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
 import javassist.CannotCompileException;
-import javassist.ClassPool;
 import javassist.CtBehavior;
 import javassist.CtClass;
 import javassist.CtConstructor;
@@ -40,173 +38,208 @@
  * Instrument a class with profiler instructions
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassInstrumenter {
+public class ClassInstrumenter
+{
 
-  /** Prefix */
-  private static final String PREFIX = "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread())";
+   /** Prefix */
+   private static final String PREFIX = "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread())";
 
-  /** */
-  private static final String CODE = "{" + PREFIX + ".beginWait(); $_ = $proceed($$); " + PREFIX + ".endWait();}";
+   /** */
+   private static final String CODE = "{" +
+         PREFIX + ".beginWait(); $_ = $proceed($$); " + PREFIX + ".endWait();}";
 
-  /**
-   * Constructor
-   */
-  private ClassInstrumenter() {
-  }
+   /**
+    * Constructor
+    */
+   private ClassInstrumenter()
+   {
+   }
 
-  /**
-   * Get the bytecode for the instrumented class
-   * @param cc The CtClass that is being instrumented
-   * @param v The visibility for the class
-   * @return The instrumented bytes
-   * @exception IOException If an error occurs
-   */
-  public static byte[] instrument(CtClass cc, Visibility v) throws IOException {
-    try {
-      String className = cc.getName().replace('.', '/');
+   /**
+    * Get the bytecode for the instrumented class
+    * @param cc The CtClass that is being instrumented
+    * @param v The visibility for the class
+    * @return The instrumented bytes
+    * @exception IOException If an error occurs
+    */
+   public static byte[] instrument(CtClass cc, Visibility v) throws IOException
+   {
+      try
+      {
+         String className = cc.getName().replace('.', '/');
 
-      if (Modifier.isInterface(cc.getModifiers())) {
-        return cc.toBytecode();
-      }
+         if (Modifier.isInterface(cc.getModifiers()))
+         {
+            return cc.toBytecode();
+         }
 
-      CtConstructor[] constructors =  cc.getDeclaredConstructors();
-      for (int i = 0; i < constructors.length; i++) {
-        CtConstructor constructor = constructors[i];
-        if (!Modifier.isAbstract(constructor.getModifiers())) {
-          instrumentConstructor(constructor, className, v);
-        }
-      }
+         CtConstructor[] constructors = cc.getDeclaredConstructors();
+         for (int i = 0; i < constructors.length; i++)
+         {
+            CtConstructor constructor = constructors[i];
+            if (!Modifier.isAbstract(constructor.getModifiers()))
+            {
+               instrumentConstructor(constructor, className, v);
+            }
+         }
 
-      CtMethod[] methods =  cc.getDeclaredMethods();
-      for (int i = 0; i < methods.length; i++) {
-        CtMethod method = methods[i];
-        if (!Modifier.isAbstract(method.getModifiers())) {
-          instrumentMethod(method, className, v);
-        }
+         CtMethod[] methods = cc.getDeclaredMethods();
+         for (int i = 0; i < methods.length; i++)
+         {
+            CtMethod method = methods[i];
+            if (!Modifier.isAbstract(method.getModifiers()))
+            {
+               instrumentMethod(method, className, v);
+            }
+         }
+
+         return cc.toBytecode();
+
       }
+      catch (Exception e)
+      {
+         IOException ioe = new IOException(e.getMessage());
+         ioe.initCause(e);
+         throw ioe;
+      }
+   }
 
-      return cc.toBytecode();
+   /**
+    * Instrument constructor
+    * @param constructor The constructor
+    * @param className The class name
+    * @param v The visibility
+    * @exception CannotCompileException If the constructor cant be modified
+    */
+   private static void instrumentConstructor(CtConstructor constructor, String className, Visibility v)
+      throws CannotCompileException
+   {
 
-    } catch (Exception e) {
-      IOException ioe = new IOException(e.getMessage());
-      ioe.initCause(e);
-      throw ioe;
-    }
-  }
+      if (!constructor.isClassInitializer())
+      {
+         boolean include = true;
 
-  /**
-   * Instrument constructor
-   * @param constructor The constructor
-   * @param className The class name
-   * @param v The visibility
-   * @exception CannotCompileException If the constructor cant be modified
-   */
-  private static void instrumentConstructor(CtConstructor constructor, 
-                                            String className, 
-                                            Visibility v) 
-    throws CannotCompileException {
+         if (Modifier.isPrivate(constructor.getModifiers()))
+         {
+            if (v == Visibility.PROTECTED ||
+                  v == Visibility.PACKAGE || v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         else if (Modifier.isProtected(constructor.getModifiers()))
+         {
+            if (v == Visibility.PACKAGE ||
+                  v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         else if (Modifier.isPackage(constructor.getModifiers()))
+         {
+            if (v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+         }
+         // Modifier.PUBLIC -- no need to check for method visibility
 
-    if (!constructor.isClassInitializer()) {
-      boolean include = true;
-      
-      if (Modifier.isPrivate(constructor.getModifiers())) {
-        if (v == Visibility.PROTECTED ||
-            v == Visibility.PACKAGE ||
-            v == Visibility.PUBLIC) {
-          include = false;
-        }
-      } else if (Modifier.isProtected(constructor.getModifiers())) {
-        if (v == Visibility.PACKAGE ||
-            v == Visibility.PUBLIC) {
-          include = false;
-        }
-      } else if (Modifier.isPackage(constructor.getModifiers())) {
-        if (v == Visibility.PUBLIC) {
-          include = false;
-        }
-      }
-      // Modifier.PUBLIC -- no need to check for method visibility
-      
-      if (include) {
-        constructor.insertBeforeBody("{ " +
-                                     PREFIX + ".allocation(\"" + className + "\");" +
-                                     PREFIX + ".start(\"" + className + "\", \"" + constructor.getLongName() + "\");" +
-                                     " }");
+         if (include)
+         {
+            constructor.insertBeforeBody("{ " +
+                  PREFIX + ".allocation(\"" + className + "\");" + PREFIX + ".start(\"" + className + "\", \"" +
+                  constructor.getLongName() + "\");" + " }");
 
-        constructor.insertAfter("{ " +
-                                PREFIX + ".end(\"" + className + "\", \"" + constructor.getLongName() + "\");" +
-                                " }", true);
-        
-        setup(constructor);
+            constructor.insertAfter("{ " +
+                  PREFIX + ".end(\"" + className + "\", \"" + constructor.getLongName() + "\");" + " }", true);
+
+            setup(constructor);
+         }
       }
-    }
-  }
+   }
 
-  /**
-   * Instrument method
-   * @param method The method
-   * @param className The class name
-   * @param v The visibility
-   * @exception CannotCompileException If the constructor cant be modified
-   */
-  private static void instrumentMethod(CtMethod method, String className, Visibility v) throws CannotCompileException {
-    boolean include = true;
-      
-    if (Modifier.isPrivate(method.getModifiers())) {
-      if (v == Visibility.PROTECTED ||
-          v == Visibility.PACKAGE ||
-          v == Visibility.PUBLIC) {
-        include = false;
+   /**
+    * Instrument method
+    * @param method The method
+    * @param className The class name
+    * @param v The visibility
+    * @exception CannotCompileException If the constructor cant be modified
+    */
+   private static void instrumentMethod(CtMethod method, String className, Visibility v) throws CannotCompileException
+   {
+      boolean include = true;
+
+      if (Modifier.isPrivate(method.getModifiers()))
+      {
+         if (v == Visibility.PROTECTED ||
+               v == Visibility.PACKAGE || v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    } else if (Modifier.isProtected(method.getModifiers())) {
-      if (v == Visibility.PACKAGE ||
-          v == Visibility.PUBLIC) {
-        include = false;
+      else if (Modifier.isProtected(method.getModifiers()))
+      {
+         if (v == Visibility.PACKAGE ||
+               v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    } else if (Modifier.isPackage(method.getModifiers())) {
-      if (v == Visibility.PUBLIC) {
-        include = false;
+      else if (Modifier.isPackage(method.getModifiers()))
+      {
+         if (v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
       }
-    }
-    // Modifier.PUBLIC -- no need to check for method visibility
-    
-    if (include) {
-      method.insertBefore("{ " +
-                          PREFIX + ".start(\"" + className + "\", \"" + method.getLongName() + "\");" +
-                          " }");
-      
-      method.insertAfter("{ " +
-                         PREFIX + ".end(\"" + className + "\", \"" + method.getLongName() + "\");" +
-                         " }", true);
+      // Modifier.PUBLIC -- no need to check for method visibility
 
-      setup(method);
-    }
-  }
+      if (include)
+      {
+         method.insertBefore("{ " +
+               PREFIX + ".start(\"" + className + "\", \"" + method.getLongName() + "\");" + " }");
 
-  /**
-   * Setup the beginWait/endWait methods
-   * @param ctb The behavior
-   */
-  private static void setup(CtBehavior ctb) {
-    try {
-      ctb.instrument(new ExprEditor() {
-          public void edit(MethodCall m) throws CannotCompileException {
-            if ("java.lang.Object".equals(m.getClassName())) {
-              if ("wait".equals(m.getMethodName())) {
-                m.replace(CODE);
-              }
-            } else if ("java.lang.Thread".equals(m.getClassName())) {
-              if ("join".equals(m.getMethodName()) ||
-                  "sleep".equals(m.getMethodName()) ||
-                  "yield".equals(m.getMethodName())) {
-                m.replace(CODE);
-              }
+         method.insertAfter("{ " +
+               PREFIX + ".end(\"" + className + "\", \"" + method.getLongName() + "\");" + " }", true);
+
+         setup(method);
+      }
+   }
+
+   /**
+    * Setup the beginWait/endWait methods
+    * @param ctb The behavior
+    */
+   private static void setup(CtBehavior ctb)
+   {
+      try
+      {
+         ctb.instrument(new ExprEditor()
+         {
+            public void edit(MethodCall m) throws CannotCompileException
+            {
+               if ("java.lang.Object".equals(m.getClassName()))
+               {
+                  if ("wait".equals(m.getMethodName()))
+                  {
+                     m.replace(CODE);
+                  }
+               }
+               else if ("java.lang.Thread".equals(m.getClassName()))
+               {
+                  if ("join".equals(m.getMethodName()) ||
+                        "sleep".equals(m.getMethodName()) || "yield".equals(m.getMethodName()))
+                  {
+                     m.replace(CODE);
+                  }
+               }
             }
-          }
-        });
+         });
 
-    } catch (Exception e) {
-      e.printStackTrace(System.err);
-    }
-  }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace(System.err);
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassScanner.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassScanner.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ClassScanner.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,35 +22,38 @@
 package org.jboss.profiler.client.precompiler;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
 /**
  * Class scanner
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassScanner {
+public class ClassScanner
+{
 
-  /**
-   * Constructor
-   */
-  private ClassScanner() {
-  }
+   /**
+    * Constructor
+    */
+   private ClassScanner()
+   {
+   }
 
-  /**
-   * Scan a directory for JAR files
-   * @param root The root directory
-    * @return The list of JAR files
-    */
-  public static List<File> scan(File root) {
-    try {
-      return ExtensionScanner.scan(root, ".class");
-    } catch (Exception e) {
-      System.err.println(e.getMessage());
-    }
-    
-    return null;
-  }
+   /**
+    * Scan a directory for JAR files
+    * @param root The root directory
+     * @return The list of JAR files
+     */
+   public static List<File> scan(File root)
+   {
+      try
+      {
+         return ExtensionScanner.scan(root, ".class");
+      }
+      catch (Exception e)
+      {
+         System.err.println(e.getMessage());
+      }
+
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ExtensionScanner.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ExtensionScanner.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/ExtensionScanner.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,71 +31,83 @@
  * Extension scanner
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ExtensionScanner {
+public class ExtensionScanner
+{
 
-  /**
-   * Constructor
-   */
-  private ExtensionScanner() {
-  }
+   /**
+    * Constructor
+    */
+   private ExtensionScanner()
+   {
+   }
 
-  /**
-   * Scan a directory for files
-   * @param root The root directory
-   * @param extension The file extension
-   * @return The list of files
-   */
-  public static List<File> scan(File root, String extension) {
-    try {
-      return getFileListing(root, extension);
-    } catch (Exception e) {
-      System.err.println(e.getMessage());
-    }
-    
-    return null;
-  }
-  
-  
-  /**
-   * Recursively walk a directory tree and return a List of all
-   * Files found; the List is sorted using File.compareTo().
-   * @param aStartingDir is a valid directory, which can be read.
-   * @param extension The file extension
-   * @return The list of files
-   * @exception Exception Thrown if an error occurs
-   */
-  private static List<File> getFileListing(File aStartingDir, String extension) throws Exception {
-    List<File> result = getFileListingNoSort(aStartingDir, extension);
-    Collections.sort(result);
-    return result;
-  }
-  
-  /**
-   * Recursively walk a directory tree and return a List of all
-   * Files found; the List is sorted using File.compareTo().
-   * @param aStartingDir is a valid directory, which can be read.
-   * @param extension The file extension
-   * @return The list of files
-   * @exception Exception Thrown if an error occurs
-   */
-  private static List<File> getFileListingNoSort(File aStartingDir, String extension) throws Exception {
-    List<File> result = new ArrayList<File>();
-    
-    File[] filesAndDirs = aStartingDir.listFiles();
-    
-    List<File> filesDirs = Arrays.asList(filesAndDirs);
-    
-    for (File file : filesDirs) {
-      if (file.isFile()) {
-        if (file.getName().endsWith(extension)) {
-          result.add(file);
-        }
-      } else if (file.isDirectory()) {
-        List<File> deeperList = getFileListingNoSort(file, extension);
-        result.addAll(deeperList);
+   /**
+    * Scan a directory for files
+    * @param root The root directory
+    * @param extension The file extension
+    * @return The list of files
+    */
+   public static List<File> scan(File root, String extension)
+   {
+      try
+      {
+         return getFileListing(root, extension);
       }
-    }
+      catch (Exception e)
+      {
+         System.err.println(e.getMessage());
+      }
 
-    return result;
-  }
+      return null;
+   }
+
+   /**
+    * Recursively walk a directory tree and return a List of all
+    * Files found; the List is sorted using File.compareTo().
+    * @param aStartingDir is a valid directory, which can be read.
+    * @param extension The file extension
+    * @return The list of files
+    * @exception Exception Thrown if an error occurs
+    */
+   private static List<File> getFileListing(File aStartingDir, String extension) throws Exception
+   {
+      List<File> result = getFileListingNoSort(aStartingDir, extension);
+      Collections.sort(result);
+      return result;
+   }
+
+   /**
+    * Recursively walk a directory tree and return a List of all
+    * Files found; the List is sorted using File.compareTo().
+    * @param aStartingDir is a valid directory, which can be read.
+    * @param extension The file extension
+    * @return The list of files
+    * @exception Exception Thrown if an error occurs
+    */
+   private static List<File> getFileListingNoSort(File aStartingDir, String extension) throws Exception
+   {
+      List<File> result = new ArrayList<File>();
+
+      File[] filesAndDirs = aStartingDir.listFiles();
+
+      List<File> filesDirs = Arrays.asList(filesAndDirs);
+
+      for (File file : filesDirs)
+      {
+         if (file.isFile())
+         {
+            if (file.getName().endsWith(extension))
+            {
+               result.add(file);
+            }
+         }
+         else if (file.isDirectory())
+         {
+            List<File> deeperList = getFileListingNoSort(file, extension);
+            result.addAll(deeperList);
+         }
+      }
+
+      return result;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/FileUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/FileUtil.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/FileUtil.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,61 +31,79 @@
  * An utility for files and directories
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
  */
-public class FileUtil {
+public class FileUtil
+{
 
-  /**
-   * Constructor
-   */
-  private FileUtil() {
-  }
+   /**
+    * Constructor
+    */
+   private FileUtil()
+   {
+   }
 
-  /**
-   * Recursive delete
-   * @param f The file handler
-   */
-  public static void recursiveDelete(File f) {
-    if (f.exists()) {
-      File[] files = f.listFiles();
-      if (files != null) {
-        for (int i = 0; i < files.length; i++) {
-          if (files[i].isDirectory()) {
-            recursiveDelete(files[i]);
-          } else {
-            files[i].delete();
-          }
-        }
+   /**
+    * Recursive delete
+    * @param f The file handler
+    */
+   public static void recursiveDelete(File f)
+   {
+      if (f.exists())
+      {
+         File[] files = f.listFiles();
+         if (files != null)
+         {
+            for (int i = 0; i < files.length; i++)
+            {
+               if (files[i].isDirectory())
+               {
+                  recursiveDelete(files[i]);
+               }
+               else
+               {
+                  files[i].delete();
+               }
+            }
+         }
+         f.delete();
       }
-      f.delete();
-    }
-  }
+   }
 
-  /**
-   * Copy file
-   * @param from The from file
-   * @param to The to file
-   * @exception Exception Thrown if an error occurs
-   */
-  public static void copyFile(File from, File to) throws Exception {
-    FileInputStream fis  = new FileInputStream(from);
-    BufferedInputStream bis = new BufferedInputStream(fis);
-    FileOutputStream fos = new FileOutputStream(to);
-    BufferedOutputStream bos = new BufferedOutputStream(fos);
-    try {
-      byte[] buf = new byte[4096];
-      int i = 0;
-      while ((i = bis.read(buf)) != -1) {
-        bos.write(buf, 0, i);
+   /**
+    * Copy file
+    * @param from The from file
+    * @param to The to file
+    * @exception Exception Thrown if an error occurs
+    */
+   public static void copyFile(File from, File to) throws Exception
+   {
+      FileInputStream fis = new FileInputStream(from);
+      BufferedInputStream bis = new BufferedInputStream(fis);
+      FileOutputStream fos = new FileOutputStream(to);
+      BufferedOutputStream bos = new BufferedOutputStream(fos);
+      try
+      {
+         byte[] buf = new byte[4096];
+         int i = 0;
+         while ((i = bis.read(buf)) != -1)
+         {
+            bos.write(buf, 0, i);
+         }
+         bos.flush();
       }
-      bos.flush();
-    } catch (Exception e) {
-      throw e;
-    } finally {
-      if (fis != null) {
-        fis.close();
+      catch (Exception e)
+      {
+         throw e;
       }
-      if (fos != null) {
-        fos.close();
+      finally
+      {
+         if (fis != null)
+         {
+            fis.close();
+         }
+         if (fos != null)
+         {
+            fos.close();
+         }
       }
-    }
-  }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/JarScanner.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/JarScanner.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/JarScanner.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,35 +22,38 @@
 package org.jboss.profiler.client.precompiler;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
 /**
  * Jar scanner
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class JarScanner {
+public class JarScanner
+{
 
-  /**
-   * Constructor
-   */
-  private JarScanner() {
-  }
+   /**
+    * Constructor
+    */
+   private JarScanner()
+   {
+   }
 
-  /**
-   * Scan a directory for JAR files
-   * @param root The root directory
-    * @return The list of JAR files
-    */
-  public static List<File> scan(File root) {
-    try {
-      return ExtensionScanner.scan(root, ".jar");
-    } catch (Exception e) {
-      System.err.println(e.getMessage());
-    }
-    
-    return null;
-  }
+   /**
+    * Scan a directory for JAR files
+    * @param root The root directory
+     * @return The list of JAR files
+     */
+   public static List<File> scan(File root)
+   {
+      try
+      {
+         return ExtensionScanner.scan(root, ".jar");
+      }
+      catch (Exception e)
+      {
+         System.err.println(e.getMessage());
+      }
+
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/Precompiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/Precompiler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/Precompiler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -49,456 +49,576 @@
  * The precompiler tool
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Precompiler {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Precompiler.class);
+public class Precompiler
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Precompiler.class);
 
-  /** Include all */
-  private static  boolean includeAll = false;
+   /** Include all */
+   private static boolean includeAll = false;
 
-  /** The include list */
-  private static  List<String> includeList = new ArrayList<String>();
+   /** The include list */
+   private static List<String> includeList = new ArrayList<String>();
 
-  /** Exclude all */
-  private static  boolean excludeAll = true;
+   /** Exclude all */
+   private static boolean excludeAll = true;
 
-  /** The exclude list */
-  private static  List<String> excludeList = new ArrayList<String>();
+   /** The exclude list */
+   private static List<String> excludeList = new ArrayList<String>();
 
-  /** Visibility tree */
-  private static  TreeMap visibilityTree;
+   /** Visibility tree */
+   private static TreeMap visibilityTree;
 
-  /** Visibility */
-  private static  Visibility visibility;
+   /** Visibility */
+   private static Visibility visibility;
 
-  /** Class pool */
-  private static ClassPool cp;
+   /** Class pool */
+   private static ClassPool cp;
 
-  /** Instrumented count */
-  private static int instrumented;
+   /** Instrumented count */
+   private static int instrumented;
 
-  /**
-   * Constructor
-   */
-  private Precompiler() {
-  }
+   /**
+    * Constructor
+    */
+   private Precompiler()
+   {
+   }
 
-  /**
-   * Instrument
-   * @param include The include list
-   * @param exclude The exclude list
-   * @param vs The visibility setting
-   * @param f The file handler
-   * @exception Exception Thrown if an error occurs
-   */
-  private static void instrument(String include, String exclude, String vs, File f) throws Exception {
-    instrumented = 0;
-    initVisibility(vs);
-    initIncludeExclude(include, exclude);
-    initClassPool(f);
+   /**
+    * Instrument
+    * @param include The include list
+    * @param exclude The exclude list
+    * @param vs The visibility setting
+    * @param f The file handler
+    * @exception Exception Thrown if an error occurs
+    */
+   private static void instrument(String include, String exclude, String vs, File f) throws Exception
+   {
+      instrumented = 0;
+      initVisibility(vs);
+      initIncludeExclude(include, exclude);
+      initClassPool(f);
 
-    String tmpDirectoryLocation = System.getProperty("java.io.tmpdir");
-    File tmpDirectory = new File(tmpDirectoryLocation, "jboss-profiler-tmp");
+      String tmpDirectoryLocation = System.getProperty("java.io.tmpdir");
+      File tmpDirectory = new File(tmpDirectoryLocation, "jboss-profiler-tmp");
 
-    if (tmpDirectory.exists()) {
-      FileUtil.recursiveDelete(tmpDirectory);
-    }
+      if (tmpDirectory.exists())
+      {
+         FileUtil.recursiveDelete(tmpDirectory);
+      }
 
-    tmpDirectory.mkdirs();
-    tmpDirectory.deleteOnExit();
+      tmpDirectory.mkdirs();
+      tmpDirectory.deleteOnExit();
 
-    int archives = 0;
+      int archives = 0;
 
-    if (f.isDirectory()) {
-      List<File> jarFiles = JarScanner.scan(f);
-      archives = jarFiles.size();
+      if (f.isDirectory())
+      {
+         List<File> jarFiles = JarScanner.scan(f);
+         archives = jarFiles.size();
 
-      if (jarFiles != null && jarFiles.size() > 0) {
-        for (File jarFile : jarFiles) {
-          log.info("Processing: " + jarFile.getAbsolutePath());
+         if (jarFiles != null &&
+               jarFiles.size() > 0)
+         {
+            for (File jarFile : jarFiles)
+            {
+               log.info("Processing: " +
+                     jarFile.getAbsolutePath());
 
-          File extractedArchive = ArchiveUtil.extract(jarFile, tmpDirectory);
-          
-          boolean modified = false;
-          
-          List<File> classFiles = ClassScanner.scan(extractedArchive);
-          if (classFiles != null && classFiles.size() > 0) {
-            for (File classFile : classFiles) {
-              modified |= instrumentClass(classFile);
+               File extractedArchive = ArchiveUtil.extract(jarFile, tmpDirectory);
+
+               boolean modified = false;
+
+               List<File> classFiles = ClassScanner.scan(extractedArchive);
+               if (classFiles != null &&
+                     classFiles.size() > 0)
+               {
+                  for (File classFile : classFiles)
+                  {
+                     modified |= instrumentClass(classFile);
+                  }
+               }
+
+               if (modified)
+               {
+                  File newJarFile = new File(tmpDirectory, jarFile.getName() +
+                        "~");
+                  ArchiveUtil.compress(extractedArchive, newJarFile);
+
+                  FileUtil.recursiveDelete(extractedArchive);
+
+                  if (!newJarFile.renameTo(jarFile))
+                  {
+                     try
+                     {
+                        FileUtil.copyFile(newJarFile, jarFile);
+                        FileUtil.recursiveDelete(newJarFile);
+                     }
+                     catch (Exception e)
+                     {
+                        log.error("Couldn't move " +
+                              newJarFile.getAbsolutePath() + " to " + jarFile.getAbsolutePath(), e);
+                     }
+                  }
+               }
+               else
+               {
+                  FileUtil.recursiveDelete(extractedArchive);
+               }
             }
-          }
-          
-          if (modified) {
-            File newJarFile = new File(tmpDirectory, jarFile.getName() + "~");
+         }
+      }
+      else
+      {
+         log.info("Processing: " +
+               f.getAbsolutePath());
+
+         File extractedArchive = ArchiveUtil.extract(f, tmpDirectory);
+
+         boolean modified = false;
+
+         List<File> classFiles = ClassScanner.scan(extractedArchive);
+         if (classFiles != null &&
+               classFiles.size() > 0)
+         {
+            for (File classFile : classFiles)
+            {
+               modified |= instrumentClass(classFile);
+            }
+         }
+
+         if (modified)
+         {
+            File newJarFile = new File(tmpDirectory, f.getName() +
+                  "~");
             ArchiveUtil.compress(extractedArchive, newJarFile);
-            
+
             FileUtil.recursiveDelete(extractedArchive);
-            
-            if (!newJarFile.renameTo(jarFile)) {
-              try {
-                FileUtil.copyFile(newJarFile, jarFile);
-                FileUtil.recursiveDelete(newJarFile);
-              } catch (Exception e) {
-                log.error("Couldn't move " + newJarFile.getAbsolutePath() + " to " + jarFile.getAbsolutePath(), e);
-              }
+
+            if (!newJarFile.renameTo(f))
+            {
+               try
+               {
+                  FileUtil.copyFile(newJarFile, f);
+                  FileUtil.recursiveDelete(newJarFile);
+               }
+               catch (Exception e)
+               {
+                  log.error("Couldn't move " +
+                        newJarFile.getAbsolutePath() + " to " + f.getAbsolutePath(), e);
+               }
             }
-          } else {
+         }
+         else
+         {
             FileUtil.recursiveDelete(extractedArchive);
-          }
-        }
+         }
       }
-    } else {
-      log.info("Processing: " + f.getAbsolutePath());
 
-      File extractedArchive = ArchiveUtil.extract(f, tmpDirectory);
-          
-      boolean modified = false;
-      
-      List<File> classFiles = ClassScanner.scan(extractedArchive);
-      if (classFiles != null && classFiles.size() > 0) {
-        for (File classFile : classFiles) {
-          modified |= instrumentClass(classFile);
-        }
-      }
-      
-      if (modified) {
-        File newJarFile = new File(tmpDirectory, f.getName() + "~");
-        ArchiveUtil.compress(extractedArchive, newJarFile);
-        
-        FileUtil.recursiveDelete(extractedArchive);
-        
-        if (!newJarFile.renameTo(f)) {
-          try {
-            FileUtil.copyFile(newJarFile, f);
-            FileUtil.recursiveDelete(newJarFile);
-          } catch (Exception e) {
-            log.error("Couldn't move " + newJarFile.getAbsolutePath() + " to " + f.getAbsolutePath(), e);
-          }
-        }
-      } else {
-        FileUtil.recursiveDelete(extractedArchive);
-      }
-    }
+      log.info("Instrumented " +
+            instrumented + " classes in " + archives + " archives.");
+   }
 
-    log.info("Instrumented " + instrumented + " classes in " + archives + " archives.");
-  }
+   /**
+    * Instrument class
+    * @param file The class file
+    * @return True if the class was modified; otherwise false
+    * @exception Exception Thrown if an error occurs
+    */
+   private static boolean instrumentClass(File file) throws Exception
+   {
+      FileInputStream fis = new FileInputStream(file);
+      BufferedInputStream bis = new BufferedInputStream(fis);
 
-  /**
-   * Instrument class
-   * @param file The class file
-   * @return True if the class was modified; otherwise false
-   * @exception Exception Thrown if an error occurs
-   */
-  private static boolean instrumentClass(File file) throws Exception {
-    FileInputStream fis = new FileInputStream(file);
-    BufferedInputStream bis = new BufferedInputStream(fis);
+      CtClass ctClass = cp.makeClass(bis, false);
 
-    CtClass ctClass = cp.makeClass(bis, false);
+      bis.close();
 
-    bis.close();
+      String ctClassSlashName = ctClass.getName().replace('.', '/');
+      if (accept(ctClassSlashName))
+      {
+         Visibility v = getVisibility(ctClassSlashName);
+         try
+         {
+            byte[] b = ClassInstrumenter.instrument(ctClass, v);
 
-    String ctClassSlashName = ctClass.getName().replace('.', '/');
-    if (accept(ctClassSlashName)) {
-      Visibility v = getVisibility(ctClassSlashName);
-      try {
-        byte[] b = ClassInstrumenter.instrument(ctClass, v);
+            if (b != null &&
+                  b.length > 0)
+            {
+               FileOutputStream fos = null;
+               try
+               {
+                  fos = new FileOutputStream(file);
+                  BufferedOutputStream bos = new BufferedOutputStream(fos, 16384);
 
-        if (b != null && b.length > 0) {
-          FileOutputStream fos = null;
-          try {
-            fos = new FileOutputStream(file);
-            BufferedOutputStream bos = new BufferedOutputStream(fos, 16384);
-            
-            bos.write(b);
-            
-            bos.flush();
-          } finally {
-            if (fos != null) {
-              try {
-                fos.close();
-              } catch (IOException ioe) {
-                // Ignore
-              }
-            }
-          }
+                  bos.write(b);
 
-          log.debug("Instrumented: " + ctClass.getName());
+                  bos.flush();
+               }
+               finally
+               {
+                  if (fos != null)
+                  {
+                     try
+                     {
+                        fos.close();
+                     }
+                     catch (IOException ioe)
+                     {
+                        // Ignore
+                     }
+                  }
+               }
 
-          instrumented++;
-          return true;
-        }
-      } catch (Throwable t) {
-        log.warn("Can't precompile: " + ctClass.getName());
+               log.debug("Instrumented: " +
+                     ctClass.getName());
+
+               instrumented++;
+               return true;
+            }
+         }
+         catch (Throwable t)
+         {
+            log.warn("Can't precompile: " +
+                  ctClass.getName());
+         }
       }
-    }
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Init class pool
-   * @param f The file handler
-   * @exception Exception Thrown if an error occurs
-   */
-  private static void initClassPool(File f) throws Exception {
-    cp = ClassPool.getDefault();
+   /**
+    * Init class pool
+    * @param f The file handler
+    * @exception Exception Thrown if an error occurs
+    */
+   private static void initClassPool(File f) throws Exception
+   {
+      cp = ClassPool.getDefault();
 
-    if (f.isDirectory()) {
-      Set<String> s = new HashSet<String>();
-    
-      List<File> jarFiles = JarScanner.scan(f);
+      if (f.isDirectory())
+      {
+         Set<String> s = new HashSet<String>();
 
-      if (jarFiles != null && jarFiles.size() > 0) {
-        for (File jarFile : jarFiles) {
-          if (!s.contains(jarFile.getName())) {
-            cp.appendClassPath(jarFile.getAbsolutePath());
-            s.add(jarFile.getName());
-          }
-        }
+         List<File> jarFiles = JarScanner.scan(f);
+
+         if (jarFiles != null &&
+               jarFiles.size() > 0)
+         {
+            for (File jarFile : jarFiles)
+            {
+               if (!s.contains(jarFile.getName()))
+               {
+                  cp.appendClassPath(jarFile.getAbsolutePath());
+                  s.add(jarFile.getName());
+               }
+            }
+         }
       }
-    } else {
-      cp.appendClassPath(f.getAbsolutePath());
-    }
-  }
+      else
+      {
+         cp.appendClassPath(f.getAbsolutePath());
+      }
+   }
 
-  /**
-   * Init visibility
-   */
-  private static void initVisibility(String vs) {
-    visibility = parseVisibility(vs);
-    visibilityTree = new TreeMap(new SizeComparator());
-  }
+   /**
+    * Init visibility
+    */
+   private static void initVisibility(String vs)
+   {
+      visibility = parseVisibility(vs);
+      visibilityTree = new TreeMap(new SizeComparator());
+   }
 
-  /**
-   * Parse visibility property
-   * @param vs The property
-   * @return The visibility
-   */
-  private static Visibility parseVisibility(String vs) {
-    log.debug("Visibility=" + vs);
+   /**
+    * Parse visibility property
+    * @param vs The property
+    * @return The visibility
+    */
+   private static Visibility parseVisibility(String vs)
+   {
+      log.debug("Visibility=" +
+            vs);
 
-    if (vs != null) {
-      if ("public".equalsIgnoreCase(vs)) {
-        return Visibility.PUBLIC;
-      } else if ("package".equalsIgnoreCase(vs)) {
-        return Visibility.PACKAGE;
-      } else if ("protected".equalsIgnoreCase(vs)) {
-        return Visibility.PROTECTED;
+      if (vs != null)
+      {
+         if ("public".equalsIgnoreCase(vs))
+         {
+            return Visibility.PUBLIC;
+         }
+         else if ("package".equalsIgnoreCase(vs))
+         {
+            return Visibility.PACKAGE;
+         }
+         else if ("protected".equalsIgnoreCase(vs))
+         {
+            return Visibility.PROTECTED;
+         }
       }
-    }
-    return Visibility.PRIVATE;
-  }
-  
-  /**
-   * Init include / exclude
-   * @param include The includes
-   * @param exclude The excludes
-   */
-  private static void initIncludeExclude(String include, String exclude) {
-    log.debug("Includes=" + include);
-    log.debug("Excludes=" + exclude);
+      return Visibility.PRIVATE;
+   }
 
-    if (include != null) {
-      StringTokenizer st = new StringTokenizer(include, ",");
-      List<String> l = new ArrayList<String>();
-      while (st.hasMoreTokens()) {
-        String s = st.nextToken();
-        s = s.trim();
-        if ("*".equals(s)) {
-          includeAll = true;
-        } else {
-          l.add(s);
-        }
-      }
-      Collections.sort(l, new SizeComparator());
-      Collections.reverse(l);
+   /**
+    * Init include / exclude
+    * @param include The includes
+    * @param exclude The excludes
+    */
+   private static void initIncludeExclude(String include, String exclude)
+   {
+      log.debug("Includes=" +
+            include);
+      log.debug("Excludes=" +
+            exclude);
 
-      for (String s : l) {
-        String c = s;
-        String v = null;
-        if (s.indexOf("|") != -1) {
-          c = s.substring(0, s.indexOf("|"));
-          c = c.trim();
-          v = s.substring(s.indexOf("|") + 1);
-          v = v.trim();
-        }
-        
-        if (c.endsWith(".*")) {
-          c = c.substring(0, c.indexOf(".*")) + "/";
-        }
-        if (c.endsWith(".class")) {
-          c = c.substring(0, c.indexOf(".class"));
-        }
-        c = c.replace('.', '/');
-        
-        Iterator it = includeList.iterator();
-        while (it.hasNext()) {
-          String t = (String)it.next();
-          
-          if (t.startsWith(c)) {
-            it.remove();
-          }
-        }
-        it = visibilityTree.keySet().iterator();
-        while (it.hasNext()) {
-          String t = (String)it.next();
-          
-          if (t.startsWith(c)) {
-            it.remove();
-          }
-        }
-        
-        includeList.add(c);
-        if (v != null) {
-          visibilityTree.put(c, parseVisibility(v));
-        }
-      }
-    }
+      if (include != null)
+      {
+         StringTokenizer st = new StringTokenizer(include, ",");
+         List<String> l = new ArrayList<String>();
+         while (st.hasMoreTokens())
+         {
+            String s = st.nextToken();
+            s = s.trim();
+            if ("*".equals(s))
+            {
+               includeAll = true;
+            }
+            else
+            {
+               l.add(s);
+            }
+         }
+         Collections.sort(l, new SizeComparator());
+         Collections.reverse(l);
 
-    if (exclude != null) {
-      excludeAll = false;
-      StringTokenizer st = new StringTokenizer(exclude, ",");
-      List<String> l = new ArrayList<String>();
-      while (st.hasMoreTokens()) {
-        String s = st.nextToken();
-        s = s.trim();
-        if ("*".equals(s)) {
-          excludeAll = true;
-        } else {
-          l.add(s);
-        }
-      }
-      Collections.sort(l, new SizeComparator());
+         for (String s : l)
+         {
+            String c = s;
+            String v = null;
+            if (s.indexOf("|") != -1)
+            {
+               c = s.substring(0, s.indexOf("|"));
+               c = c.trim();
+               v = s.substring(s.indexOf("|") + 1);
+               v = v.trim();
+            }
 
-      for (String c : l) {
-        if (c.endsWith(".*")) {
-          c = c.substring(0, c.indexOf(".*")) + "/";
-        }
-        if (c.endsWith(".class")) {
-          c = c.substring(0, c.indexOf(".class"));
-        }
-        c = c.replace('.', '/');
+            if (c.endsWith(".*"))
+            {
+               c = c.substring(0, c.indexOf(".*")) +
+                     "/";
+            }
+            if (c.endsWith(".class"))
+            {
+               c = c.substring(0, c.indexOf(".class"));
+            }
+            c = c.replace('.', '/');
 
-        Iterator it = excludeList.iterator();
-        while (it.hasNext()) {
-          String s = (String)it.next();
-          
-          if (s.startsWith(c)) {
-            it.remove();
-          }
-        }
-        
-        excludeList.add(c);
+            Iterator it = includeList.iterator();
+            while (it.hasNext())
+            {
+               String t = (String)it.next();
+
+               if (t.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
+            it = visibilityTree.keySet().iterator();
+            while (it.hasNext())
+            {
+               String t = (String)it.next();
+
+               if (t.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
+
+            includeList.add(c);
+            if (v != null)
+            {
+               visibilityTree.put(c, parseVisibility(v));
+            }
+         }
       }
-    }
 
-    Collections.sort(includeList, new SizeComparator());
-    Collections.sort(excludeList, new SizeComparator());
-  }
+      if (exclude != null)
+      {
+         excludeAll = false;
+         StringTokenizer st = new StringTokenizer(exclude, ",");
+         List<String> l = new ArrayList<String>();
+         while (st.hasMoreTokens())
+         {
+            String s = st.nextToken();
+            s = s.trim();
+            if ("*".equals(s))
+            {
+               excludeAll = true;
+            }
+            else
+            {
+               l.add(s);
+            }
+         }
+         Collections.sort(l, new SizeComparator());
 
-  /**
-   * Approve the following class for transformation
-   * @param className The class name
-   * @return True if the class is approved; otherwise false
-   */
-  private static boolean approve(String className) {
-    // We can't profile the profiler, Java / Sun classes 
-    // nor Javassist
-    if (className.startsWith("org/jboss/profiler/agent/") ||
-        className.startsWith("org/jboss/profiler/as/") ||
-        className.startsWith("org/jboss/profiler/client/") ||
-        className.startsWith("org/jboss/profiler/connectors/") ||
-        className.startsWith("org/jboss/profiler/plugins/") ||
-        className.startsWith("org/jboss/profiler/shared/") ||
-        className.startsWith("java/") ||
-        className.startsWith("javax/") ||
-        className.startsWith("sun/") ||
-        className.startsWith("com/sun/") ||
-        className.startsWith("javassist/")) {
-      return false;
-    }
+         for (String c : l)
+         {
+            if (c.endsWith(".*"))
+            {
+               c = c.substring(0, c.indexOf(".*")) +
+                     "/";
+            }
+            if (c.endsWith(".class"))
+            {
+               c = c.substring(0, c.indexOf(".class"));
+            }
+            c = c.replace('.', '/');
 
-    return true;
-  }
+            Iterator it = excludeList.iterator();
+            while (it.hasNext())
+            {
+               String s = (String)it.next();
 
-  /**
-   * Accept the following class for transformation
-   * @param className The class name
-   * @return True if the class should be transformed; otherwise false
-   */
-  public static boolean accept(String className) {
-    if (!approve(className)) {
-      return false;
-    }
+               if (s.startsWith(c))
+               {
+                  it.remove();
+               }
+            }
 
-    for (String cl : excludeList) {
-      if (className.startsWith(cl)) {
-        return false;
+            excludeList.add(c);
+         }
       }
-    }
 
-    if (includeAll && !excludeAll) {
+      Collections.sort(includeList, new SizeComparator());
+      Collections.sort(excludeList, new SizeComparator());
+   }
+
+   /**
+    * Approve the following class for transformation
+    * @param className The class name
+    * @return True if the class is approved; otherwise false
+    */
+   private static boolean approve(String className)
+   {
+      // We can't profile the profiler, Java / Sun classes
+      // nor Javassist
+      if (className.startsWith("org/jboss/profiler/agent/") ||
+            className.startsWith("org/jboss/profiler/as/") || className.startsWith("org/jboss/profiler/client/") ||
+            className.startsWith("org/jboss/profiler/connectors/") ||
+            className.startsWith("org/jboss/profiler/plugins/") || className.startsWith("org/jboss/profiler/shared/") ||
+            className.startsWith("java/") || className.startsWith("javax/") || className.startsWith("sun/") ||
+            className.startsWith("com/sun/") || className.startsWith("javassist/"))
+      {
+         return false;
+      }
+
       return true;
-    }
+   }
 
-    for (String cl : includeList) {
-      if (className.startsWith(cl)) {
-        return true;
+   /**
+    * Accept the following class for transformation
+    * @param className The class name
+    * @return True if the class should be transformed; otherwise false
+    */
+   public static boolean accept(String className)
+   {
+      if (!approve(className))
+      {
+         return false;
       }
-    }
 
-    return false;
-  }
+      for (String cl : excludeList)
+      {
+         if (className.startsWith(cl))
+         {
+            return false;
+         }
+      }
 
-  /**
-   * Get the visibility for class
-   * @param className The class name
-   * @return The visibility
-   */
-  private static Visibility getVisibility(String className) {
-    Iterator it = visibilityTree.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      if (className.startsWith(key)) {
-        return (Visibility)entry.getValue();
+      if (includeAll &&
+            !excludeAll)
+      {
+         return true;
       }
-    }
 
-    return visibility;
-  }
+      for (String cl : includeList)
+      {
+         if (className.startsWith(cl))
+         {
+            return true;
+         }
+      }
 
-  /**
-   * The main method
-   * @param args The arguments
-   */
-  public static void main(String[] args) {
-    if (args.length == 4) {
-      try {
-        log.info(Version.VENDOR + " Profiler Precompiler " + Version.VERSION);
+      return false;
+   }
 
-        String include = args[0];
-        String exclude = args[1];
-        String vs = args[2];
-        File f = new File(args[3]);
+   /**
+    * Get the visibility for class
+    * @param className The class name
+    * @return The visibility
+    */
+   private static Visibility getVisibility(String className)
+   {
+      Iterator it = visibilityTree.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         if (className.startsWith(key))
+         {
+            return (Visibility)entry.getValue();
+         }
+      }
 
-        if (f.exists()) {
-          Precompiler.instrument(include, exclude, vs, f);
-        } else {
-          log.fatal("Can't locate " + f.getAbsolutePath());
-        }
+      return visibility;
+   }
 
-      } catch (Throwable t) {
-        t.printStackTrace(System.err);
+   /**
+    * The main method
+    * @param args The arguments
+    */
+   public static void main(String[] args)
+   {
+      if (args.length == 4)
+      {
+         try
+         {
+            log.info(Version.VENDOR +
+                  " Profiler Precompiler " + Version.VERSION);
+
+            String include = args[0];
+            String exclude = args[1];
+            String vs = args[2];
+            File f = new File(args[3]);
+
+            if (f.exists())
+            {
+               Precompiler.instrument(include, exclude, vs, f);
+            }
+            else
+            {
+               log.fatal("Can't locate " +
+                     f.getAbsolutePath());
+            }
+
+         }
+         catch (Throwable t)
+         {
+            t.printStackTrace(System.err);
+         }
       }
-    } else {
-      usage();
-    }
-  }
+      else
+      {
+         usage();
+      }
+   }
 
-  /**
-   * The usage method
-   */
-  private static void usage() {
-    System.out.println("Usage: Precompiler <includes> <excludes> <visibility> <directory>");
-  }
+   /**
+    * The usage method
+    */
+   private static void usage()
+   {
+      System.out.println("Usage: Precompiler <includes> <excludes> <visibility> <directory>");
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/SizeComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/SizeComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/precompiler/SizeComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,21 +28,28 @@
  * Size comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SizeComparator implements Comparator<String>, Serializable {
+public class SizeComparator implements Comparator<String>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param sa String
-   * @param sb String
-   * @return Positive if sb greater than sa; zero if equal; otherwise negative
-   */
-  public int compare(String sa, String sb) {
-    if (sa.length() < sb.length()) {
-      return 1;
-    } else if (sa.length() == sb.length()) { 
-      return sa.compareTo(sb);
-    } else {
-      return -1;
-    }
-  }
+   /**
+    * Compare two objects
+    * @param sa String
+    * @param sb String
+    * @return Positive if sb greater than sa; zero if equal; otherwise negative
+    */
+   public int compare(String sa, String sb)
+   {
+      if (sa.length() < sb.length())
+      {
+         return 1;
+      }
+      else if (sa.length() == sb.length())
+      {
+         return sa.compareTo(sb);
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,7 +21,6 @@
  */
 package org.jboss.profiler.client.web;
 
-import org.jboss.profiler.client.SnapshotUtil;
 import org.jboss.profiler.shared.Command;
 import org.jboss.profiler.shared.CommandType;
 import org.jboss.profiler.shared.Snapshot;
@@ -31,7 +30,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
-import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -41,584 +39,683 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class BasicOptBean implements Serializable {
-  private String lastestOpts = "";
-  //private String addClass="org.jboss.profiler.*";
-  private String addClass = "";
-  private String visibility;
-  //private String removeClass="org.apache.jsp.*";
-  private String removeClass = "";
-  private String selectSnapshot;
-  private String saveSnapshotName;
-  private boolean panelShows = false;
-  private String saveEcho = "";
-  
-  private String protocol = "socket";
-  private String host = "localhost";
-  private int port = 5400;
-  private String threshold = "1.0";
-  private static double digThreshold = 1.0;
-  private String plugin = "org.jboss.profiler.plugins.Hibernate";
-  
-  private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
-  private List<String> interceptClassList = new ArrayList<String>();
-  private static List<Snapshot> snapshotsList = new ArrayList<Snapshot>();
-  
-  private org.jboss.remoting.InvokerLocator locator;
-  private org.jboss.remoting.Client remotingClient;
+public class BasicOptBean implements Serializable
+{
+   private String lastestOpts = "";
 
-  /**
-   * Get latest opts
-   * @return The value
-   */
-  public String getLastestOpts() {
-    return lastestOpts;
-  }
+   // private String addClass="org.jboss.profiler.*";
+   private String addClass = "";
 
-  /**
-   * Set latest opts
-   * @param lastestOpts The value
-   */
-  public void setLastestOpts(String lastestOpts) {
-    this.lastestOpts = lastestOpts;
-  }
+   private String visibility;
 
-  /**
-   * Get add class
-   * @return The value
-   */
-  public String getAddClass() {
-    return addClass;
-  }
+   // private String removeClass="org.apache.jsp.*";
+   private String removeClass = "";
 
-  /**
-   * Set add class
-   * @param addClass The value
-   */
-  public void setAddClass(String addClass) {
-    this.addClass = addClass;
-  }
+   private String selectSnapshot;
 
-  /**
-   * Get visibility
-   * @return The value
-   */
-  public String getVisibility() {
-    return visibility;
-  }
+   private String saveSnapshotName;
 
-  /**
-   * Set visibility
-   * @param visibility The value
-   */
-  public void setVisibility(String visibility) {
-    this.visibility = visibility;
-  }
+   private boolean panelShows = false;
 
-  /**
-   * Get remove class
-   * @return The value
-   */
-  public String getRemoveClass() {
-    return removeClass;
-  }
+   private String saveEcho = "";
 
-  /**
-   * Set remove class
-   * @param removeClass The value
-   */
-  public void setRemoveClass(String removeClass) {
-    this.removeClass = removeClass;
-  }
- 
-  /**
-   * Get intercept class list
-   * @return The value
-   */
-  public List<String> getInterceptClassList() {
-    return interceptClassList;
-  }
+   private String protocol = "socket";
 
-  /**
-   * Set intercept class list
-   * @param interceptClassList The value
-   */
-  public void setInterceptClassList(List<String> interceptClassList) {
-    this.interceptClassList = interceptClassList;
-  }
+   private String host = "localhost";
 
-  /**
-   * Get snapshot list
-   * @return The value
-   */
-  public static List<Snapshot> getSnapshotsList() {
-    return snapshotsList;
-  }
+   private int port = 5400;
 
-  /**
-   * Set snapshot list
-   * @param snapshotsList The value
-   */
-  public static void setSnapshotsList(ArrayList<Snapshot> snapshotsList) {
-    BasicOptBean.snapshotsList = snapshotsList;
-  }
+   private String threshold = "1.0";
 
-  /**
-   * Get select snapshot
-   * @return The value
-   */
-  public String getSelectSnapshot() {
-    return selectSnapshot;
-  }
+   private static double digThreshold = 1.0;
 
-  /**
-   * Set select snapshot
-   * @param selectSnapshot The value
-   */
-  public void setSelectSnapshot(String selectSnapshot) {
-    this.selectSnapshot = selectSnapshot;
-  }
+   private String plugin = "org.jboss.profiler.plugins.Hibernate";
 
-  /**
-   * Get save snapshot name
-   * @return The value
-   */
-  public String getSaveSnapshotName() {
-    return saveSnapshotName;
-  }
+   private String path = LoadSnapshotBean.class.getResource("/").getFile() +
+         "../../files/";
 
-  /**
-   * Set save snapshot name
-   * @param saveSnapshotName The value
-   */
-  public void setSaveSnapshotName(String saveSnapshotName) {
-    this.saveSnapshotName = saveSnapshotName;
-  }
+   private List<String> interceptClassList = new ArrayList<String>();
 
-  /**
-   * Get dig threshold
-   * @return The value
-   */
-  public static double getDigThreshold() {
-    return digThreshold;
-  }
+   private static List<Snapshot> snapshotsList = new ArrayList<Snapshot>();
 
-  /**
-   * Set dig threshold
-   * @param digThreshold The value
-   */
-  public static void setDigThreshold(double digThreshold) {
-    BasicOptBean.digThreshold = digThreshold;
-  }
+   private org.jboss.remoting.InvokerLocator locator;
 
-  /**
-   * Is panels shown
-   * @return The value
-   */
-  public boolean isPanelShows() {
-    return panelShows;
-  }
+   private org.jboss.remoting.Client remotingClient;
 
-  /**
-   * Set panels shown
-   * @param panelShows The value
-   */
-  public void setPanelShows(boolean panelShows) {
-    this.panelShows = panelShows;
-  }
+   /**
+    * Get latest opts
+    * @return The value
+    */
+   public String getLastestOpts()
+   {
+      return lastestOpts;
+   }
 
-  /**
-   * Get save echo
-   * @return The value
-   */
-  public String getSaveEcho() {
-    return saveEcho;
-  }
+   /**
+    * Set latest opts
+    * @param lastestOpts The value
+    */
+   public void setLastestOpts(String lastestOpts)
+   {
+      this.lastestOpts = lastestOpts;
+   }
 
-  /**
-   * Set save echo
-   * @param saveEcho The value
-   */
-  public void setSaveEcho(String saveEcho) {
-    this.saveEcho = saveEcho;
-  }
-  
-  /**
-   * Click start
-   * @exception Throwable If an error occurs
-   */
-  public void clickStart() throws Throwable {   
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                        
-    remotingClient.connect();
-    this.connect();
+   /**
+    * Get add class
+    * @return The value
+    */
+   public String getAddClass()
+   {
+      return addClass;
+   }
 
-    Command cmd = new Command(CommandType.START_PROFILER);
-    String response = (String)remotingClient.invoke(cmd);       
-    this.setLastestOpts("Profiler has started.");
-        
-    remotingClient.disconnect();
-  }
+   /**
+    * Set add class
+    * @param addClass The value
+    */
+   public void setAddClass(String addClass)
+   {
+      this.addClass = addClass;
+   }
 
-  /**
-   * Click stop
-   * @exception Throwable If an error occurs
-   */
-  public void clickStop() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-    remotingClient.connect();
-          
-    Command cmd3 = new Command(CommandType.STOP_PROFILER);
-    String response = (String)remotingClient.invoke(cmd3);                              
-    this.setLastestOpts("Profiler has stopped.");
-        
-    remotingClient.disconnect();
-  }
+   /**
+    * Get visibility
+    * @return The value
+    */
+   public String getVisibility()
+   {
+      return visibility;
+   }
 
-  /**
-   * Click enable
-   * @exception Throwable If an error occurs
-   */
-  public void clickEnable() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                                
-    remotingClient.connect();  
-          
-    Command cmd1 = new Command(CommandType.ENABLE);
-    String response = (String)remotingClient.invoke(cmd1);                                      
-    this.setLastestOpts("Profiler has enabled.");
-        
-    remotingClient.disconnect();
-  }
-  
-  /**
-   * Click disable
-   * @exception Throwable If an error occurs
-   */
-  public void clickDisable() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                                
-    remotingClient.connect();  
-          
-    Command cmd2 = new Command(CommandType.DISABLE);
-    String response = (String)remotingClient.invoke(cmd2);                                      
-    this.setLastestOpts("Profiler has disabled.");      
-        
-    remotingClient.disconnect();
-  }
+   /**
+    * Set visibility
+    * @param visibility The value
+    */
+   public void setVisibility(String visibility)
+   {
+      this.visibility = visibility;
+   }
 
-  /**
-   * GC
-   * @exception Throwable If an error occurs
-   */
-  public void gc() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                                
-    remotingClient.connect();
-    this.connect();
+   /**
+    * Get remove class
+    * @return The value
+    */
+   public String getRemoveClass()
+   {
+      return removeClass;
+   }
 
-    Command cmd = new Command(CommandType.GC);
-    String response = (String)remotingClient.invoke(cmd);       
-    this.setLastestOpts("begins garbage collection.");
-                
-    remotingClient.disconnect();
-  }
-  
-  /**
-   * Take snapshot
-   * @exception Throwable If an error occurs
-   */
-  public void takeSnapshot() throws Throwable {    
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                                
-    remotingClient.connect();
+   /**
+    * Set remove class
+    * @param removeClass The value
+    */
+   public void setRemoveClass(String removeClass)
+   {
+      this.removeClass = removeClass;
+   }
 
-    Command cmd = new Command(CommandType.SNAPSHOT);
-        
-    Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
-    if (snapshot != null) {
-      //SnapshotUtil su = new SnapshotUtil(new Double(threshold).doubleValue());
-      BasicOptBean.snapshotsList.add(snapshot);
-    }
-                
-    remotingClient.disconnect();
-  }
-  
-  /**
-   * Clear snapshots
-   * @exception Throwable If an error occurs
-   */
-  public void clearSnapshot() throws Throwable {    
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-                                        
-    remotingClient.connect();
+   /**
+    * Get intercept class list
+    * @return The value
+    */
+   public List<String> getInterceptClassList()
+   {
+      return interceptClassList;
+   }
 
-    Command cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
-                
-    String response = (String)remotingClient.invoke(cmd);
+   /**
+    * Set intercept class list
+    * @param interceptClassList The value
+    */
+   public void setInterceptClassList(List<String> interceptClassList)
+   {
+      this.interceptClassList = interceptClassList;
+   }
 
-    this.snapshotsList.clear();
-                        
-    remotingClient.disconnect();
-    this.setPanelShows(false);
-  }
-  
-  /**
-   * Get snapshots
-   * @return all the snapshots string from the agent side
-   * @throws Throwable If an error occurs
-   */
-  public String[] getSnapshots() throws Throwable {  
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-    remotingClient.connect();
-    Command cmd = new Command(CommandType.LIST_SNAPSHOTS);
-    String[] snapshots = (String[])remotingClient.invoke(cmd);
-    remotingClient.disconnect();
-    return snapshots;
-  }
-  
-  /**
-   * Select snapshot action
-   */
-  public void selectSnapshotAction() {
-    this.setPanelShows(true);
-  }
-  
-  /**
-   * Select save snapshot action
-   * @throws Throwable If an error occurs
-   */
-  public void selectSaveSnapshotAction() throws Throwable {
-    String[] snapshots = this.getSnapshots();
-    int k = 0;
-    for (int i = 0; i < snapshots.length; i++) {
-      if (snapshots[i].equals(this.selectSnapshot))
-        k = i;
-    }
-    Snapshot selectSnapshot1 = (Snapshot)this.snapshotsList.get(k);
-    try {
-      if (this.saveSnapshotName == null || this.saveSnapshotName.trim().equals(""))
-        SnapshotHelper.save(selectSnapshot1, new File(path + SnapshotHelper.getName(selectSnapshot1) + ".jps"));
-      else
-        SnapshotHelper.save(selectSnapshot1, new File(path + this.saveSnapshotName));
-      
-      this.saveEcho = "snapshot " + this.saveSnapshotName + " is just saved!";
-      this.saveSnapshotName = "";
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-  
-  /**
-   * Get visibilities
-   * @return The value
-   */
-  public List<SelectItem> getVisibilities() {
-    List<SelectItem> allSelectItems = new ArrayList<SelectItem>(4);
-    allSelectItems.add(new SelectItem("public"));
-    allSelectItems.add(new SelectItem("package"));
-    allSelectItems.add(new SelectItem("protected"));
-    allSelectItems.add(new SelectItem("private"));
-    return allSelectItems;
-  }
-  
-  /**
-   * Add class action
-   * @exception Throwable If an error occurs
-   */
-  public void addClassAction() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-    remotingClient.connect();  
-        
-    String clz = this.addClass;
-    Visibility v = Visibility.PUBLIC;
-    
-    if (this.visibility.endsWith("private")) {
-      v = Visibility.PRIVATE;
-    } else if (this.visibility.endsWith("protected")) {
-      v = Visibility.PROTECTED;
-    } else if (this.visibility.endsWith("package")) {
-      v = Visibility.PACKAGE;
-    }
-    
-    Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
-                  
-    String response = (String)remotingClient.invoke(cmd);                                       
-    //this.setLastestOpts("Profiler has disabled.");            
-    remotingClient.disconnect();        
-        
-    listClassAction();
-  }
-  
-  /**
-   * Remove class action
-   * @exception Throwable If an error occurs
-   */
-  public void removeClassAction() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-    remotingClient.connect();  
-        
-    String clz = this.removeClass;
-    Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {clz});
-                          
-    String response = (String)remotingClient.invoke(cmd);                                       
+   /**
+    * Get snapshot list
+    * @return The value
+    */
+   public static List<Snapshot> getSnapshotsList()
+   {
+      return snapshotsList;
+   }
 
-    remotingClient.disconnect();
-        
-    listClassAction();
-  }
-  
-  /**
-   * List class action
-   * @exception Throwable If an error occurs
-   */
-  public void listClassAction() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    remotingClient = new org.jboss.remoting.Client(locator);
-    remotingClient.connect();  
-                
-    Command cmd = new Command(CommandType.LIST_CLASSES);                                
-                
-    this.interceptClassList.clear();
-    String[] result = (String[])remotingClient.invoke(cmd);
-    if (result != null) {
-      for (int j = 0; j < result.length; j++) {
-        this.interceptClassList.add(result[j]);
+   /**
+    * Set snapshot list
+    * @param snapshotsList The value
+    */
+   public static void setSnapshotsList(ArrayList<Snapshot> snapshotsList)
+   {
+      BasicOptBean.snapshotsList = snapshotsList;
+   }
+
+   /**
+    * Get select snapshot
+    * @return The value
+    */
+   public String getSelectSnapshot()
+   {
+      return selectSnapshot;
+   }
+
+   /**
+    * Set select snapshot
+    * @param selectSnapshot The value
+    */
+   public void setSelectSnapshot(String selectSnapshot)
+   {
+      this.selectSnapshot = selectSnapshot;
+   }
+
+   /**
+    * Get save snapshot name
+    * @return The value
+    */
+   public String getSaveSnapshotName()
+   {
+      return saveSnapshotName;
+   }
+
+   /**
+    * Set save snapshot name
+    * @param saveSnapshotName The value
+    */
+   public void setSaveSnapshotName(String saveSnapshotName)
+   {
+      this.saveSnapshotName = saveSnapshotName;
+   }
+
+   /**
+    * Get dig threshold
+    * @return The value
+    */
+   public static double getDigThreshold()
+   {
+      return digThreshold;
+   }
+
+   /**
+    * Set dig threshold
+    * @param digThreshold The value
+    */
+   public static void setDigThreshold(double digThreshold)
+   {
+      BasicOptBean.digThreshold = digThreshold;
+   }
+
+   /**
+    * Is panels shown
+    * @return The value
+    */
+   public boolean isPanelShows()
+   {
+      return panelShows;
+   }
+
+   /**
+    * Set panels shown
+    * @param panelShows The value
+    */
+   public void setPanelShows(boolean panelShows)
+   {
+      this.panelShows = panelShows;
+   }
+
+   /**
+    * Get save echo
+    * @return The value
+    */
+   public String getSaveEcho()
+   {
+      return saveEcho;
+   }
+
+   /**
+    * Set save echo
+    * @param saveEcho The value
+    */
+   public void setSaveEcho(String saveEcho)
+   {
+      this.saveEcho = saveEcho;
+   }
+
+   /**
+    * Click start
+    * @exception Throwable If an error occurs
+    */
+   public void clickStart() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+      this.connect();
+
+      Command cmd = new Command(CommandType.START_PROFILER);
+      String response = (String)remotingClient.invoke(cmd);
+      this.setLastestOpts("Profiler has started.");
+
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Click stop
+    * @exception Throwable If an error occurs
+    */
+   public void clickStop() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+      remotingClient.connect();
+
+      Command cmd3 = new Command(CommandType.STOP_PROFILER);
+      String response = (String)remotingClient.invoke(cmd3);
+      this.setLastestOpts("Profiler has stopped.");
+
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Click enable
+    * @exception Throwable If an error occurs
+    */
+   public void clickEnable() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+
+      Command cmd1 = new Command(CommandType.ENABLE);
+      String response = (String)remotingClient.invoke(cmd1);
+      this.setLastestOpts("Profiler has enabled.");
+
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Click disable
+    * @exception Throwable If an error occurs
+    */
+   public void clickDisable() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+
+      Command cmd2 = new Command(CommandType.DISABLE);
+      String response = (String)remotingClient.invoke(cmd2);
+      this.setLastestOpts("Profiler has disabled.");
+
+      remotingClient.disconnect();
+   }
+
+   /**
+    * GC
+    * @exception Throwable If an error occurs
+    */
+   public void gc() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+      this.connect();
+
+      Command cmd = new Command(CommandType.GC);
+      String response = (String)remotingClient.invoke(cmd);
+      this.setLastestOpts("begins garbage collection.");
+
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Take snapshot
+    * @exception Throwable If an error occurs
+    */
+   public void takeSnapshot() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+
+      Command cmd = new Command(CommandType.SNAPSHOT);
+
+      Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
+      if (snapshot != null)
+      {
+         // SnapshotUtil su = new SnapshotUtil(new Double(threshold).doubleValue());
+         BasicOptBean.snapshotsList.add(snapshot);
       }
-    }   
-    remotingClient.disconnect();
-  }
-  
-  /**
-   * Get the protocol
-   * @return The value
-   */
-  public String getProtocol() {
-    return protocol;
-  }
-        
-  /**
-   * Set the protocol
-   * @param protocol The value
-   */
-  public void setProtocol(String protocol) {
-    this.protocol = protocol;
-  }
-        
-  /**
-   * Get the host
-   * @return The value
-   */
-  public String getHost() {
-    return host;
-  }
-        
-  /**
-   * Set the host
-   * @param host The value
-   */
-  public void setHost(String host) {
-    this.host = host;
-  }
-        
-  /**
-   * Get the port
-   * @return The value
-   */
-  public int getPort() {
-    return port;
-  }
-        
-  /**
-   * Set the port
-   * @param port The value
-   */
-  public void setPort(int port) {
-    this.port = port;
-  }
 
-  /**
-   * Get the threshold
-   * @return The value
-   */
-  public String getThreshold() {
-    return threshold;
-  }
+      remotingClient.disconnect();
+   }
 
-  /**
-   * Set the threshold
-   * @param threshold The value
-   */
-  public void setThreshold(String threshold) {
-    this.threshold = threshold;
-    BasicOptBean.setDigThreshold(new Double(threshold).doubleValue());
-  }
+   /**
+    * Clear snapshots
+    * @exception Throwable If an error occurs
+    */
+   public void clearSnapshot() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
 
-  /**
-   * Get the plugin
-   * @return The value
-   */
-  public String getPlugin() {
-    return plugin;
-  }
-        
-  /**
-   * Set the plugin
-   * @param plugin The value
-   */
-  public void setPlugin(String plugin) {
-    this.plugin = plugin;
-  }
+      remotingClient.connect();
 
-  /**
-   * Get the plugins
-   * @return The value
-   */
-  public List<SelectItem> getProtocols() {
-    List<SelectItem> allSelectItems = null;
-    allSelectItems = new ArrayList<SelectItem>(3);
-    allSelectItems.add(new SelectItem("socket"));
-    allSelectItems.add(new SelectItem("http"));
-    allSelectItems.add(new SelectItem("rmi"));
-    return allSelectItems;
-  }
-        
-  /**
-   * Connect
-   * @exception Throwable If an error occurs
-   */
-  public void connect() throws Throwable {
-    locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);     
-    org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
-                        
-    remotingClient.connect();
-    remotingClient.disconnect();
-  }
-        
-  /**
-   * Protocol changed
-   * @param evt The event
-   */
-  public void protocolChanged(ValueChangeEvent evt) {
-    String protocol = (String)evt.getNewValue();
-    if (protocol.endsWith("socket")) {
-      this.setPort(5400);
-    } else if (protocol.endsWith("http")) {
-      this.setPort(5401);
-    } else {
-      this.setPort(5402);
-    }
-                
-    this.setProtocol(protocol);
-  }
+      Command cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
+
+      String response = (String)remotingClient.invoke(cmd);
+
+      this.snapshotsList.clear();
+
+      remotingClient.disconnect();
+      this.setPanelShows(false);
+   }
+
+   /**
+    * Get snapshots
+    * @return all the snapshots string from the agent side
+    * @throws Throwable If an error occurs
+    */
+   public String[] getSnapshots() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+      remotingClient.connect();
+      Command cmd = new Command(CommandType.LIST_SNAPSHOTS);
+      String[] snapshots = (String[])remotingClient.invoke(cmd);
+      remotingClient.disconnect();
+      return snapshots;
+   }
+
+   /**
+    * Select snapshot action
+    */
+   public void selectSnapshotAction()
+   {
+      this.setPanelShows(true);
+   }
+
+   /**
+    * Select save snapshot action
+    * @throws Throwable If an error occurs
+    */
+   public void selectSaveSnapshotAction() throws Throwable
+   {
+      String[] snapshots = this.getSnapshots();
+      int k = 0;
+      for (int i = 0; i < snapshots.length; i++)
+      {
+         if (snapshots[i].equals(this.selectSnapshot))
+            k = i;
+      }
+      Snapshot selectSnapshot1 = (Snapshot)this.snapshotsList.get(k);
+      try
+      {
+         if (this.saveSnapshotName == null ||
+               this.saveSnapshotName.trim().equals(""))
+            SnapshotHelper.save(selectSnapshot1, new File(path +
+                  SnapshotHelper.getName(selectSnapshot1) + ".jps"));
+         else
+            SnapshotHelper.save(selectSnapshot1, new File(path +
+                  this.saveSnapshotName));
+
+         this.saveEcho = "snapshot " +
+               this.saveSnapshotName + " is just saved!";
+         this.saveSnapshotName = "";
+      }
+      catch (IOException e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   /**
+    * Get visibilities
+    * @return The value
+    */
+   public List<SelectItem> getVisibilities()
+   {
+      List<SelectItem> allSelectItems = new ArrayList<SelectItem>(4);
+      allSelectItems.add(new SelectItem("public"));
+      allSelectItems.add(new SelectItem("package"));
+      allSelectItems.add(new SelectItem("protected"));
+      allSelectItems.add(new SelectItem("private"));
+      return allSelectItems;
+   }
+
+   /**
+    * Add class action
+    * @exception Throwable If an error occurs
+    */
+   public void addClassAction() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+      remotingClient.connect();
+
+      String clz = this.addClass;
+      Visibility v = Visibility.PUBLIC;
+
+      if (this.visibility.endsWith("private"))
+      {
+         v = Visibility.PRIVATE;
+      }
+      else if (this.visibility.endsWith("protected"))
+      {
+         v = Visibility.PROTECTED;
+      }
+      else if (this.visibility.endsWith("package"))
+      {
+         v = Visibility.PACKAGE;
+      }
+
+      Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
+
+      String response = (String)remotingClient.invoke(cmd);
+      // this.setLastestOpts("Profiler has disabled.");
+      remotingClient.disconnect();
+
+      listClassAction();
+   }
+
+   /**
+    * Remove class action
+    * @exception Throwable If an error occurs
+    */
+   public void removeClassAction() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+      remotingClient.connect();
+
+      String clz = this.removeClass;
+      Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {clz});
+
+      String response = (String)remotingClient.invoke(cmd);
+
+      remotingClient.disconnect();
+
+      listClassAction();
+   }
+
+   /**
+    * List class action
+    * @exception Throwable If an error occurs
+    */
+   public void listClassAction() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      remotingClient = new org.jboss.remoting.Client(locator);
+      remotingClient.connect();
+
+      Command cmd = new Command(CommandType.LIST_CLASSES);
+
+      this.interceptClassList.clear();
+      String[] result = (String[])remotingClient.invoke(cmd);
+      if (result != null)
+      {
+         for (int j = 0; j < result.length; j++)
+         {
+            this.interceptClassList.add(result[j]);
+         }
+      }
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Get the protocol
+    * @return The value
+    */
+   public String getProtocol()
+   {
+      return protocol;
+   }
+
+   /**
+    * Set the protocol
+    * @param protocol The value
+    */
+   public void setProtocol(String protocol)
+   {
+      this.protocol = protocol;
+   }
+
+   /**
+    * Get the host
+    * @return The value
+    */
+   public String getHost()
+   {
+      return host;
+   }
+
+   /**
+    * Set the host
+    * @param host The value
+    */
+   public void setHost(String host)
+   {
+      this.host = host;
+   }
+
+   /**
+    * Get the port
+    * @return The value
+    */
+   public int getPort()
+   {
+      return port;
+   }
+
+   /**
+    * Set the port
+    * @param port The value
+    */
+   public void setPort(int port)
+   {
+      this.port = port;
+   }
+
+   /**
+    * Get the threshold
+    * @return The value
+    */
+   public String getThreshold()
+   {
+      return threshold;
+   }
+
+   /**
+    * Set the threshold
+    * @param threshold The value
+    */
+   public void setThreshold(String threshold)
+   {
+      this.threshold = threshold;
+      BasicOptBean.setDigThreshold(new Double(threshold).doubleValue());
+   }
+
+   /**
+    * Get the plugin
+    * @return The value
+    */
+   public String getPlugin()
+   {
+      return plugin;
+   }
+
+   /**
+    * Set the plugin
+    * @param plugin The value
+    */
+   public void setPlugin(String plugin)
+   {
+      this.plugin = plugin;
+   }
+
+   /**
+    * Get the plugins
+    * @return The value
+    */
+   public List<SelectItem> getProtocols()
+   {
+      List<SelectItem> allSelectItems = null;
+      allSelectItems = new ArrayList<SelectItem>(3);
+      allSelectItems.add(new SelectItem("socket"));
+      allSelectItems.add(new SelectItem("http"));
+      allSelectItems.add(new SelectItem("rmi"));
+      return allSelectItems;
+   }
+
+   /**
+    * Connect
+    * @exception Throwable If an error occurs
+    */
+   public void connect() throws Throwable
+   {
+      locator = new org.jboss.remoting.InvokerLocator(this.protocol +
+            "://" + this.host + ":" + this.port);
+      org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+
+      remotingClient.connect();
+      remotingClient.disconnect();
+   }
+
+   /**
+    * Protocol changed
+    * @param evt The event
+    */
+   public void protocolChanged(ValueChangeEvent evt)
+   {
+      String protocol = (String)evt.getNewValue();
+      if (protocol.endsWith("socket"))
+      {
+         this.setPort(5400);
+      }
+      else if (protocol.endsWith("http"))
+      {
+         this.setPort(5401);
+      }
+      else
+      {
+         this.setPort(5402);
+      }
+
+      this.setProtocol(protocol);
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -21,15 +21,12 @@
  */
 package org.jboss.profiler.client.web;
 
-import org.jboss.profiler.client.CombinedFrameComparator;
 import org.jboss.profiler.client.CombinedFrameInfo;
 import org.jboss.profiler.client.SnapshotUtil;
 import org.jboss.profiler.client.TimedClassComparator;
 import org.jboss.profiler.client.TimedClassInfo;
 import org.jboss.profiler.client.Util;
 import org.jboss.profiler.shared.AllocationInfo;
-import org.jboss.profiler.shared.Math;
-import org.jboss.profiler.shared.Snapshot;
 
 import java.io.Serializable;
 import java.text.DecimalFormat;
@@ -42,229 +39,271 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class ClassBean implements Serializable {
-  private String className;
-  private String type;
-  private String totalTime;
-  private String waitTime;
-  private long allocCount;
-  private String selectedClass = "";        
-  private Map<String, List<CombinedFrameInfo>> info = null;
-  private List<TimedClassInfo> classes = null;
+public class ClassBean implements Serializable
+{
+   private String className;
 
-  /**
-   * Constructor
-   */
-  public ClassBean() {
-  }
-        
-  /**
-   * Constructor
-   * @param className The class name
-   * @param type The type
-   * @param totalTime The total time
-   */
-  public ClassBean(String className, String type, String totalTime) {
-    this(className, type, totalTime, "", -1);
-  }
-        
-  /**
-   * Constructor
-   * @param className The class name
-   * @param type The type
-   * @param totalTime The total time
-   * @param waitTime The wait time
-   * @param allocations The allocations
-   */
-  public ClassBean(String className, String type, String totalTime, String waitTime, long allocations) {
-    this.className = className;
-    this.totalTime = totalTime;
-    this.type = type;
-    this.waitTime = waitTime;
-    this.allocCount = allocations;
-  }
-        
-  /**
-   * Get the class name
-   * @return The value
-   */
-  public String getClassName() {
-    return className;
-  }
-        
-  /**
-   * Set the class name
-   * @param className The value
-   */
-  public void setClassName(String className) {
-    this.className = className;
-  }
-        
-  /**
-   * Get the type
-   * @return The value
-   */
-  public String getType() {
-    return type;
-  }
-        
-  /**
-   * Set the type
-   * @param type The value
-   */
-  public void setType(String type) {
-    this.type = type;
-  }
-        
-  /**
-   * Get the total time
-   * @return The value
-   */
-  public String getTotalTime() {
-    return totalTime;
-  }
-        
-  /**
-   * Set the total time
-   * @param totalTime The value
-   */
-  public void setTotalTime(String totalTime) {
-    this.totalTime = totalTime;
-  }
+   private String type;
 
-  /**
-   * Get the wait time
-   * @return The value
-   */
-  public String getWaitTime() {
-    return waitTime;
-  }
-        
-  /**
-   * Set the wait time
-   * @param waitTime The value
-   */
-  public void setWaitTime(String waitTime) {
-    this.waitTime = waitTime;
-  }
+   private String totalTime;
 
-  /**
-   * Get the allocation count
-   * @return The value
-   */
-  public long getAllocCount() {
-    return allocCount;
-  }
-        
-  /**
-   * Set the allocation count
-   * @param allocCount The value
-   */
-  public void setAllocCount(long allocCount) {
-    this.allocCount = allocCount;
-  }
+   private String waitTime;
 
-  /**
-   * Get the number of allocations
-   * @param tci The timed class info
-   * @param allocs The allocations
-   * @return The number
-   */
-  private long getAllocations(TimedClassInfo tci, List<AllocationInfo> allocs) {
-    String prettyClassName = Util.getPrettyName(tci);
-    long alloc = 0;                 
-    if (allocs != null && allocs.size() > 0) {
-      boolean found = false;
-      for (int i = 0; !found && i < allocs.size(); i++) {
-        AllocationInfo ai = allocs.get(i);
-        if (ai.getClassName().equals(prettyClassName)) {
-          alloc = ai.getCount();
-          found = true;
-        }
+   private long allocCount;
+
+   private String selectedClass = "";
+
+   private Map<String, List<CombinedFrameInfo>> info = null;
+
+   private List<TimedClassInfo> classes = null;
+
+   /**
+    * Constructor
+    */
+   public ClassBean()
+   {
+   }
+
+   /**
+    * Constructor
+    * @param className The class name
+    * @param type The type
+    * @param totalTime The total time
+    */
+   public ClassBean(String className, String type, String totalTime)
+   {
+      this(className, type, totalTime, "", -1);
+   }
+
+   /**
+    * Constructor
+    * @param className The class name
+    * @param type The type
+    * @param totalTime The total time
+    * @param waitTime The wait time
+    * @param allocations The allocations
+    */
+   public ClassBean(String className, String type, String totalTime, String waitTime, long allocations)
+   {
+      this.className = className;
+      this.totalTime = totalTime;
+      this.type = type;
+      this.waitTime = waitTime;
+      this.allocCount = allocations;
+   }
+
+   /**
+    * Get the class name
+    * @return The value
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Set the class name
+    * @param className The value
+    */
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+
+   /**
+    * Get the type
+    * @return The value
+    */
+   public String getType()
+   {
+      return type;
+   }
+
+   /**
+    * Set the type
+    * @param type The value
+    */
+   public void setType(String type)
+   {
+      this.type = type;
+   }
+
+   /**
+    * Get the total time
+    * @return The value
+    */
+   public String getTotalTime()
+   {
+      return totalTime;
+   }
+
+   /**
+    * Set the total time
+    * @param totalTime The value
+    */
+   public void setTotalTime(String totalTime)
+   {
+      this.totalTime = totalTime;
+   }
+
+   /**
+    * Get the wait time
+    * @return The value
+    */
+   public String getWaitTime()
+   {
+      return waitTime;
+   }
+
+   /**
+    * Set the wait time
+    * @param waitTime The value
+    */
+   public void setWaitTime(String waitTime)
+   {
+      this.waitTime = waitTime;
+   }
+
+   /**
+    * Get the allocation count
+    * @return The value
+    */
+   public long getAllocCount()
+   {
+      return allocCount;
+   }
+
+   /**
+    * Set the allocation count
+    * @param allocCount The value
+    */
+   public void setAllocCount(long allocCount)
+   {
+      this.allocCount = allocCount;
+   }
+
+   /**
+    * Get the number of allocations
+    * @param tci The timed class info
+    * @param allocs The allocations
+    * @return The number
+    */
+   private long getAllocations(TimedClassInfo tci, List<AllocationInfo> allocs)
+   {
+      String prettyClassName = Util.getPrettyName(tci);
+      long alloc = 0;
+      if (allocs != null &&
+            allocs.size() > 0)
+      {
+         boolean found = false;
+         for (int i = 0; !found &&
+               i < allocs.size(); i++)
+         {
+            AllocationInfo ai = allocs.get(i);
+            if (ai.getClassName().equals(prettyClassName))
+            {
+               alloc = ai.getCount();
+               found = true;
+            }
+         }
       }
-    }
-    return alloc;
-  }
-        
-  /**
-   * Get the selected class
-   * @return The value
-   */
-  public String getSelectedClass() {
-    return selectedClass;
-  }
+      return alloc;
+   }
 
-  /**
-   * Set the selected class
-   * @param selectedClass The value
-   */
-  public void setSelectedClass(String selectedClass) {
-    this.selectedClass = selectedClass;
-  }
+   /**
+    * Get the selected class
+    * @return The value
+    */
+   public String getSelectedClass()
+   {
+      return selectedClass;
+   }
 
-  /**
-   * Get the row keys
-   * @return The value
-   */
-  public Set<String> getAjaxRowKeys() {
-    ClassBean[] clazz = this.getClasses();
-    Set<String> keys = new HashSet<String>();
-    for (int i = 0; i < clazz.length; i++) {
-      keys.add(clazz[i].className);
-    }
-    return keys;
-  }
-        
-  /**
-   * Fire method info
-   */
-  public void fireMethodsInfo() {
-    TimedClassInfo selectedTimedClassInfo = null, tmpTimedClassInfo = null;
-    String tmpString;
-    if (this.classes != null) {
-      for (int i = 0; i < classes.size(); i++) {
-        tmpTimedClassInfo = (TimedClassInfo)(classes.get(i));
-        tmpString = tmpTimedClassInfo.getClassName();
-        //have to replace / with .
-        tmpString = tmpString.replace('/', '.');
-        if (this.getSelectedClass().equals(tmpString)) {
-          selectedTimedClassInfo = tmpTimedClassInfo;     
-          break;
-        }
+   /**
+    * Set the selected class
+    * @param selectedClass The value
+    */
+   public void setSelectedClass(String selectedClass)
+   {
+      this.selectedClass = selectedClass;
+   }
+
+   /**
+    * Get the row keys
+    * @return The value
+    */
+   public Set<String> getAjaxRowKeys()
+   {
+      ClassBean[] clazz = this.getClasses();
+      Set<String> keys = new HashSet<String>();
+      for (int i = 0; i < clazz.length; i++)
+      {
+         keys.add(clazz[i].className);
       }
-    }
-    MethodBean.setTci(selectedTimedClassInfo);
-    List<CombinedFrameInfo> l = info.get(selectedTimedClassInfo.getClassName());
-    MethodBean.setCfs(l);
-  }
-     
-  /**
-   * Get the class beans
-   * @return The value
-   */
-  public ClassBean[] getClasses() {
-    ClassBean[] classBeans = null;
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      DecimalFormat df = new DecimalFormat("#0.00");
-      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-      Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
-      List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
-                    
-      this.info = info;
-      this.classes = classes;
-                        
-      Collections.sort(classes, new TimedClassComparator(TimedClassComparator.NAME));
-                    
-      int j = 0;
-      long tmpCount = 0;
-      classBeans = new ClassBean[classes.size()];
-                    
-      for (TimedClassInfo tci : classes) {
-        tmpCount = this.getAllocations(tci, LoadSnapshotBean.getSnapshot().getAllocations());
-        classBeans[j++] = new ClassBean(Util.getPrettyName(tci), Util.getDescription(tci),
-                                        df.format(tci.getTotalTime()), df.format(tci.getWaitTime()), tmpCount);
-      }    
-    }
-    return classBeans;
-  }
+      return keys;
+   }
+
+   /**
+    * Fire method info
+    */
+   public void fireMethodsInfo()
+   {
+      TimedClassInfo selectedTimedClassInfo = null, tmpTimedClassInfo = null;
+      String tmpString;
+      if (this.classes != null)
+      {
+         for (int i = 0; i < classes.size(); i++)
+         {
+            tmpTimedClassInfo = (TimedClassInfo)(classes.get(i));
+            tmpString = tmpTimedClassInfo.getClassName();
+            // have to replace / with .
+            tmpString = tmpString.replace('/', '.');
+            if (this.getSelectedClass().equals(tmpString))
+            {
+               selectedTimedClassInfo = tmpTimedClassInfo;
+               break;
+            }
+         }
+      }
+      MethodBean.setTci(selectedTimedClassInfo);
+      List<CombinedFrameInfo> l = info.get(selectedTimedClassInfo.getClassName());
+      MethodBean.setCfs(l);
+   }
+
+   /**
+    * Get the class beans
+    * @return The value
+    */
+   public ClassBean[] getClasses()
+   {
+      ClassBean[] classBeans = null;
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         DecimalFormat df = new DecimalFormat("#0.00");
+         SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+         Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+         List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+
+         this.info = info;
+         this.classes = classes;
+
+         Collections.sort(classes, new TimedClassComparator(TimedClassComparator.NAME));
+
+         int j = 0;
+         long tmpCount = 0;
+         classBeans = new ClassBean[classes.size()];
+
+         for (TimedClassInfo tci : classes)
+         {
+            tmpCount = this.getAllocations(tci, LoadSnapshotBean.getSnapshot().getAllocations());
+            classBeans[j++] =
+                  new ClassBean(Util.getPrettyName(tci),
+                                Util.getDescription(tci),
+                                df.format(tci.getTotalTime()),
+                                df.format(tci.getWaitTime()),
+                                tmpCount);
+         }
+      }
+      return classBeans;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -24,7 +24,6 @@
 import org.jboss.profiler.client.CombinedFrameComparator;
 import org.jboss.profiler.client.CombinedFrameInfo;
 import org.jboss.profiler.client.SnapshotUtil;
-import org.jboss.profiler.client.TimedClassInfo;
 import org.jboss.profiler.shared.Snapshot;
 import org.jboss.profiler.shared.SnapshotHelper;
 
@@ -44,322 +43,375 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class CompareSnapshotBean implements Serializable {
-  private String[] snapshotsToCompare = new String[2];
-  private CompareSnapshotBean[] compareSnapshotBeans;
-  private String difftime;
-  private String oTime;
-  private String nTime;
-  private long diffCount;
-  private long oCount;
-  private long nCount;
-  private String methodName;
-  private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
+public class CompareSnapshotBean implements Serializable
+{
+   private String[] snapshotsToCompare = new String[2];
 
-  /**
-   * Constructor
-   */
-  public CompareSnapshotBean() {
-  }
-        
-  /**
-   * Constructor
-   * @param difftime The diff time
-   * @param oTime The old time
-   * @param nTime The new time
-   * @param diffCount The diff count
-   * @param oCount The old count
-   * @param nCount The new count
-   * @param methodName The method name
-   */
-  public CompareSnapshotBean(String difftime,
-                             String oTime,
-                             String nTime,
-                             long diffCount,
-                             long oCount,
-                             long nCount,
-                             String methodName) {
-    this.difftime = difftime;
-    this.oTime = oTime;
-    this.nTime = nTime;
-    this.diffCount = diffCount;
-    this.oCount = oCount;
-    this.nCount = nCount;
-    this.methodName = methodName;
-  }
-  
-  /**
-   * Get the diff time
-   * @return The value
-   */
-  public String getDifftime() {
-    return difftime;
-  }
-        
-  /**
-   * Set the diff time
-   * @param difftime The value
-   */
-  public void setDifftime(String difftime) {
-    this.difftime = difftime;
-  }
-        
-  /**
-   * Get the old time
-   * @return The value
-   */
-  public String getOTime() {
-    return oTime;
-  }
-        
-  /**
-   * Set the old time
-   * @param time The value
-   */
-  public void setOTime(String time) {
-    oTime = time;
-  }
+   private CompareSnapshotBean[] compareSnapshotBeans;
 
-  /**
-   * Get the new time
-   * @return The value
-   */
-  public String getNTime() {
-    return nTime;
-  }
-        
-  /**
-   * Set the new time
-   * @param time The value
-   */
-  public void setNTime(String time) {
-    nTime = time;
-  }
-        
-  /**
-   * Get the diff count
-   * @return The value
-   */
-  public long getDiffCount() {
-    return diffCount;
-  }
-        
-  /**
-   * Set the diff count
-   * @param diffCount The value
-   */
-  public void setDiffCount(long diffCount) {
-    this.diffCount = diffCount;
-  }
-        
-  /**
-   * Get the old count
-   * @return The value
-   */
-  public long getOCount() {
-    return oCount;
-  }
-        
-  /**
-   * Set the old count
-   * @param count The value
-   */
-  public void setOCount(long count) {
-    oCount = count;
-  }
-        
-  /**
-   * Get the new count
-   * @return The value
-   */
-  public long getNCount() {
-    return nCount;
-  }
-        
-  /**
-   * Set the new count
-   * @param count The value
-   */
-  public void setNCount(long count) {
-    nCount = count;
-  }
-        
-  /**
-   * Get the method name
-   * @return The value
-   */
-  public String getMethodName() {
-    return methodName;
-  }
-        
-  /**
-   * Set the method name
-   * @param methodName The value
-   */
-  public void setMethodName(String methodName) {
-    this.methodName = methodName;
-  }
-        
-  /**
-   * Get the compare snapshot beans
-   * @return The value
-   */
-  public CompareSnapshotBean[] getCompareSnapshotBeans() {
-    return compareSnapshotBeans;
-  }
-        
-  /**
-   * Get the snapshot to compare
-   * @return The value
-   */
-  public String[] getSnapshotsToCompare() {
-    return snapshotsToCompare;
-  }
-        
-  /**
-   * Set the snapshot to compare
-   * @param snapshotsToCompare The value
-   */
-  public void setSnapshotsToCompare(String[] snapshotsToCompare) {
-    this.snapshotsToCompare = snapshotsToCompare;
-  }
-        
-  /**
-   * Get the files
-   * @return The value
-   */
-  public List<SelectItem> getJPSs() {
-    List<SelectItem> allSelectItems = null;
-    File tempFile = new File(path);
-    String[] fileStr = tempFile.list();
-    List<String> jpsFiles = new ArrayList<String>();
-    allSelectItems = new ArrayList<SelectItem>();
-    for (int i = 0; i < fileStr.length; i++) {
-      if (fileStr[i].endsWith("jps")) {
-        jpsFiles.add(fileStr[i]);
-        allSelectItems.add(new SelectItem(fileStr[i]));
+   private String difftime;
+
+   private String oTime;
+
+   private String nTime;
+
+   private long diffCount;
+
+   private long oCount;
+
+   private long nCount;
+
+   private String methodName;
+
+   private String path = LoadSnapshotBean.class.getResource("/").getFile() +
+         "../../files/";
+
+   /**
+    * Constructor
+    */
+   public CompareSnapshotBean()
+   {
+   }
+
+   /**
+    * Constructor
+    * @param difftime The diff time
+    * @param oTime The old time
+    * @param nTime The new time
+    * @param diffCount The diff count
+    * @param oCount The old count
+    * @param nCount The new count
+    * @param methodName The method name
+    */
+   public CompareSnapshotBean(String difftime,
+                              String oTime,
+                              String nTime,
+                              long diffCount,
+                              long oCount,
+                              long nCount,
+                              String methodName)
+   {
+      this.difftime = difftime;
+      this.oTime = oTime;
+      this.nTime = nTime;
+      this.diffCount = diffCount;
+      this.oCount = oCount;
+      this.nCount = nCount;
+      this.methodName = methodName;
+   }
+
+   /**
+    * Get the diff time
+    * @return The value
+    */
+   public String getDifftime()
+   {
+      return difftime;
+   }
+
+   /**
+    * Set the diff time
+    * @param difftime The value
+    */
+   public void setDifftime(String difftime)
+   {
+      this.difftime = difftime;
+   }
+
+   /**
+    * Get the old time
+    * @return The value
+    */
+   public String getOTime()
+   {
+      return oTime;
+   }
+
+   /**
+    * Set the old time
+    * @param time The value
+    */
+   public void setOTime(String time)
+   {
+      oTime = time;
+   }
+
+   /**
+    * Get the new time
+    * @return The value
+    */
+   public String getNTime()
+   {
+      return nTime;
+   }
+
+   /**
+    * Set the new time
+    * @param time The value
+    */
+   public void setNTime(String time)
+   {
+      nTime = time;
+   }
+
+   /**
+    * Get the diff count
+    * @return The value
+    */
+   public long getDiffCount()
+   {
+      return diffCount;
+   }
+
+   /**
+    * Set the diff count
+    * @param diffCount The value
+    */
+   public void setDiffCount(long diffCount)
+   {
+      this.diffCount = diffCount;
+   }
+
+   /**
+    * Get the old count
+    * @return The value
+    */
+   public long getOCount()
+   {
+      return oCount;
+   }
+
+   /**
+    * Set the old count
+    * @param count The value
+    */
+   public void setOCount(long count)
+   {
+      oCount = count;
+   }
+
+   /**
+    * Get the new count
+    * @return The value
+    */
+   public long getNCount()
+   {
+      return nCount;
+   }
+
+   /**
+    * Set the new count
+    * @param count The value
+    */
+   public void setNCount(long count)
+   {
+      nCount = count;
+   }
+
+   /**
+    * Get the method name
+    * @return The value
+    */
+   public String getMethodName()
+   {
+      return methodName;
+   }
+
+   /**
+    * Set the method name
+    * @param methodName The value
+    */
+   public void setMethodName(String methodName)
+   {
+      this.methodName = methodName;
+   }
+
+   /**
+    * Get the compare snapshot beans
+    * @return The value
+    */
+   public CompareSnapshotBean[] getCompareSnapshotBeans()
+   {
+      return compareSnapshotBeans;
+   }
+
+   /**
+    * Get the snapshot to compare
+    * @return The value
+    */
+   public String[] getSnapshotsToCompare()
+   {
+      return snapshotsToCompare;
+   }
+
+   /**
+    * Set the snapshot to compare
+    * @param snapshotsToCompare The value
+    */
+   public void setSnapshotsToCompare(String[] snapshotsToCompare)
+   {
+      this.snapshotsToCompare = snapshotsToCompare;
+   }
+
+   /**
+    * Get the files
+    * @return The value
+    */
+   public List<SelectItem> getJPSs()
+   {
+      List<SelectItem> allSelectItems = null;
+      File tempFile = new File(path);
+      String[] fileStr = tempFile.list();
+      List<String> jpsFiles = new ArrayList<String>();
+      allSelectItems = new ArrayList<SelectItem>();
+      for (int i = 0; i < fileStr.length; i++)
+      {
+         if (fileStr[i].endsWith("jps"))
+         {
+            jpsFiles.add(fileStr[i]);
+            allSelectItems.add(new SelectItem(fileStr[i]));
+         }
       }
-    }
-    return allSelectItems;
-  }
-        
-  /**
-   * Analyze action
-   * @exception Exception If an error occurs
-   */
-  public void analyzeAction() throws Exception {
-    File file1 = new File(path + this.snapshotsToCompare[0]);
-    File file2 = new File(path + this.snapshotsToCompare[1]);
-                
-    try {
-      Snapshot os = SnapshotHelper.load(file1);
-      Snapshot ns = SnapshotHelper.load(file2);
-      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-      Map<String, List<CombinedFrameInfo>> oInfo = su.getInformation(os);
-      Map<String, List<CombinedFrameInfo>> nInfo = su.getInformation(ns);
-      compareSnapshotBeans = this.compareMethods(oInfo, nInfo);
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
+      return allSelectItems;
+   }
 
-  /**
-   * Compare methods
-   * @param oInfo The old info
-   * @param nInfo The new info
-   * @return The compare snapshot beans
-   * @exception Exception If an error occurs
-   */
-  private CompareSnapshotBean[] compareMethods(Map<String, List<CombinedFrameInfo>> oInfo, 
-                                               Map<String, List<CombinedFrameInfo>> nInfo) throws Exception {
+   /**
+    * Analyze action
+    * @exception Exception If an error occurs
+    */
+   public void analyzeAction() throws Exception
+   {
+      File file1 = new File(path +
+            this.snapshotsToCompare[0]);
+      File file2 = new File(path +
+            this.snapshotsToCompare[1]);
 
-    List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
-    Map<String, CombinedFrameInfo> oMap = new HashMap<String, CombinedFrameInfo>();
-    Map<String, CombinedFrameInfo> nMap = new HashMap<String, CombinedFrameInfo>();
-    Map<String, CombinedFrameInfo> tMap = new HashMap<String, CombinedFrameInfo>();
-    Iterator it = oInfo.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      for (CombinedFrameInfo cfi : l) {
-        oMap.put(cfi.getPrettyName(), cfi);
-        tMap.put(cfi.getPrettyName(), cfi);
+      try
+      {
+         Snapshot os = SnapshotHelper.load(file1);
+         Snapshot ns = SnapshotHelper.load(file2);
+         SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+         Map<String, List<CombinedFrameInfo>> oInfo = su.getInformation(os);
+         Map<String, List<CombinedFrameInfo>> nInfo = su.getInformation(ns);
+         compareSnapshotBeans = this.compareMethods(oInfo, nInfo);
       }
-    }
-    
-    it = nInfo.values().iterator();
-    while (it.hasNext()) {
-      List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-      for (CombinedFrameInfo cfi : l) {
-        nMap.put(cfi.getPrettyName(), cfi);
+      catch (IOException e)
+      {
+         e.printStackTrace();
       }
-    }
-    
-    it = nMap.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
-      
-      double oTime = 0.0;
-      long oCount = 0;
-      if (oMap.containsKey(key)) {
-        CombinedFrameInfo oCfi = oMap.get(key);
-        oTime = oCfi.getTotalTime();
-        oCount = oCfi.getCount();
-        tMap.remove(key);
+   }
+
+   /**
+    * Compare methods
+    * @param oInfo The old info
+    * @param nInfo The new info
+    * @return The compare snapshot beans
+    * @exception Exception If an error occurs
+    */
+   private CompareSnapshotBean[] compareMethods(Map<String, List<CombinedFrameInfo>> oInfo,
+         Map<String, List<CombinedFrameInfo>> nInfo) throws Exception
+   {
+
+      List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> oMap = new HashMap<String, CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> nMap = new HashMap<String, CombinedFrameInfo>();
+      Map<String, CombinedFrameInfo> tMap = new HashMap<String, CombinedFrameInfo>();
+      Iterator it = oInfo.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         for (CombinedFrameInfo cfi : l)
+         {
+            oMap.put(cfi.getPrettyName(), cfi);
+            tMap.put(cfi.getPrettyName(), cfi);
+         }
       }
-      
-      CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
-      c.increaseTotalTime(cfi.getTotalTime() - oTime);
-      c.increaseCount(cfi.getCount() - oCount);
-      methods.add(c);
-    }
-    
-    it = tMap.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry)it.next();
-      String key = (String)entry.getKey();
-      CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
-      
-      CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
-      c.increaseTotalTime(-cfi.getTotalTime());
-      c.increaseCount(-cfi.getCount()); 
-      methods.add(c);
-    }
-    
-    Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
-    Collections.reverse(methods);
-    
-    DecimalFormat df = new DecimalFormat("#0.00");
-    this.compareSnapshotBeans = new CompareSnapshotBean[methods.size()];
-    for (int i = 0; i < methods.size(); i++) {
-      CombinedFrameInfo h = methods.get(i);
-      CombinedFrameInfo o = oMap.get(h.getPrettyName());
-      CombinedFrameInfo n = nMap.get(h.getPrettyName());
-      
-      double oTime = 0.0;
-      long oCount = 0;
-      if (o != null) {
-        oTime = o.getTotalTime();
-        oCount = o.getCount();
+
+      it = nInfo.values().iterator();
+      while (it.hasNext())
+      {
+         List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+         for (CombinedFrameInfo cfi : l)
+         {
+            nMap.put(cfi.getPrettyName(), cfi);
+         }
       }
-      
-      double nTime = 0.0;
-      long nCount = 0;
-      if (n != null) {
-        nTime = n.getTotalTime();
-        nCount = n.getCount();
+
+      it = nMap.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
+
+         double oTime = 0.0;
+         long oCount = 0;
+         if (oMap.containsKey(key))
+         {
+            CombinedFrameInfo oCfi = oMap.get(key);
+            oTime = oCfi.getTotalTime();
+            oCount = oCfi.getCount();
+            tMap.remove(key);
+         }
+
+         CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
+         c.increaseTotalTime(cfi.getTotalTime() -
+               oTime);
+         c.increaseCount(cfi.getCount() -
+               oCount);
+         methods.add(c);
       }
-      
-      compareSnapshotBeans[i] = new CompareSnapshotBean(df.format(h.getTotalTime()),
-                                                        df.format(oTime),
-                                                        df.format(nTime),
-                                                        h.getCount(),
-                                                        oCount,
-                                                        nCount,
-                                                        h.getPrettyName());
-    }
-    
-    return compareSnapshotBeans;
-  }
+
+      it = tMap.entrySet().iterator();
+      while (it.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)it.next();
+         String key = (String)entry.getKey();
+         CombinedFrameInfo cfi = (CombinedFrameInfo)entry.getValue();
+
+         CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
+         c.increaseTotalTime(-cfi.getTotalTime());
+         c.increaseCount(-cfi.getCount());
+         methods.add(c);
+      }
+
+      Collections.sort(methods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      Collections.reverse(methods);
+
+      DecimalFormat df = new DecimalFormat("#0.00");
+      this.compareSnapshotBeans = new CompareSnapshotBean[methods.size()];
+      for (int i = 0; i < methods.size(); i++)
+      {
+         CombinedFrameInfo h = methods.get(i);
+         CombinedFrameInfo o = oMap.get(h.getPrettyName());
+         CombinedFrameInfo n = nMap.get(h.getPrettyName());
+
+         double oTime = 0.0;
+         long oCount = 0;
+         if (o != null)
+         {
+            oTime = o.getTotalTime();
+            oCount = o.getCount();
+         }
+
+         double nTime = 0.0;
+         long nCount = 0;
+         if (n != null)
+         {
+            nTime = n.getTotalTime();
+            nCount = n.getCount();
+         }
+
+         compareSnapshotBeans[i] =
+               new CompareSnapshotBean(df.format(h.getTotalTime()),
+                                       df.format(oTime),
+                                       df.format(nTime),
+                                       h.getCount(),
+                                       oCount,
+                                       nCount,
+                                       h.getPrettyName());
+      }
+
+      return compareSnapshotBeans;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,133 +34,154 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class DecorateFrameInfo implements Serializable {
-  private MethodRepository methodRepository;
-  private FrameInfo frameInfo;
-  private List<DecorateFrameInfo> children;
-  private String pbar;
-  private long alltime = 0;
-  
-  /**
-   * Constructor
-   * @param frameInfo The frame info
-   * @param methodRepository The method repository
-   */
-  public DecorateFrameInfo(FrameInfo frameInfo, MethodRepository methodRepository) {
-    this.frameInfo = frameInfo;
-    this.methodRepository = methodRepository;
-    alltime = frameInfo.getTotalTime();
-  }
+public class DecorateFrameInfo implements Serializable
+{
+   private MethodRepository methodRepository;
 
-  /**
-   * Get percent bar
-   * @return The image
-   */
-  public String getPbar() {
-    if (pbar == null) {
-      long i = frameInfo.getTotalTime() * 100 / alltime;
-      if (i > 100)
-        i = 100;
-      pbar = i + ".png";
-    }
-    return pbar;
-  }
+   private FrameInfo frameInfo;
 
-  /**
-   * Set percent bar
-   * @param pbar The image
-   */
-  public void setPbar(String pbar) {
-    this.pbar = pbar;
-  }
+   private List<DecorateFrameInfo> children;
 
-  /**
-   * Get all time
-   * @return The value
-   */
-  public long getAlltime() {
-    return alltime;
-  }
+   private String pbar;
 
-  /**
-   * Set all time
-   * @param alltime The value
-   */
-  public void setAlltime(long alltime) {
-    this.alltime = alltime;
-  }
+   private long alltime = 0;
 
-  /**
-   * Get the method repository
-   * @return The value
-   */
-  public MethodRepository getMethodRepository() {
-    return methodRepository;
-  }
+   /**
+    * Constructor
+    * @param frameInfo The frame info
+    * @param methodRepository The method repository
+    */
+   public DecorateFrameInfo(FrameInfo frameInfo, MethodRepository methodRepository)
+   {
+      this.frameInfo = frameInfo;
+      this.methodRepository = methodRepository;
+      alltime = frameInfo.getTotalTime();
+   }
 
-  /**
-   * Set the method repository
-   * @param methodRepository The value
-   */
-  public void setMethodRepository(MethodRepository methodRepository) {
-    this.methodRepository = methodRepository;
-  }
+   /**
+    * Get percent bar
+    * @return The image
+    */
+   public String getPbar()
+   {
+      if (pbar == null)
+      {
+         long i = frameInfo.getTotalTime() *
+               100 / alltime;
+         if (i > 100)
+            i = 100;
+         pbar = i +
+               ".png";
+      }
+      return pbar;
+   }
 
-  /**
-   * Get the frame info
-   * @return The value
-   */
-  public FrameInfo getFrameInfo() {
-    return frameInfo;
-  }
+   /**
+    * Set percent bar
+    * @param pbar The image
+    */
+   public void setPbar(String pbar)
+   {
+      this.pbar = pbar;
+   }
 
-  /**
-   * Set the frame info
-   * @param frameInfo The value
-   */
-  public void setFrameInfo(FrameInfo frameInfo) {
-    this.frameInfo = frameInfo;
-  }
+   /**
+    * Get all time
+    * @return The value
+    */
+   public long getAlltime()
+   {
+      return alltime;
+   }
 
-  /**
-   * Get the children
-   * @return The value
-   */
-  public List<DecorateFrameInfo> getChildren() {
-    if (children == null) {
-      List<FrameInfo> frames = frameInfo.getChildren();
-      if (frames == null)
-        return null;
-      children = new ArrayList<DecorateFrameInfo>();
-      for (FrameInfo frame : frames) {
-        DecorateFrameInfo dframeInfo = new DecorateFrameInfo(frame,
-                                                             methodRepository);
-        dframeInfo.alltime = alltime;
-        children.add(dframeInfo);
+   /**
+    * Set all time
+    * @param alltime The value
+    */
+   public void setAlltime(long alltime)
+   {
+      this.alltime = alltime;
+   }
+
+   /**
+    * Get the method repository
+    * @return The value
+    */
+   public MethodRepository getMethodRepository()
+   {
+      return methodRepository;
+   }
+
+   /**
+    * Set the method repository
+    * @param methodRepository The value
+    */
+   public void setMethodRepository(MethodRepository methodRepository)
+   {
+      this.methodRepository = methodRepository;
+   }
+
+   /**
+    * Get the frame info
+    * @return The value
+    */
+   public FrameInfo getFrameInfo()
+   {
+      return frameInfo;
+   }
+
+   /**
+    * Set the frame info
+    * @param frameInfo The value
+    */
+   public void setFrameInfo(FrameInfo frameInfo)
+   {
+      this.frameInfo = frameInfo;
+   }
+
+   /**
+    * Get the children
+    * @return The value
+    */
+   public List<DecorateFrameInfo> getChildren()
+   {
+      if (children == null)
+      {
+         List<FrameInfo> frames = frameInfo.getChildren();
+         if (frames == null)
+            return null;
+         children = new ArrayList<DecorateFrameInfo>();
+         for (FrameInfo frame : frames)
+         {
+            DecorateFrameInfo dframeInfo = new DecorateFrameInfo(frame, methodRepository);
+            dframeInfo.alltime = alltime;
+            children.add(dframeInfo);
+         }
       }
-    }
-    return children;
-  }
+      return children;
+   }
 
-  /**
-   * Get the method
-   * @return The value
-   */
-  public String getMethod() {
-    return methodRepository.getInfo(frameInfo.getMethod()).getMethodName();
-  }
-  
-  /**
-   * String representation
-   * @return The value
-   */
-  @Override
-  public String toString() {
-    MethodInfo minfo = methodRepository.getInfo(frameInfo.getMethod());
-    DecimalFormat df = new DecimalFormat("#0.00");
-    long total = frameInfo.getTotalTime();
-    return df.format(Math.toPercent(total, alltime)) + "% - "
-      + df.format(Math.nanoToMilli(total)) + " ms - "
-      + frameInfo.getCount() + " inv. - " + minfo.getMethodName();
-  }
+   /**
+    * Get the method
+    * @return The value
+    */
+   public String getMethod()
+   {
+      return methodRepository.getInfo(frameInfo.getMethod()).getMethodName();
+   }
+
+   /**
+    * String representation
+    * @return The value
+    */
+   @Override
+   public String toString()
+   {
+      MethodInfo minfo = methodRepository.getInfo(frameInfo.getMethod());
+      DecimalFormat df = new DecimalFormat("#0.00");
+      long total = frameInfo.getTotalTime();
+      return df.format(Math.toPercent(total, alltime)) +
+            "% - " + df.format(Math.nanoToMilli(total)) + " ms - " + frameInfo.getCount() + " inv. - " +
+            minfo.getMethodName();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -35,91 +35,109 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class LoadSnapshotBean implements Serializable {
-  private String snapshotToLoad;        
-  private static Snapshot snapshot = null;
-        
-  private String threshold = "1.0";
-  private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
+public class LoadSnapshotBean implements Serializable
+{
+   private String snapshotToLoad;
 
-  /**
-   * Get the snapshot
-   * @return The value
-   */
-  public static Snapshot getSnapshot() {
-    return snapshot;
-  }
-  
-  /**
-   * Set the snapshot
-   * @param snapshot The value
-   */
-  public static void setSnapshot(Snapshot snapshot) {
-    LoadSnapshotBean.snapshot = snapshot;
-  }
-        
-  /**
-   * Get the threshold
-   * @return The value
-   */
-  public String getThreshold() {
-    return threshold;
-  }
-        
-  /**
-   * Set the threshold
-   * @param threshold The value
-   */
-  public void setThreshold(String threshold) {
-    this.threshold = threshold;
-  }
-  
-  /**
-   * Get the threshold to load
-   * @return The value
-   */
-  public String getSnapshotToLoad() {
-    return snapshotToLoad;
-  }
-  
-  /**
-   * Set the threshold to load
-   * @param snapshotToLoad The value
-   */
-  public void setSnapshotToLoad(String snapshotToLoad) {
-    this.snapshotToLoad = snapshotToLoad;
-  }
+   private static Snapshot snapshot = null;
 
-  /**
-   * Get the files
-   * @return The value
-   */
-  public List<SelectItem> getJPSs() {
-    List<SelectItem> allSelectItems = null;
-    File tempFile = new File(path);
-    String[] fileStr = tempFile.list();
-    List<String> jpsFiles = new ArrayList<String>();
-    allSelectItems = new ArrayList<SelectItem>();
-    for (int i = 0; i < fileStr.length; i++) {
-      if (fileStr[i].endsWith("jps")) {
-        jpsFiles.add(fileStr[i]);
-        allSelectItems.add(new SelectItem(fileStr[i]));
+   private String threshold = "1.0";
+
+   private String path = LoadSnapshotBean.class.getResource("/").getFile() +
+         "../../files/";
+
+   /**
+    * Get the snapshot
+    * @return The value
+    */
+   public static Snapshot getSnapshot()
+   {
+      return snapshot;
+   }
+
+   /**
+    * Set the snapshot
+    * @param snapshot The value
+    */
+   public static void setSnapshot(Snapshot snapshot)
+   {
+      LoadSnapshotBean.snapshot = snapshot;
+   }
+
+   /**
+    * Get the threshold
+    * @return The value
+    */
+   public String getThreshold()
+   {
+      return threshold;
+   }
+
+   /**
+    * Set the threshold
+    * @param threshold The value
+    */
+   public void setThreshold(String threshold)
+   {
+      this.threshold = threshold;
+   }
+
+   /**
+    * Get the threshold to load
+    * @return The value
+    */
+   public String getSnapshotToLoad()
+   {
+      return snapshotToLoad;
+   }
+
+   /**
+    * Set the threshold to load
+    * @param snapshotToLoad The value
+    */
+   public void setSnapshotToLoad(String snapshotToLoad)
+   {
+      this.snapshotToLoad = snapshotToLoad;
+   }
+
+   /**
+    * Get the files
+    * @return The value
+    */
+   public List<SelectItem> getJPSs()
+   {
+      List<SelectItem> allSelectItems = null;
+      File tempFile = new File(path);
+      String[] fileStr = tempFile.list();
+      List<String> jpsFiles = new ArrayList<String>();
+      allSelectItems = new ArrayList<SelectItem>();
+      for (int i = 0; i < fileStr.length; i++)
+      {
+         if (fileStr[i].endsWith("jps"))
+         {
+            jpsFiles.add(fileStr[i]);
+            allSelectItems.add(new SelectItem(fileStr[i]));
+         }
       }
-    }
-    return allSelectItems;
-  }
-  
-  /**
-   * Analyze action
-   */
-  public void analyzeAction() {
-    File file = new File(path + this.snapshotToLoad);
-    Snapshot snapshot;
-    try {
-      snapshot = SnapshotHelper.load(file);
-      LoadSnapshotBean.setSnapshot(snapshot);
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
+      return allSelectItems;
+   }
+
+   /**
+    * Analyze action
+    */
+   public void analyzeAction()
+   {
+      File file = new File(path +
+            this.snapshotToLoad);
+      Snapshot snapshot;
+      try
+      {
+         snapshot = SnapshotHelper.load(file);
+         LoadSnapshotBean.setSnapshot(snapshot);
+      }
+      catch (IOException e)
+      {
+         e.printStackTrace();
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,201 +34,231 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class MethodBean implements Serializable {
-  private long count;
-  private String totalTime;
-  private String cPercent;
-  private String tPercent;
-  private String prettyName;
-  
-  private MethodBean[] methods = null;
-  
-  //the class info in which the methods will be shown.
-  private static TimedClassInfo tci;
-  private static List<CombinedFrameInfo> cfs;
-  private int methodUnderThreshCount;
+public class MethodBean implements Serializable
+{
+   private long count;
 
-  /**
-   * Constructor
-   */
-  public MethodBean() {
-  }
-  
-  /**
-   * Constructor
-   * @param count The count
-   * @param totalTime total time
-   * @param cPercent The class percent
-   * @param tPercent The total percent
-   * @param prettyName The pretty name
-   */
-  public MethodBean(long count, String totalTime, String cPercent,
-                    String tPercent, String prettyName) {
-    this.count = count;
-    this.totalTime = totalTime;
-    this.cPercent = cPercent;
-    this.tPercent = tPercent;
-    this.prettyName = prettyName;
-  }
-  
-  /**
-   * Get the count
-   * @return The value
-   */
-  public long getCount() {
-    return count;
-  }
-  
-  /**
-   * Set the count
-   * @param count The value
-   */
-  public void setCount(long count) {
-    this.count = count;
-  }
-  
-  /**
-   * Get the methods under treshold count
-   * @return The value
-   */
-  public int getMethodUnderThreshCount() {
-    return methodUnderThreshCount;
-  }
-  
-  /**
-   * Set the methods under treshold count
-   * @param methodUnderThreshCount The value
-   */
-  public void setMethodUnderThreshCount(int methodUnderThreshCount) {
-    this.methodUnderThreshCount = methodUnderThreshCount;
-  }
-  
-  /**
-   * Get the total
-   * @return The value
-   */
-  public String getTotalTime() {
-    return totalTime;
-  }
-  
-  /**
-   * Set the total time
-   * @param totalTime The value
-   */
-  public void setTotalTime(String totalTime) {
-    this.totalTime = totalTime;
-  }
-  
-  /**
-   * Get the class percent
-   * @return The value
-   */
-  public String getCPercent() {
-    return cPercent;
-  }
-  
-  /**
-   * Set the class percent
-   * @param percent The value
-   */
-  public void setCPercent(String percent) {
-    cPercent = percent;
-  }
-  
-  /**
-   * Get the total percent
-   * @return The value
-   */
-  public String getTPercent() {
-    return tPercent; 
-  }
-  
-  /**
-   * Set the total percent
-   * @param percent The value
-   */
-  public void setTPercent(String percent) {
-    tPercent = percent;
-  }
-  
-  /**
-   * Get the pretty name
-   * @return The value
-   */
-  public String getPrettyName() {
-    return prettyName;
-  }
-  
-  /**
-   * Set the pretty name
-   * @param prettyName The value
-   */
-  public void setPrettyName(String prettyName) {
-    this.prettyName = prettyName;
-  }
+   private String totalTime;
 
-  /**
-   * Get the timed class info
-   * @return The value
-   */
-  public static TimedClassInfo getTci() {
-    return tci;
-  }
-  
-  /**
-   * Set the timed class info
-   * @param tci The value
-   */
-  public static void setTci(TimedClassInfo tci) {
-    MethodBean.tci = tci;
-  }
-  
-  /**
-   * Get the combined frame info
-   * @return The value
-   */
-  public static List<CombinedFrameInfo> getCfs() {
-    return cfs;
-  }
-  
-  /**
-   * Set the combined frame info
-   * @param cfs The value
-   */
-  public static void setCfs(List<CombinedFrameInfo> cfs) {
-    MethodBean.cfs = cfs;
-  }
-  
-  /**
-   * Set methods
-   */
-  public void setMethods() {
-    methodUnderThreshCount = 0;
-    if (cfs != null) {
-      DecimalFormat df = new DecimalFormat("#0.00");
-      Collections.sort(cfs, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
-      int j = 0;
-      methods = new MethodBean[cfs.size()];
-      for (CombinedFrameInfo cfi : cfs) {
-        methods[j++] = new MethodBean(cfi.getCount(),
-                                      df.format(cfi.getTotalTime()),
-                                      df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())),
-                                      df.format(cfi.getPercent()),
-                                      cfi.getPrettyName());
-        if (cfi.getTotalTime() < BasicOptBean.getDigThreshold()) {
-          methodUnderThreshCount++;
-        }
+   private String cPercent;
+
+   private String tPercent;
+
+   private String prettyName;
+
+   private MethodBean[] methods = null;
+
+   // the class info in which the methods will be shown.
+   private static TimedClassInfo tci;
+
+   private static List<CombinedFrameInfo> cfs;
+
+   private int methodUnderThreshCount;
+
+   /**
+    * Constructor
+    */
+   public MethodBean()
+   {
+   }
+
+   /**
+    * Constructor
+    * @param count The count
+    * @param totalTime total time
+    * @param cPercent The class percent
+    * @param tPercent The total percent
+    * @param prettyName The pretty name
+    */
+   public MethodBean(long count, String totalTime, String cPercent, String tPercent, String prettyName)
+   {
+      this.count = count;
+      this.totalTime = totalTime;
+      this.cPercent = cPercent;
+      this.tPercent = tPercent;
+      this.prettyName = prettyName;
+   }
+
+   /**
+    * Get the count
+    * @return The value
+    */
+   public long getCount()
+   {
+      return count;
+   }
+
+   /**
+    * Set the count
+    * @param count The value
+    */
+   public void setCount(long count)
+   {
+      this.count = count;
+   }
+
+   /**
+    * Get the methods under treshold count
+    * @return The value
+    */
+   public int getMethodUnderThreshCount()
+   {
+      return methodUnderThreshCount;
+   }
+
+   /**
+    * Set the methods under treshold count
+    * @param methodUnderThreshCount The value
+    */
+   public void setMethodUnderThreshCount(int methodUnderThreshCount)
+   {
+      this.methodUnderThreshCount = methodUnderThreshCount;
+   }
+
+   /**
+    * Get the total
+    * @return The value
+    */
+   public String getTotalTime()
+   {
+      return totalTime;
+   }
+
+   /**
+    * Set the total time
+    * @param totalTime The value
+    */
+   public void setTotalTime(String totalTime)
+   {
+      this.totalTime = totalTime;
+   }
+
+   /**
+    * Get the class percent
+    * @return The value
+    */
+   public String getCPercent()
+   {
+      return cPercent;
+   }
+
+   /**
+    * Set the class percent
+    * @param percent The value
+    */
+   public void setCPercent(String percent)
+   {
+      cPercent = percent;
+   }
+
+   /**
+    * Get the total percent
+    * @return The value
+    */
+   public String getTPercent()
+   {
+      return tPercent;
+   }
+
+   /**
+    * Set the total percent
+    * @param percent The value
+    */
+   public void setTPercent(String percent)
+   {
+      tPercent = percent;
+   }
+
+   /**
+    * Get the pretty name
+    * @return The value
+    */
+   public String getPrettyName()
+   {
+      return prettyName;
+   }
+
+   /**
+    * Set the pretty name
+    * @param prettyName The value
+    */
+   public void setPrettyName(String prettyName)
+   {
+      this.prettyName = prettyName;
+   }
+
+   /**
+    * Get the timed class info
+    * @return The value
+    */
+   public static TimedClassInfo getTci()
+   {
+      return tci;
+   }
+
+   /**
+    * Set the timed class info
+    * @param tci The value
+    */
+   public static void setTci(TimedClassInfo tci)
+   {
+      MethodBean.tci = tci;
+   }
+
+   /**
+    * Get the combined frame info
+    * @return The value
+    */
+   public static List<CombinedFrameInfo> getCfs()
+   {
+      return cfs;
+   }
+
+   /**
+    * Set the combined frame info
+    * @param cfs The value
+    */
+   public static void setCfs(List<CombinedFrameInfo> cfs)
+   {
+      MethodBean.cfs = cfs;
+   }
+
+   /**
+    * Set methods
+    */
+   public void setMethods()
+   {
+      methodUnderThreshCount = 0;
+      if (cfs != null)
+      {
+         DecimalFormat df = new DecimalFormat("#0.00");
+         Collections.sort(cfs, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+         int j = 0;
+         methods = new MethodBean[cfs.size()];
+         for (CombinedFrameInfo cfi : cfs)
+         {
+            methods[j++] =
+                  new MethodBean(cfi.getCount(),
+                                 df.format(cfi.getTotalTime()),
+                                 df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())),
+                                 df.format(cfi.getPercent()),
+                                 cfi.getPrettyName());
+            if (cfi.getTotalTime() < BasicOptBean.getDigThreshold())
+            {
+               methodUnderThreshCount++;
+            }
+         }
+         this.setMethodUnderThreshCount(methodUnderThreshCount);
       }
-      this.setMethodUnderThreshCount(methodUnderThreshCount);
-    }
-  }
+   }
 
-  /**
-   * Get the methods
-   * @return The value
-   */
-  public MethodBean[] getMethods() {
-    this.setMethods();
-    return this.methods;
-  }
+   /**
+    * Get the methods
+    * @return The value
+    */
+   public MethodBean[] getMethods()
+   {
+      this.setMethods();
+      return this.methods;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,7 +28,6 @@
 import org.jboss.profiler.client.TimedClassInfo;
 import org.jboss.profiler.shared.AllocationComparator;
 import org.jboss.profiler.shared.AllocationInfo;
-import org.jboss.profiler.shared.ClassInfo;
 import org.jboss.profiler.shared.ThreadComparator;
 import org.jboss.profiler.shared.ThreadInfo;
 
@@ -43,279 +42,333 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class OverviewBean implements Serializable {
-  private static final String[] TITLES = {
-    "Threads", "Most Time", "Hotspots", "Allocations", "Classes"
-  };
+public class OverviewBean implements Serializable
+{
+   private static final String[] TITLES = {"Threads", "Most Time", "Hotspots", "Allocations", "Classes"};
 
-  private String title;
-  private int packageUnderThreshCount;
-  private int hotspotsUnderThreshCount;
-  private int mosttimeUnderThreshCount;
-  private int waittimeUnderThreshCount;
-  
-  /**
-   * Get the title
-   * @return The title
-   */
-  public String getTitle() {
-    return title;
-  }
-  
-  /**
-   * Set the title
-   * @param title The title
-   */
-  public void setTitle(String title) {
-    this.title = title;
-  }
-  
-  /**
-   * Get the titles
-   * @return The titles
-   */
-  public String[] getTitles() {
-    return TITLES;
-  }
-  
-  /**
-   * Get the package under threshold count
-   * @return The number
-   */
-  public int getPackageUnderThreshCount() {
-    return packageUnderThreshCount;
-  }
-  
-  /**
-   * Set the package under threshold count
-   * @param packageUnderThreshCount The number
-   */
-  public void setPackageUnderThreshCount(int packageUnderThreshCount) {
-    this.packageUnderThreshCount = packageUnderThreshCount;
-  }
-  
-  /**
-   * Get the wait time under threshold count
-   * @return The number
-   */
-  public int getWaittimeUnderThreshCount() {
-    return waittimeUnderThreshCount;
-  }
-  
-  /**
-   * Set the wait time under threshold count
-   * @param waittimeUnderThreshCount The number
-   */
-  public void setWaittimeUnderThreshCount(int waittimeUnderThreshCount) {
-    this.waittimeUnderThreshCount = waittimeUnderThreshCount;
-  }
-  
-  /**
-   * Get the allocations
-   * @return The allocations
-   */
-  public List<AllocationInfo> getAllocations() {
-    List<AllocationInfo> allocationList = null;
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      Collections.sort(LoadSnapshotBean.getSnapshot().getAllocations(), new AllocationComparator());
-      allocationList = LoadSnapshotBean.getSnapshot().getAllocations();
-    }
-    return allocationList;
-  }
-  
-  /**
-   * Get the hotspot under threshold count
-   * @return The number
-   */
-  public int getHotspotsUnderThreshCount() {
-    return hotspotsUnderThreshCount;
-  }
-  
-  /**
-   * Set the hotspot under threshold count
-   * @param hotspotsUnderThreshCount The number
-   */
-  public void setHotspotsUnderThreshCount(int hotspotsUnderThreshCount) {
-    this.hotspotsUnderThreshCount = hotspotsUnderThreshCount;
-  }
-  
-  /**
-   * Get the most time under threshold count
-   * @return The number
-   */
-  public int getMosttimeUnderThreshCount() {
-    return mosttimeUnderThreshCount;
-  }
-  
-  /**
-   * Set the most time under threshold count
-   * @param mosttimeUnderThreshCount The number
-   */
-  public void setMosttimeUnderThreshCount(int mosttimeUnderThreshCount) {
-    this.mosttimeUnderThreshCount = mosttimeUnderThreshCount;
-  }
-  
-  /**
-   * Get the hotspots
-   * @return The hotspots
-   */
-  public List<CombinedFrameInfo> getHotspots() {
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-      Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
-      List<CombinedFrameInfo> hotspotsInfo = new ArrayList<CombinedFrameInfo>();
-      Iterator it = info.values().iterator();
-      while (it.hasNext()) {
-        List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-        hotspotsInfo.addAll(l);
+   private String title;
+
+   private int packageUnderThreshCount;
+
+   private int hotspotsUnderThreshCount;
+
+   private int mosttimeUnderThreshCount;
+
+   private int waittimeUnderThreshCount;
+
+   /**
+    * Get the title
+    * @return The title
+    */
+   public String getTitle()
+   {
+      return title;
+   }
+
+   /**
+    * Set the title
+    * @param title The title
+    */
+   public void setTitle(String title)
+   {
+      this.title = title;
+   }
+
+   /**
+    * Get the titles
+    * @return The titles
+    */
+   public String[] getTitles()
+   {
+      return TITLES;
+   }
+
+   /**
+    * Get the package under threshold count
+    * @return The number
+    */
+   public int getPackageUnderThreshCount()
+   {
+      return packageUnderThreshCount;
+   }
+
+   /**
+    * Set the package under threshold count
+    * @param packageUnderThreshCount The number
+    */
+   public void setPackageUnderThreshCount(int packageUnderThreshCount)
+   {
+      this.packageUnderThreshCount = packageUnderThreshCount;
+   }
+
+   /**
+    * Get the wait time under threshold count
+    * @return The number
+    */
+   public int getWaittimeUnderThreshCount()
+   {
+      return waittimeUnderThreshCount;
+   }
+
+   /**
+    * Set the wait time under threshold count
+    * @param waittimeUnderThreshCount The number
+    */
+   public void setWaittimeUnderThreshCount(int waittimeUnderThreshCount)
+   {
+      this.waittimeUnderThreshCount = waittimeUnderThreshCount;
+   }
+
+   /**
+    * Get the allocations
+    * @return The allocations
+    */
+   public List<AllocationInfo> getAllocations()
+   {
+      List<AllocationInfo> allocationList = null;
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         Collections.sort(LoadSnapshotBean.getSnapshot().getAllocations(), new AllocationComparator());
+         allocationList = LoadSnapshotBean.getSnapshot().getAllocations();
       }
-      Collections.sort(hotspotsInfo, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
-      //build new array list above threshold
-      List<CombinedFrameInfo> thresholdHotspots = new ArrayList<CombinedFrameInfo>();
-      it = hotspotsInfo.iterator();
-      while (it.hasNext()) {
-        CombinedFrameInfo tempCFI = (CombinedFrameInfo) it.next();
-        if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
-          thresholdHotspots.add(tempCFI);
-        }
+      return allocationList;
+   }
+
+   /**
+    * Get the hotspot under threshold count
+    * @return The number
+    */
+   public int getHotspotsUnderThreshCount()
+   {
+      return hotspotsUnderThreshCount;
+   }
+
+   /**
+    * Set the hotspot under threshold count
+    * @param hotspotsUnderThreshCount The number
+    */
+   public void setHotspotsUnderThreshCount(int hotspotsUnderThreshCount)
+   {
+      this.hotspotsUnderThreshCount = hotspotsUnderThreshCount;
+   }
+
+   /**
+    * Get the most time under threshold count
+    * @return The number
+    */
+   public int getMosttimeUnderThreshCount()
+   {
+      return mosttimeUnderThreshCount;
+   }
+
+   /**
+    * Set the most time under threshold count
+    * @param mosttimeUnderThreshCount The number
+    */
+   public void setMosttimeUnderThreshCount(int mosttimeUnderThreshCount)
+   {
+      this.mosttimeUnderThreshCount = mosttimeUnderThreshCount;
+   }
+
+   /**
+    * Get the hotspots
+    * @return The hotspots
+    */
+   public List<CombinedFrameInfo> getHotspots()
+   {
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+         Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+         List<CombinedFrameInfo> hotspotsInfo = new ArrayList<CombinedFrameInfo>();
+         Iterator it = info.values().iterator();
+         while (it.hasNext())
+         {
+            List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+            hotspotsInfo.addAll(l);
+         }
+         Collections.sort(hotspotsInfo, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
+         // build new array list above threshold
+         List<CombinedFrameInfo> thresholdHotspots = new ArrayList<CombinedFrameInfo>();
+         it = hotspotsInfo.iterator();
+         while (it.hasNext())
+         {
+            CombinedFrameInfo tempCFI = (CombinedFrameInfo)it.next();
+            if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold())
+            {
+               thresholdHotspots.add(tempCFI);
+            }
+         }
+
+         this.hotspotsUnderThreshCount = hotspotsInfo.size() -
+               thresholdHotspots.size();
+         if (thresholdHotspots.isEmpty())
+         {
+            return null;
+         }
+         else
+         {
+            return thresholdHotspots;
+         }
       }
-      
-      this.hotspotsUnderThreshCount = hotspotsInfo.size() - thresholdHotspots.size();
-      if (thresholdHotspots.isEmpty()) {
-        return null;
-      } else {
-        return thresholdHotspots;
+      return null;
+   }
+
+   /**
+    * Get the most time
+    * @return The most time
+    */
+   public List<CombinedFrameInfo> getMostTime()
+   {
+      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+         List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+         List<CombinedFrameInfo> allMethods = new ArrayList<CombinedFrameInfo>();
+         Iterator it = info.values().iterator();
+         while (it.hasNext())
+         {
+            List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
+            allMethods.addAll(l);
+         }
+
+         Collections.sort(allMethods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+         // build new array list above threshold
+         List<CombinedFrameInfo> thresholdMostTime = new ArrayList<CombinedFrameInfo>();
+         it = allMethods.iterator();
+         while (it.hasNext())
+         {
+            CombinedFrameInfo tempCFI = (CombinedFrameInfo)it.next();
+            if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold())
+            {
+               thresholdMostTime.add(tempCFI);
+            }
+         }
+         this.mosttimeUnderThreshCount = allMethods.size() -
+               thresholdMostTime.size();
+         if (thresholdMostTime.isEmpty())
+         {
+            return null;
+         }
+         else
+         {
+            return thresholdMostTime;
+         }
       }
-    }
-    return null;
-  }
-  
-  /**
-   * Get the most time
-   * @return The most time
-   */
-  public List<CombinedFrameInfo> getMostTime() {
-    SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
-      List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
-      List<CombinedFrameInfo> allMethods = new ArrayList<CombinedFrameInfo>();
-      Iterator it = info.values().iterator();
-      while (it.hasNext()) {
-        List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
-        allMethods.addAll(l);
+      return null;
+   }
+
+   /**
+    * Get the threads
+    * @return The threads
+    */
+   public List<ThreadInfo> getThreads()
+   {
+      List<ThreadInfo> threads = null;
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         Collections.sort(LoadSnapshotBean.getSnapshot().getThreads(), new ThreadComparator());
+         threads = LoadSnapshotBean.getSnapshot().getThreads();
+         return threads;
       }
-      
-      Collections.sort(allMethods, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
-      //build new array list above threshold
-      List<CombinedFrameInfo> thresholdMostTime = new ArrayList<CombinedFrameInfo>();
-      it = allMethods.iterator();
-      while (it.hasNext()) {
-        CombinedFrameInfo tempCFI = (CombinedFrameInfo)it.next();
-        if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
-          thresholdMostTime.add(tempCFI);
-        }
-      }
-      this.mosttimeUnderThreshCount = allMethods.size() - thresholdMostTime.size();
-      if (thresholdMostTime.isEmpty()) {
-        return null;
-      } else {
-        return thresholdMostTime;
-      }
-    }
-    return null;
-  }
-  
-  /**
-   * Get the threads
-   * @return The threads
-   */
-  public List<ThreadInfo> getThreads() {
-    List<ThreadInfo> threads = null;
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      Collections.sort(LoadSnapshotBean.getSnapshot().getThreads(), new ThreadComparator());
-      threads = LoadSnapshotBean.getSnapshot().getThreads();
-      return threads;
-    }
-    return null;
-  }
-  
-  /**
-   * Get the packages
-   * @return The packages
-   */
-  public List<CombinedFrameInfo> getPackages() {
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-      Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
-      List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
-      Map<String, CombinedFrameInfo> packages = new HashMap<String, CombinedFrameInfo>();
-      Iterator it = info.entrySet().iterator();
-      while (it.hasNext()) {
-        Map.Entry entry = (Map.Entry)it.next();
-        String key = (String)entry.getKey();
-        List<CombinedFrameInfo> value = (List<CombinedFrameInfo>)entry.getValue();
-        for (CombinedFrameInfo cfi : value) {
-          if (cfi.getTotalTime() > BasicOptBean.getDigThreshold()) {
-            String cn = cfi.getClassName();
-            cn = cn.replace('/', '.');
-            if (cn.lastIndexOf(".") != -1) {
-              cn = cn.substring(0, cn.lastIndexOf("."));
+      return null;
+   }
+
+   /**
+    * Get the packages
+    * @return The packages
+    */
+   public List<CombinedFrameInfo> getPackages()
+   {
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+         Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+         List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+         Map<String, CombinedFrameInfo> packages = new HashMap<String, CombinedFrameInfo>();
+         Iterator it = info.entrySet().iterator();
+         while (it.hasNext())
+         {
+            Map.Entry entry = (Map.Entry)it.next();
+            String key = (String)entry.getKey();
+            List<CombinedFrameInfo> value = (List<CombinedFrameInfo>)entry.getValue();
+            for (CombinedFrameInfo cfi : value)
+            {
+               if (cfi.getTotalTime() > BasicOptBean.getDigThreshold())
+               {
+                  String cn = cfi.getClassName();
+                  cn = cn.replace('/', '.');
+                  if (cn.lastIndexOf(".") != -1)
+                  {
+                     cn = cn.substring(0, cn.lastIndexOf("."));
+                  }
+                  CombinedFrameInfo ci = packages.get(cn);
+                  if (ci == null)
+                  {
+                     ci = new CombinedFrameInfo(cn, cn);
+                  }
+                  ci.increaseTotalTime(cfi.getTotalTime());
+                  ci.increasePercent(cfi.getPercent());
+                  packages.put(cn, ci);
+               }
             }
-            CombinedFrameInfo ci = packages.get(cn);
-            if (ci == null) {
-              ci = new CombinedFrameInfo(cn, cn);
+         }
+         List<CombinedFrameInfo> result = new ArrayList<CombinedFrameInfo>(packages.values());
+         Collections.sort(result, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+         // build new array list above threshold
+         List<CombinedFrameInfo> thresholdPackages = new ArrayList<CombinedFrameInfo>();
+         it = result.iterator();
+         while (it.hasNext())
+         {
+            CombinedFrameInfo tempCFI = (CombinedFrameInfo)it.next();
+            if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold())
+            {
+               thresholdPackages.add(tempCFI);
             }
-            ci.increaseTotalTime(cfi.getTotalTime());
-            ci.increasePercent(cfi.getPercent());
-            packages.put(cn, ci);
-          }
-        }
+         }
+         this.packageUnderThreshCount = result.size() -
+               thresholdPackages.size();
+
+         if (thresholdPackages.isEmpty())
+         {
+            return null;
+         }
+         else
+         {
+            return thresholdPackages;
+         }
       }
-      List<CombinedFrameInfo> result = new ArrayList<CombinedFrameInfo>(packages.values());
-      Collections.sort(result, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
-      //build new array list above threshold
-      List<CombinedFrameInfo> thresholdPackages = new ArrayList<CombinedFrameInfo>();
-      it = result.iterator();
-      while (it.hasNext()) {
-        CombinedFrameInfo tempCFI = (CombinedFrameInfo) it.next();
-        if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
-          thresholdPackages.add(tempCFI);
-        }
+      return null;
+   }
+
+   /**
+    * Get the classes
+    * @return The classes
+    */
+   public List<TimedClassInfo> getClasses()
+   {
+      List<TimedClassInfo> thresholdClasses = new ArrayList<TimedClassInfo>();
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
+         Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+         List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+         Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
+
+         Iterator<TimedClassInfo> it = classes.iterator();
+         while (it.hasNext())
+         {
+            TimedClassInfo tempTCI = it.next();
+            if (tempTCI.getWaitTime() >= BasicOptBean.getDigThreshold())
+            {
+               thresholdClasses.add(tempTCI);
+            }
+         }
+
+         this.waittimeUnderThreshCount = classes.size() -
+               thresholdClasses.size();
       }
-      this.packageUnderThreshCount = result.size() - thresholdPackages.size();
-      
-      if (thresholdPackages.isEmpty()) {
-        return null;
-      } else {
-        return thresholdPackages;
-      }
-    }
-    return null;
-  }
-  
-  /**
-   * Get the classes
-   * @return The classes
-   */
-  public List<TimedClassInfo> getClasses() {
-    List<TimedClassInfo> thresholdClasses = new ArrayList<TimedClassInfo>();
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
-      Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
-      List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
-      Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
-      
-      Iterator<TimedClassInfo> it = classes.iterator();
-      while (it.hasNext()) {
-        TimedClassInfo tempTCI = it.next();
-        if (tempTCI.getWaitTime() >= BasicOptBean.getDigThreshold()) {
-          thresholdClasses.add(tempTCI);
-        }
-      }
-      
-      this.waittimeUnderThreshCount = classes.size() - thresholdClasses.size();
-    }
-    return thresholdClasses;
-  }
+      return thresholdClasses;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,12 +29,10 @@
 import org.jboss.profiler.shared.MethodInfo;
 import org.jboss.profiler.shared.MethodRepository;
 import org.jboss.profiler.shared.ThreadInfo;
-import org.jboss.profiler.shared.ThreadInfoProxy;
 
 import java.io.Serializable;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -48,272 +46,314 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class ThreadHotspotBean implements Serializable {
-  private String selectItem = null;
-  private ThreadInfo selectThreadInfo = null;
-  private List<String> mainKeys;
-  private List<String> subKeys;
-  private List<CombinedFrameInfo> subValues;
-  private Map<String, CombinedFrameInfo> newMap;
+public class ThreadHotspotBean implements Serializable
+{
+   private String selectItem = null;
 
-  /**
-   * Constructor
-   */
-  public ThreadHotspotBean() {
-  }
-  
-  /**
-   * Get the select item
-   * @return The item
-   */
-  public String getSelectItem() {
-    return selectItem;
-  }
-  
-  /**
-   * Set the select item
-   * @param selectItem The item
-   */
-  public void setSelectItem(String selectItem) {
-    this.selectItem = selectItem;
-  }
-  
-  /**
-   * Get the select thread info
-   * @return The info
-   */
-  public ThreadInfo getSelectThreadInfo() {
-    return selectThreadInfo;
-  }
-  
-  /**
-   * Set the select thread info
-   * @param selectThreadInfo The info
-   */
-  public void setSelectThreadInfo(ThreadInfo selectThreadInfo) {
-    this.selectThreadInfo = selectThreadInfo;
-    this.selectItem = selectThreadInfo.getName();
-  }
-  
-  /**
-   * Get the main keys
-   * @return The keys
-   */
-  public List<String> getMainKeys() {
-    return mainKeys;
-  }
-  
-  /**
-   * Set the main keys
-   * @param mainKeys The keys
-   */
-  public void setMainKeys(List<String> mainKeys) {
-    this.mainKeys = mainKeys;
-  }
-  
-  /**
-   * Get the sub keys
-   * @return The keys
-   */
-  public List<String> getSubKeys() {
-    return subKeys;
-  }
-  
-  /**
-   * Set the sub keys
-   * @param subKeys The keys
-   */
-  public void setSubKeys(List<String> subKeys) {
-    this.subKeys = subKeys;
-  }
-  
-  /**
-   * Get the sub values
-   * @return The values
-   */
-  public List<CombinedFrameInfo> getSubValues() {
-    return subValues;
-  }
-  
-  /**
-   * Set the sub values
-   * @param subValues The values
-   */
-  public void setSubValues(List<CombinedFrameInfo> subValues) {
-    this.subValues = subValues;
-  }
-  
-  /**
-   * Get the new map
-   * @return The map
-   */
-  public Map<String, CombinedFrameInfo> getNewMap() {
-    return newMap;
-  }
-  
-  /**
-   * Set the new map
-   * @param newMap The map
-   */
-  public void setNewMap(Map<String, CombinedFrameInfo> newMap) {
-    this.newMap = newMap;
-  }
-  
-  /**
-   * Get the threads
-   * @return The threads
-   */
-  public List<ThreadInfo> getAllThreads() {
-    List<ThreadInfo> threadsList = null;
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      threadsList = LoadSnapshotBean.getSnapshot().getThreads();
-    }
-    return threadsList;
-  }
-  
-  /**
-   * Selection changed
-   * @param evt The event
-   */
-  public void selectionChanged(ValueChangeEvent evt) {
-    this.setSelectItem(((String)evt.getNewValue()));
-    
-    List<ThreadInfo> allThreads = this.getAllThreads();
-    Iterator<ThreadInfo> it = allThreads.iterator();
-    ThreadInfo tmpThreadInfo = null;
-    while (it.hasNext()) {
-      tmpThreadInfo = it.next();
-      if (tmpThreadInfo.getName().endsWith(this.selectItem))
-        break;
-    }
-    generateArrayFromMap(tmpThreadInfo);
-  }
-  
-  /**
-   * Get selected items
-   * @return The items
-   */
-  public List<SelectItem> getAllSelectItems() {
-    List<SelectItem> allSelectItems = new ArrayList<SelectItem>();
-    List<ThreadInfo> threadsList = null;
-    if (LoadSnapshotBean.getSnapshot() != null) {
-      threadsList = LoadSnapshotBean.getSnapshot().getThreads();
-      for (int i = 0; i < threadsList.size(); i++) {
-        allSelectItems.add(new SelectItem(threadsList.get(i).getName()));
+   private ThreadInfo selectThreadInfo = null;
+
+   private List<String> mainKeys;
+
+   private List<String> subKeys;
+
+   private List<CombinedFrameInfo> subValues;
+
+   private Map<String, CombinedFrameInfo> newMap;
+
+   /**
+    * Constructor
+    */
+   public ThreadHotspotBean()
+   {
+   }
+
+   /**
+    * Get the select item
+    * @return The item
+    */
+   public String getSelectItem()
+   {
+      return selectItem;
+   }
+
+   /**
+    * Set the select item
+    * @param selectItem The item
+    */
+   public void setSelectItem(String selectItem)
+   {
+      this.selectItem = selectItem;
+   }
+
+   /**
+    * Get the select thread info
+    * @return The info
+    */
+   public ThreadInfo getSelectThreadInfo()
+   {
+      return selectThreadInfo;
+   }
+
+   /**
+    * Set the select thread info
+    * @param selectThreadInfo The info
+    */
+   public void setSelectThreadInfo(ThreadInfo selectThreadInfo)
+   {
+      this.selectThreadInfo = selectThreadInfo;
+      this.selectItem = selectThreadInfo.getName();
+   }
+
+   /**
+    * Get the main keys
+    * @return The keys
+    */
+   public List<String> getMainKeys()
+   {
+      return mainKeys;
+   }
+
+   /**
+    * Set the main keys
+    * @param mainKeys The keys
+    */
+   public void setMainKeys(List<String> mainKeys)
+   {
+      this.mainKeys = mainKeys;
+   }
+
+   /**
+    * Get the sub keys
+    * @return The keys
+    */
+   public List<String> getSubKeys()
+   {
+      return subKeys;
+   }
+
+   /**
+    * Set the sub keys
+    * @param subKeys The keys
+    */
+   public void setSubKeys(List<String> subKeys)
+   {
+      this.subKeys = subKeys;
+   }
+
+   /**
+    * Get the sub values
+    * @return The values
+    */
+   public List<CombinedFrameInfo> getSubValues()
+   {
+      return subValues;
+   }
+
+   /**
+    * Set the sub values
+    * @param subValues The values
+    */
+   public void setSubValues(List<CombinedFrameInfo> subValues)
+   {
+      this.subValues = subValues;
+   }
+
+   /**
+    * Get the new map
+    * @return The map
+    */
+   public Map<String, CombinedFrameInfo> getNewMap()
+   {
+      return newMap;
+   }
+
+   /**
+    * Set the new map
+    * @param newMap The map
+    */
+   public void setNewMap(Map<String, CombinedFrameInfo> newMap)
+   {
+      this.newMap = newMap;
+   }
+
+   /**
+    * Get the threads
+    * @return The threads
+    */
+   public List<ThreadInfo> getAllThreads()
+   {
+      List<ThreadInfo> threadsList = null;
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         threadsList = LoadSnapshotBean.getSnapshot().getThreads();
       }
-    }
-    return allSelectItems;
-  }
-  
-  /**
-   * Show info
-   * @param threadInfo The thread
-   */
-  public void showMapInfo(ThreadInfo threadInfo) {
-    Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
-    for (FrameInfo fi : threadInfo.getFrames()) {
-      getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, data);
-    }
-    
-    Iterator dit = data.entrySet().iterator();
-    DecimalFormat df = new DecimalFormat("#0.00");
-    
-    while (dit.hasNext()) {
-      Map.Entry entry = (Map.Entry)dit.next();
-      String key = (String)entry.getKey();
-      Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
-      Map<String, List<CombinedFrameInfo>> m = new HashMap<String, List<CombinedFrameInfo>>();
-      Iterator vit = value.values().iterator();
-      
-      while (vit.hasNext()) {
-        CombinedFrameInfo cfi = (CombinedFrameInfo)vit.next();
-        List<CombinedFrameInfo> l = m.get(cfi.getClassName());
-        if (l == null) {
-          l = new ArrayList<CombinedFrameInfo>();
-          m.put(cfi.getClassName(), l);
-        }
-        l.add(cfi);
+      return threadsList;
+   }
+
+   /**
+    * Selection changed
+    * @param evt The event
+    */
+   public void selectionChanged(ValueChangeEvent evt)
+   {
+      this.setSelectItem(((String)evt.getNewValue()));
+
+      List<ThreadInfo> allThreads = this.getAllThreads();
+      Iterator<ThreadInfo> it = allThreads.iterator();
+      ThreadInfo tmpThreadInfo = null;
+      while (it.hasNext())
+      {
+         tmpThreadInfo = it.next();
+         if (tmpThreadInfo.getName().endsWith(this.selectItem))
+            break;
       }
-      
-      Iterator mit = m.entrySet().iterator();
-      while (mit.hasNext()) {
-        Map.Entry mentry = (Map.Entry)mit.next();
-        String methodName = (String)mentry.getKey();
-        List<CombinedFrameInfo> callers = (List<CombinedFrameInfo>)mentry.getValue();
-        Collections.sort(callers, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+      generateArrayFromMap(tmpThreadInfo);
+   }
+
+   /**
+    * Get selected items
+    * @return The items
+    */
+   public List<SelectItem> getAllSelectItems()
+   {
+      List<SelectItem> allSelectItems = new ArrayList<SelectItem>();
+      List<ThreadInfo> threadsList = null;
+      if (LoadSnapshotBean.getSnapshot() != null)
+      {
+         threadsList = LoadSnapshotBean.getSnapshot().getThreads();
+         for (int i = 0; i < threadsList.size(); i++)
+         {
+            allSelectItems.add(new SelectItem(threadsList.get(i).getName()));
+         }
       }
-    }
-  }
-  
-  /**
-   * Generate array
-   * @param threadInfo The thread
-   */
-  public void generateArrayFromMap(ThreadInfo threadInfo) {
-    Map<String, Map<String, CombinedFrameInfo>> map = new HashMap<String, Map<String, CombinedFrameInfo>>();
-    
-    for (FrameInfo fi : threadInfo.getFrames()) {
-      getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, map);
-    }
-    
-    Map<String, CombinedFrameInfo> newMap = new HashMap();
-    Set<String> set = map.keySet();
-    List<String> mainKeys = new ArrayList(set);
-    this.mainKeys = mainKeys;
-    
-    List subKeys = new ArrayList();
-    List subValues = new ArrayList();
-    
-    Iterator it = map.values().iterator();
-    while (it.hasNext()) {
-      Map<String, CombinedFrameInfo> subMap = (Map<String, CombinedFrameInfo>) it.next();
-      Set entrySet = subMap.entrySet();
-      Iterator entryIt = entrySet.iterator();
-      while (entryIt.hasNext()) {
-        Map.Entry<String, CombinedFrameInfo> entry = (Map.Entry<String, CombinedFrameInfo>)entryIt.next();
-        subKeys.add(entry.getKey());
-        subValues.add(entry.getValue());
-        newMap.put(entry.getKey(), entry.getValue());
+      return allSelectItems;
+   }
+
+   /**
+    * Show info
+    * @param threadInfo The thread
+    */
+   public void showMapInfo(ThreadInfo threadInfo)
+   {
+      Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
+      for (FrameInfo fi : threadInfo.getFrames())
+      {
+         getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, data);
       }
-    }
-    this.setSubKeys(subKeys);
-    this.setSubValues(subValues);
-    this.setNewMap(newMap);
-  }
-  
-  /**
-   * Get caller information
-   * @param mr The method repository
-   * @param fi The frame
-   * @param data The data
-   */
-  protected void getCallerInformation(MethodRepository mr, 
-                                      FrameInfo fi, 
-                                      Map<String, Map<String, CombinedFrameInfo>> data) {
 
-    MethodInfo mi = mr.getInfo(fi.getMethod());
-    Map<String, CombinedFrameInfo> entry = data.get(mi.getClassName());
-    if (entry == null) {
-      entry = new HashMap<String, CombinedFrameInfo>();
-      data.put(mi.getClassName(), entry);
-    }
-    if (fi.getParent() != null) {
-      MethodInfo pmi = mr.getInfo(fi.getParent().getMethod());
-      String parentName = Util.getPrettyName(pmi);
-      CombinedFrameInfo cfi = entry.get(parentName);
-      if (cfi == null) {
-        cfi = new CombinedFrameInfo(Util.getPrettyName(mi), parentName);
-        entry.put(parentName, cfi);
+      Iterator dit = data.entrySet().iterator();
+      DecimalFormat df = new DecimalFormat("#0.00");
+
+      while (dit.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)dit.next();
+         String key = (String)entry.getKey();
+         Map<String, CombinedFrameInfo> value = (Map<String, CombinedFrameInfo>)entry.getValue();
+         Map<String, List<CombinedFrameInfo>> m = new HashMap<String, List<CombinedFrameInfo>>();
+         Iterator vit = value.values().iterator();
+
+         while (vit.hasNext())
+         {
+            CombinedFrameInfo cfi = (CombinedFrameInfo)vit.next();
+            List<CombinedFrameInfo> l = m.get(cfi.getClassName());
+            if (l == null)
+            {
+               l = new ArrayList<CombinedFrameInfo>();
+               m.put(cfi.getClassName(), l);
+            }
+            l.add(cfi);
+         }
+
+         Iterator mit = m.entrySet().iterator();
+         while (mit.hasNext())
+         {
+            Map.Entry mentry = (Map.Entry)mit.next();
+            String methodName = (String)mentry.getKey();
+            List<CombinedFrameInfo> callers = (List<CombinedFrameInfo>)mentry.getValue();
+            Collections.sort(callers, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
+         }
       }
-      
-      cfi.increaseCount(fi.getParent().getCount());
-      cfi.increaseTotalTime(Math.nanoToMilli(fi.getParent().getNetTime()));
-    }
-    
-    if (fi.getChildren() != null && fi.getChildren().size() > 0) {
-      for (FrameInfo child : fi.getChildren()) {
-        getCallerInformation(mr, child, data);
+   }
+
+   /**
+    * Generate array
+    * @param threadInfo The thread
+    */
+   public void generateArrayFromMap(ThreadInfo threadInfo)
+   {
+      Map<String, Map<String, CombinedFrameInfo>> map = new HashMap<String, Map<String, CombinedFrameInfo>>();
+
+      for (FrameInfo fi : threadInfo.getFrames())
+      {
+         getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, map);
       }
-    }
-  }
+
+      Map<String, CombinedFrameInfo> newMap = new HashMap();
+      Set<String> set = map.keySet();
+      List<String> mainKeys = new ArrayList(set);
+      this.mainKeys = mainKeys;
+
+      List subKeys = new ArrayList();
+      List subValues = new ArrayList();
+
+      Iterator it = map.values().iterator();
+      while (it.hasNext())
+      {
+         Map<String, CombinedFrameInfo> subMap = (Map<String, CombinedFrameInfo>)it.next();
+         Set entrySet = subMap.entrySet();
+         Iterator entryIt = entrySet.iterator();
+         while (entryIt.hasNext())
+         {
+            Map.Entry<String, CombinedFrameInfo> entry = (Map.Entry<String, CombinedFrameInfo>)entryIt.next();
+            subKeys.add(entry.getKey());
+            subValues.add(entry.getValue());
+            newMap.put(entry.getKey(), entry.getValue());
+         }
+      }
+      this.setSubKeys(subKeys);
+      this.setSubValues(subValues);
+      this.setNewMap(newMap);
+   }
+
+   /**
+    * Get caller information
+    * @param mr The method repository
+    * @param fi The frame
+    * @param data The data
+    */
+   protected void getCallerInformation(MethodRepository mr, FrameInfo fi,
+         Map<String, Map<String, CombinedFrameInfo>> data)
+   {
+
+      MethodInfo mi = mr.getInfo(fi.getMethod());
+      Map<String, CombinedFrameInfo> entry = data.get(mi.getClassName());
+      if (entry == null)
+      {
+         entry = new HashMap<String, CombinedFrameInfo>();
+         data.put(mi.getClassName(), entry);
+      }
+      if (fi.getParent() != null)
+      {
+         MethodInfo pmi = mr.getInfo(fi.getParent().getMethod());
+         String parentName = Util.getPrettyName(pmi);
+         CombinedFrameInfo cfi = entry.get(parentName);
+         if (cfi == null)
+         {
+            cfi = new CombinedFrameInfo(Util.getPrettyName(mi), parentName);
+            entry.put(parentName, cfi);
+         }
+
+         cfi.increaseCount(fi.getParent().getCount());
+         cfi.increaseTotalTime(Math.nanoToMilli(fi.getParent().getNetTime()));
+      }
+
+      if (fi.getChildren() != null &&
+            fi.getChildren().size() > 0)
+      {
+         for (FrameInfo child : fi.getChildren())
+         {
+            getCallerInformation(mr, child, data);
+         }
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,113 +31,131 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class TreeThreadBean implements Serializable {
-  //the id of selectedThread
-  private long selectedThread;
-  private volatile LoadSnapshotBean loadSnapshotBean;
-  private List<FrameInfo> frames;
-  private FrameInfo frame;
+public class TreeThreadBean implements Serializable
+{
+   // the id of selectedThread
+   private long selectedThread;
 
-  /**
-   * Constructor
-   */
-  public TreeThreadBean() {
-  }
-  
-  /**
-   * Get the frame
-   * @return The frame
-   */
-  public FrameInfo getFrame() {
-    return frame;
-  }
-  
-  /**
-   * Set the frame
-   * @param frame The frame
-   */
-  public void setFrame(FrameInfo frame) {
-    this.frame = frame;
-  }
-  
-  /**
-   * Get the load snapshot bean
-   * @return The load snapshot bean
-   */
-  public LoadSnapshotBean getLoadSnapshotBean() {
-    return loadSnapshotBean;
-  }
-  
-  /**
-   * Set the load snapshot bean
-   * @param loadSnapshotBean The load snapshot bean
-   */
-  public void setLoadSnapshotBean(LoadSnapshotBean loadSnapshotBean) {
-    this.loadSnapshotBean = loadSnapshotBean;
-  }
-  
-  /**
-   * Get the selected thread
-   * @return The thread
-   */
-  public long getSelectedThread() {
-    return selectedThread;
-  }
-  
-  /**
-   * Set the selected thread
-   * @param selectedThread The thread
-   */
-  public void setSelectedThread(long selectedThread) {
-    this.selectedThread = selectedThread;
-  }
-  
-  /**
-   * Get the threads
-   * @return The threads
-   */
-  public List<ThreadInfo> getAllThreads() {
-    List<ThreadInfo> threadsList = null;
-    if (loadSnapshotBean.getSnapshot() != null) {
-      threadsList = loadSnapshotBean.getSnapshot().getThreads();
-    }
-    return threadsList;
-  }
-  
-  /**
-   * Fire selected thread
-   */
-  public void fireSelectedThread() {
-    List<ThreadInfo> allthreads = this.getAllThreads();
-    ThreadInfo tmpThreadInfo = null;
-    for (int i = 0; i < allthreads.size(); i++) {
-      tmpThreadInfo = allthreads.get(i);
-      if (tmpThreadInfo.getId() == this.getSelectedThread()) 
-        break;
-    }
-    frames = tmpThreadInfo.getFrames();
-    //TreeFrameBean.setEnterFrames(tmpThreadInfo.getFrames());
-  }
-  
-  /**
-   * Get the source roots
-   * @return The roots
-   */
-  public synchronized List<DecorateFrameInfo> getSrcRoots() {
-    if (frames == null)
-       return null;
+   private volatile LoadSnapshotBean loadSnapshotBean;
 
-    ArrayList<DecorateFrameInfo> ret = new ArrayList<DecorateFrameInfo>();
-    for (FrameInfo frameInfo : frames)
-      ret.add(new DecorateFrameInfo(frameInfo, loadSnapshotBean.getSnapshot().getMethodRepository()));
-    return ret;
-  }
-  
-  /**
-   * Get the frame info
-   * @return The info
-   */
-  public String getFrameInfo() {
-    return frame == null ? "" : frame.toString();
-  }
+   private List<FrameInfo> frames;
+
+   private FrameInfo frame;
+
+   /**
+    * Constructor
+    */
+   public TreeThreadBean()
+   {
+   }
+
+   /**
+    * Get the frame
+    * @return The frame
+    */
+   public FrameInfo getFrame()
+   {
+      return frame;
+   }
+
+   /**
+    * Set the frame
+    * @param frame The frame
+    */
+   public void setFrame(FrameInfo frame)
+   {
+      this.frame = frame;
+   }
+
+   /**
+    * Get the load snapshot bean
+    * @return The load snapshot bean
+    */
+   public LoadSnapshotBean getLoadSnapshotBean()
+   {
+      return loadSnapshotBean;
+   }
+
+   /**
+    * Set the load snapshot bean
+    * @param loadSnapshotBean The load snapshot bean
+    */
+   public void setLoadSnapshotBean(LoadSnapshotBean loadSnapshotBean)
+   {
+      this.loadSnapshotBean = loadSnapshotBean;
+   }
+
+   /**
+    * Get the selected thread
+    * @return The thread
+    */
+   public long getSelectedThread()
+   {
+      return selectedThread;
+   }
+
+   /**
+    * Set the selected thread
+    * @param selectedThread The thread
+    */
+   public void setSelectedThread(long selectedThread)
+   {
+      this.selectedThread = selectedThread;
+   }
+
+   /**
+    * Get the threads
+    * @return The threads
+    */
+   public List<ThreadInfo> getAllThreads()
+   {
+      List<ThreadInfo> threadsList = null;
+      if (loadSnapshotBean.getSnapshot() != null)
+      {
+         threadsList = loadSnapshotBean.getSnapshot().getThreads();
+      }
+      return threadsList;
+   }
+
+   /**
+    * Fire selected thread
+    */
+   public void fireSelectedThread()
+   {
+      List<ThreadInfo> allthreads = this.getAllThreads();
+      ThreadInfo tmpThreadInfo = null;
+      for (int i = 0; i < allthreads.size(); i++)
+      {
+         tmpThreadInfo = allthreads.get(i);
+         if (tmpThreadInfo.getId() == this.getSelectedThread())
+            break;
+      }
+      frames = tmpThreadInfo.getFrames();
+      // TreeFrameBean.setEnterFrames(tmpThreadInfo.getFrames());
+   }
+
+   /**
+    * Get the source roots
+    * @return The roots
+    */
+   public synchronized List<DecorateFrameInfo> getSrcRoots()
+   {
+      if (frames == null)
+         return null;
+
+      ArrayList<DecorateFrameInfo> ret = new ArrayList<DecorateFrameInfo>();
+      for (FrameInfo frameInfo : frames)
+         ret.add(new DecorateFrameInfo(frameInfo, loadSnapshotBean.getSnapshot().getMethodRepository()));
+      return ret;
+   }
+
+   /**
+    * Get the frame info
+    * @return The info
+    */
+   public String getFrameInfo()
+   {
+      return frame == null
+            ? "" : frame.toString();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -33,47 +33,54 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class PostbackPhaseListener implements PhaseListener, Serializable {
+public class PostbackPhaseListener implements PhaseListener, Serializable
+{
 
-  private static final long serialVersionUID = 1L;
+   private static final long serialVersionUID = 1L;
 
-  /** The postback attribute name */
-  public static final String POSTBACK_ATTRIBUTE_NAME = PostbackPhaseListener.class.getName();
+   /** The postback attribute name */
+   public static final String POSTBACK_ATTRIBUTE_NAME = PostbackPhaseListener.class.getName();
 
-  /**
-   * @param event The event
-   */
-  public void afterPhase(PhaseEvent event) {
-  }
-  
-  /**
-   * @param event The event
-   */
-  public void beforePhase(PhaseEvent event) {
-    FacesContext facesContext = event.getFacesContext();
-    Map requestMap = facesContext.getExternalContext().getRequestMap();
-    requestMap.put(POSTBACK_ATTRIBUTE_NAME, Boolean.TRUE);
-  }
-  
-  /**
-   * @return The phase id
-   */
-  public PhaseId getPhaseId() {
-    return PhaseId.APPLY_REQUEST_VALUES;
-  }
-  
-  /**
-   * Is postback
-   * @return Ture if postback; otherwise false
-   */
-  public static boolean isPostback() {
-    FacesContext facesContext = FacesContext.getCurrentInstance();
-    if (facesContext != null) {
-      ExternalContext externalContext = facesContext.getExternalContext();
-      if (externalContext != null) {
-        return Boolean.TRUE.equals(externalContext.getRequestMap().get(POSTBACK_ATTRIBUTE_NAME));
+   /**
+    * @param event The event
+    */
+   public void afterPhase(PhaseEvent event)
+   {
+   }
+
+   /**
+    * @param event The event
+    */
+   public void beforePhase(PhaseEvent event)
+   {
+      FacesContext facesContext = event.getFacesContext();
+      Map requestMap = facesContext.getExternalContext().getRequestMap();
+      requestMap.put(POSTBACK_ATTRIBUTE_NAME, Boolean.TRUE);
+   }
+
+   /**
+    * @return The phase id
+    */
+   public PhaseId getPhaseId()
+   {
+      return PhaseId.APPLY_REQUEST_VALUES;
+   }
+
+   /**
+    * Is postback
+    * @return Ture if postback; otherwise false
+    */
+   public static boolean isPostback()
+   {
+      FacesContext facesContext = FacesContext.getCurrentInstance();
+      if (facesContext != null)
+      {
+         ExternalContext externalContext = facesContext.getExternalContext();
+         if (externalContext != null)
+         {
+            return Boolean.TRUE.equals(externalContext.getRequestMap().get(POSTBACK_ATTRIBUTE_NAME));
+         }
       }
-    }
-    return false;
-  }
+      return false;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -30,30 +30,36 @@
 /**
  * @author Huijuan Shao <hjshao at hitachi.cn>
  */
-public class TreeDemoStateAdvisor implements TreeStateAdvisor, Serializable {
+public class TreeDemoStateAdvisor implements TreeStateAdvisor, Serializable
+{
 
-  /**
-   * Node open
-   * @param tree The tree
-   * @return True if root node opens; otherwise false
-   */
-  public Boolean adviseNodeOpened(UITree tree) {
-    if (!PostbackPhaseListener.isPostback()) {
-      Object key = tree.getRowKey();
-      TreeRowKey treeRowKey = (TreeRowKey) key;
-      if (treeRowKey == null || treeRowKey.depth() <= 2) {
-        return Boolean.TRUE;
+   /**
+    * Node open
+    * @param tree The tree
+    * @return True if root node opens; otherwise false
+    */
+   public Boolean adviseNodeOpened(UITree tree)
+   {
+      if (!PostbackPhaseListener.isPostback())
+      {
+         Object key = tree.getRowKey();
+         TreeRowKey treeRowKey = (TreeRowKey)key;
+         if (treeRowKey == null ||
+               treeRowKey.depth() <= 2)
+         {
+            return Boolean.TRUE;
+         }
       }
-    }
-    return null;
-  }
+      return null;
+   }
 
-  /**
-   * Node select
-   * @param tree The tree
-   * @return null
-   */
-  public Boolean adviseNodeSelected(UITree tree) {
-    return null;
-  }
+   /**
+    * Node select
+    * @param tree The tree
+    * @return null
+    */
+   public Boolean adviseNodeSelected(UITree tree)
+   {
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,47 +31,72 @@
  * The abstract handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public abstract class AbstractHandler {
+public abstract class AbstractHandler
+{
 
-  /**
-   * Constructor
-   */
-  protected AbstractHandler() {
-  }
+   /**
+    * Constructor
+    */
+   protected AbstractHandler()
+   {
+   }
 
-  /**
-   * Handle commands
-   * @param cmd The command
-   * @return The result
-   */
-  protected Object handleCommand(Command cmd) {
-    if (cmd.getCommand() == CommandType.START_PROFILER && Agent.isEnabled()) {
-      Profiler.startProfiler();
-    } else if (cmd.getCommand() == CommandType.STOP_PROFILER && Agent.isEnabled()) {
-      Profiler.stopProfiler();
-    } else if (cmd.getCommand() == CommandType.SNAPSHOT && Agent.isEnabled()) {
-      return Profiler.snapshot();
-    } else if (cmd.getCommand() == CommandType.GET_SNAPSHOT ||
-               cmd.getCommand() == CommandType.SAVE) {
-      return Profiler.getSnapshot(((Integer)cmd.getArguments()[0]).intValue());
-    } else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS) {
-      return Profiler.listSnapshots();
-    } else if (cmd.getCommand() == CommandType.CLEAR_SNAPSHOTS) {
-      Profiler.clearSnapshots();
-    } else if (cmd.getCommand() == CommandType.GC && Agent.isEnabled()) {
-      Profiler.garbageCollection();
-    } else if (cmd.getCommand() == CommandType.ENABLE && !Agent.isEnabled()) {
-      Agent.setEnabled(true);
-    } else if (cmd.getCommand() == CommandType.DISABLE && Agent.isEnabled()) {
-      Profiler.stopProfiler();
-      Agent.setEnabled(false);
-    } else if (cmd.getCommand() == CommandType.ADD_CLASSES && Agent.isRepository()) {
-      Agent.addClasses((String)cmd.getArguments()[0], (Visibility)cmd.getArguments()[1]);
-    } else if (cmd.getCommand() == CommandType.REMOVE_CLASSES && Agent.isRepository()) {
-      Agent.removeClasses((String)cmd.getArguments()[0]);
-    } else if (cmd.getCommand() == CommandType.LIST_CLASSES) {
-      return Agent.listClasses();
-    }
-    return "";
-  }
+   /**
+    * Handle commands
+    * @param cmd The command
+    * @return The result
+    */
+   protected Object handleCommand(Command cmd)
+   {
+      if (cmd.getCommand() == CommandType.START_PROFILER && Agent.isEnabled())
+      {
+         Profiler.startProfiler();
+      }
+      else if (cmd.getCommand() == CommandType.STOP_PROFILER && Agent.isEnabled())
+      {
+         Profiler.stopProfiler();
+      }
+      else if (cmd.getCommand() == CommandType.SNAPSHOT && Agent.isEnabled())
+      {
+         return Profiler.snapshot();
+      }
+      else if (cmd.getCommand() == CommandType.GET_SNAPSHOT || cmd.getCommand() == CommandType.SAVE)
+      {
+         return Profiler.getSnapshot(((Integer)cmd.getArguments()[0]).intValue());
+      }
+      else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS)
+      {
+         return Profiler.listSnapshots();
+      }
+      else if (cmd.getCommand() == CommandType.CLEAR_SNAPSHOTS)
+      {
+         Profiler.clearSnapshots();
+      }
+      else if (cmd.getCommand() == CommandType.GC && Agent.isEnabled())
+      {
+         Profiler.garbageCollection();
+      }
+      else if (cmd.getCommand() == CommandType.ENABLE && !Agent.isEnabled())
+      {
+         Agent.setEnabled(true);
+      }
+      else if (cmd.getCommand() == CommandType.DISABLE && Agent.isEnabled())
+      {
+         Profiler.stopProfiler();
+         Agent.setEnabled(false);
+      }
+      else if (cmd.getCommand() == CommandType.ADD_CLASSES && Agent.isRepository())
+      {
+         Agent.addClasses((String)cmd.getArguments()[0], (Visibility)cmd.getArguments()[1]);
+      }
+      else if (cmd.getCommand() == CommandType.REMOVE_CLASSES && Agent.isRepository())
+      {
+         Agent.removeClasses((String)cmd.getArguments()[0]);
+      }
+      else if (cmd.getCommand() == CommandType.LIST_CLASSES)
+      {
+         return Agent.listClasses();
+      }
+      return "";
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/HttpHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/HttpHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/HttpHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,26 +29,30 @@
  * The HTTP handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class HttpHandler extends RemoteHandler {
+public class HttpHandler extends RemoteHandler
+{
 
-  /**
-   * Constructor
-   */
-  public HttpHandler() {
-  }
+   /**
+    * Constructor
+    */
+   public HttpHandler()
+   {
+   }
 
-  /**
-   * Called to handle a specific invocation
-   * @param invocation The invocation
-   * @return The result
-   * @throws Throwable If an error occurs
-   */
-  public Object invoke(InvocationRequest invocation) throws Throwable {
-    if (invocation.getParameter() instanceof Command) {
-      Command cmd = (Command)invocation.getParameter();
+   /**
+    * Called to handle a specific invocation
+    * @param invocation The invocation
+    * @return The result
+    * @throws Throwable If an error occurs
+    */
+   public Object invoke(InvocationRequest invocation) throws Throwable
+   {
+      if (invocation.getParameter() instanceof Command)
+      {
+         Command cmd = (Command)invocation.getParameter();
 
-      return handleCommand(cmd);
-    }
-    return null;
-  }
+         return handleCommand(cmd);
+      }
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/LocalHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/LocalHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/LocalHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,20 +27,23 @@
  * The local handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class LocalHandler extends AbstractHandler {
+public class LocalHandler extends AbstractHandler
+{
 
-  /**
-   * Constructor
-   */
-  public LocalHandler() {
-  }
+   /**
+    * Constructor
+    */
+   public LocalHandler()
+   {
+   }
 
-  /**
-   * Handle commands
-   * @param cmd The command
-   * @return The result
-   */
-  public Object handleCommand(Command cmd) {
-    return super.handleCommand(cmd);
-  }
+   /**
+    * Handle commands
+    * @param cmd The command
+    * @return The result
+    */
+   public Object handleCommand(Command cmd)
+   {
+      return super.handleCommand(cmd);
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RemoteHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RemoteHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RemoteHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,49 +32,55 @@
  * The remote handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public abstract class RemoteHandler extends AbstractHandler implements ServerInvocationHandler {
+public abstract class RemoteHandler extends AbstractHandler implements ServerInvocationHandler
+{
 
-  /**
-   * Constructor
-   */
-  protected RemoteHandler() {
-  }
+   /**
+    * Constructor
+    */
+   protected RemoteHandler()
+   {
+   }
 
-  /**
-   * Adds a callback handler that will listen for callbacks from
-   * the server invoker handler.
-   * @param callbackHandler The callback handler
-   */
-  public void addListener(InvokerCallbackHandler callbackHandler) {
-  }
-  
-  /**
-   * Removes the callback handler that was listening for callbacks
-   * from the server invoker handler.
-   * @param callbackHandler The callback handler
-   */
-  public void removeListener(InvokerCallbackHandler callbackHandler) {
-  }
+   /**
+    * Adds a callback handler that will listen for callbacks from
+    * the server invoker handler.
+    * @param callbackHandler The callback handler
+    */
+   public void addListener(InvokerCallbackHandler callbackHandler)
+   {
+   }
 
-  /**
-   * Set the mbean server that the handler can reference
-   * @param server The MBean server
-   */
-  public void setMBeanServer(MBeanServer server) {
-  }
-  
-  /**
-   * Set the invoker that owns this handler
-   * @param invoker The invoker
-   */
-  public void setInvoker(ServerInvoker invoker) {
-  }
+   /**
+    * Removes the callback handler that was listening for callbacks
+    * from the server invoker handler.
+    * @param callbackHandler The callback handler
+    */
+   public void removeListener(InvokerCallbackHandler callbackHandler)
+   {
+   }
 
-  /**
-   * Called to handle a specific invocation
-   * @param invocation The invocation
-   * @return The result
-   * @throws Throwable If an error occurs
-   */
-  public abstract Object invoke(InvocationRequest invocation) throws Throwable;
+   /**
+    * Set the mbean server that the handler can reference
+    * @param server The MBean server
+    */
+   public void setMBeanServer(MBeanServer server)
+   {
+   }
+
+   /**
+    * Set the invoker that owns this handler
+    * @param invoker The invoker
+    */
+   public void setInvoker(ServerInvoker invoker)
+   {
+   }
+
+   /**
+    * Called to handle a specific invocation
+    * @param invocation The invocation
+    * @return The result
+    * @throws Throwable If an error occurs
+    */
+   public abstract Object invoke(InvocationRequest invocation) throws Throwable;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RmiHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RmiHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/RmiHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,26 +29,30 @@
  * The RMI handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class RmiHandler extends RemoteHandler {
+public class RmiHandler extends RemoteHandler
+{
 
-  /**
-   * Constructor
-   */
-  public RmiHandler() {
-  }
+   /**
+    * Constructor
+    */
+   public RmiHandler()
+   {
+   }
 
-  /**
-   * Called to handle a specific invocation
-   * @param invocation The invocation
-   * @return The result
-   * @throws Throwable If an error occurs
-   */
-  public Object invoke(InvocationRequest invocation) throws Throwable {
-    if (invocation.getParameter() instanceof Command) {
-      Command cmd = (Command)invocation.getParameter();
+   /**
+    * Called to handle a specific invocation
+    * @param invocation The invocation
+    * @return The result
+    * @throws Throwable If an error occurs
+    */
+   public Object invoke(InvocationRequest invocation) throws Throwable
+   {
+      if (invocation.getParameter() instanceof Command)
+      {
+         Command cmd = (Command)invocation.getParameter();
 
-      return handleCommand(cmd);
-    }
-    return null;
-  }
+         return handleCommand(cmd);
+      }
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/SocketHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/SocketHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/SocketHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,26 +29,30 @@
  * The socket handler class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SocketHandler extends RemoteHandler {
+public class SocketHandler extends RemoteHandler
+{
 
-  /**
-   * Constructor
-   */
-  public SocketHandler() {
-  }
+   /**
+    * Constructor
+    */
+   public SocketHandler()
+   {
+   }
 
-  /**
-   * Called to handle a specific invocation
-   * @param invocation The invocation
-   * @return The result
-   * @throws Throwable If an error occurs
-   */
-  public Object invoke(InvocationRequest invocation) throws Throwable {
-    if (invocation.getParameter() instanceof Command) {
-      Command cmd = (Command)invocation.getParameter();
+   /**
+    * Called to handle a specific invocation
+    * @param invocation The invocation
+    * @return The result
+    * @throws Throwable If an error occurs
+    */
+   public Object invoke(InvocationRequest invocation) throws Throwable
+   {
+      if (invocation.getParameter() instanceof Command)
+      {
+         Command cmd = (Command)invocation.getParameter();
 
-      return handleCommand(cmd);
-    }
-    return null;
-  }
+         return handleCommand(cmd);
+      }
+      return null;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/embedded/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/embedded/Profiler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/embedded/Profiler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -33,208 +33,241 @@
  * The client that will handle an embedded agent
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Profiler {
-  /** The logger */
-  private static Logger log = Logger.getLogger(Profiler.class);
+public class Profiler
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(Profiler.class);
 
-  /**
-   * Constructor
-   */
-  private Profiler() {
-  }
+   /**
+    * Constructor
+    */
+   private Profiler()
+   {
+   }
 
-  /**
-   * Is the profiler enabled ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isEnabled() {
-    return Agent.isEnabled();
-  }
+   /**
+    * Is the profiler enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isEnabled()
+   {
+      return Agent.isEnabled();
+   }
 
-  /**
-   * Is the profiler running ?
-   * @return True if running; otherwise false
-   */
-  public static boolean isRunning() {
-    return org.jboss.profiler.agent.Profiler.isRunning();
-  }
+   /**
+    * Is the profiler running ?
+    * @return True if running; otherwise false
+    */
+   public static boolean isRunning()
+   {
+      return org.jboss.profiler.agent.Profiler.isRunning();
+   }
 
-  /**
-   * Is the profiler using a memory store ?
-   * @return True if memory store; otherwise false
-   */
-  public static boolean isMemory() {
-    return Agent.isMemoryStore();
-  }
+   /**
+    * Is the profiler using a memory store ?
+    * @return True if memory store; otherwise false
+    */
+   public static boolean isMemory()
+   {
+      return Agent.isMemoryStore();
+   }
 
-  /**
-   * Is the profiler using a file store ?
-   * @return True if file store; otherwise false
-   */
-  public static boolean isFile() {
-    return !Agent.isMemoryStore();
-  }
+   /**
+    * Is the profiler using a file store ?
+    * @return True if file store; otherwise false
+    */
+   public static boolean isFile()
+   {
+      return !Agent.isMemoryStore();
+   }
 
-  /**
-   * Is EJB ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isEJB() {
-    return Agent.isEJB();
-  }
+   /**
+    * Is EJB ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isEJB()
+   {
+      return Agent.isEJB();
+   }
 
-  /**
-   * Is Servlet ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isServlet() {
-    return Agent.isServlet();
-  }
+   /**
+    * Is Servlet ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isServlet()
+   {
+      return Agent.isServlet();
+   }
 
-  /**
-   * Is JSF ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isJSF() {
-    return Agent.isJSF();
-  }
+   /**
+    * Is JSF ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isJSF()
+   {
+      return Agent.isJSF();
+   }
 
-  /**
-   * Is JMX ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isJMX() {
-    return Agent.isJMX();
-  }
+   /**
+    * Is JMX ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isJMX()
+   {
+      return Agent.isJMX();
+   }
 
-  /**
-   * Is RMI ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isRMI() {
-    return Agent.isRMI();
-  }
+   /**
+    * Is RMI ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isRMI()
+   {
+      return Agent.isRMI();
+   }
 
-  /**
-   * Is CORBA ?
-   * @return True if enabled; otherwise false
-   */
-  public static boolean isCORBA() {
-    return Agent.isCORBA();
-  }
+   /**
+    * Is CORBA ?
+    * @return True if enabled; otherwise false
+    */
+   public static boolean isCORBA()
+   {
+      return Agent.isCORBA();
+   }
 
-  /**
-   * Start the profiler
-   */
-  public static void startProfiler() {
-    org.jboss.profiler.agent.Profiler.startProfiler();
-  }
+   /**
+    * Start the profiler
+    */
+   public static void startProfiler()
+   {
+      org.jboss.profiler.agent.Profiler.startProfiler();
+   }
 
-  /**
-   * Stop the profiler
-   */
-  public static void stopProfiler() {
-    org.jboss.profiler.agent.Profiler.stopProfiler();
-  }
+   /**
+    * Stop the profiler
+    */
+   public static void stopProfiler()
+   {
+      org.jboss.profiler.agent.Profiler.stopProfiler();
+   }
 
-  /**
-   * Take a snapshot
-   * @return The snapshot
-   */
-  public static Snapshot snapshot() {
-    return org.jboss.profiler.agent.Profiler.snapshot();
-  }
+   /**
+    * Take a snapshot
+    * @return The snapshot
+    */
+   public static Snapshot snapshot()
+   {
+      return org.jboss.profiler.agent.Profiler.snapshot();
+   }
 
-  /**
-   * Get all snapshots
-   * @return The snapshots
-   */
-  public static List<Snapshot> getSnapshots() {
-    return org.jboss.profiler.agent.Profiler.getSnapshots();
-  }
+   /**
+    * Get all snapshots
+    * @return The snapshots
+    */
+   public static List<Snapshot> getSnapshots()
+   {
+      return org.jboss.profiler.agent.Profiler.getSnapshots();
+   }
 
-  /**
-   * Get a snapshot
-   * @param index The snapshot index
-   * @return The snapshot
-   */
-  public static Snapshot getSnapshot(int index) {
-    return org.jboss.profiler.agent.Profiler.getSnapshot(index);
-  }
+   /**
+    * Get a snapshot
+    * @param index The snapshot index
+    * @return The snapshot
+    */
+   public static Snapshot getSnapshot(int index)
+   {
+      return org.jboss.profiler.agent.Profiler.getSnapshot(index);
+   }
 
-  /**
-   * List snapshots
-   * @return The snapshots
-   */
-  public static String[] listSnapshots() {
-    return org.jboss.profiler.agent.Profiler.listSnapshots();
-  }
+   /**
+    * List snapshots
+    * @return The snapshots
+    */
+   public static String[] listSnapshots()
+   {
+      return org.jboss.profiler.agent.Profiler.listSnapshots();
+   }
 
-  /**
-   * Enable the profiler
-   */
-  public static void enableProfiler() {
-    Agent.setEnabled(true);
-  }
+   /**
+    * Enable the profiler
+    */
+   public static void enableProfiler()
+   {
+      Agent.setEnabled(true);
+   }
 
-  /**
-   * Disable the profiler
-   */
-  public static void disableProfiler() {
-    Agent.setEnabled(false);
-  }
+   /**
+    * Disable the profiler
+    */
+   public static void disableProfiler()
+   {
+      Agent.setEnabled(false);
+   }
 
-  /**
-   * Add classes
-   * @param classes The classes
-   * @param v The visibility
-   */
-  public static void addClasses(String classes, String v) {
-    if (v == null || v.trim().equals("")) {
-      v = "public";
-    }
+   /**
+    * Add classes
+    * @param classes The classes
+    * @param v The visibility
+    */
+   public static void addClasses(String classes, String v)
+   {
+      if (v == null || v.trim().equals(""))
+      {
+         v = "public";
+      }
 
-    Visibility vi = null;
-    if (v.equalsIgnoreCase("private")) {
-      vi = Visibility.PRIVATE;
-    } else if (v.equalsIgnoreCase("protected")) {
-      vi = Visibility.PROTECTED;
-    } else if (v.equalsIgnoreCase("package")) {
-      vi = Visibility.PACKAGE;
-    } else {
-      vi = Visibility.PUBLIC;
-    }
+      Visibility vi = null;
+      if (v.equalsIgnoreCase("private"))
+      {
+         vi = Visibility.PRIVATE;
+      }
+      else if (v.equalsIgnoreCase("protected"))
+      {
+         vi = Visibility.PROTECTED;
+      }
+      else if (v.equalsIgnoreCase("package"))
+      {
+         vi = Visibility.PACKAGE;
+      }
+      else
+      {
+         vi = Visibility.PUBLIC;
+      }
 
-    Agent.addClasses(classes, vi);
-  }
+      Agent.addClasses(classes, vi);
+   }
 
-  /**
-   * Remove classes
-   * @param classes The classes
-   */
-  public static void removeClasses(String classes) {
-    Agent.removeClasses(classes);
-  }
+   /**
+    * Remove classes
+    * @param classes The classes
+    */
+   public static void removeClasses(String classes)
+   {
+      Agent.removeClasses(classes);
+   }
 
-  /**
-   * List classes
-   * @return The classes
-   */
-  public static String[] listClasses() {
-    return Agent.listClasses();
-  }
+   /**
+    * List classes
+    * @return The classes
+    */
+   public static String[] listClasses()
+   {
+      return Agent.listClasses();
+   }
 
-  /**
-   * Clear snapshots
-   */
-  public static void clearSnapshots() {
-    org.jboss.profiler.agent.Profiler.clearSnapshots();
-  }
+   /**
+    * Clear snapshots
+    */
+   public static void clearSnapshots()
+   {
+      org.jboss.profiler.agent.Profiler.clearSnapshots();
+   }
 
-  /**
-   * Garbage collection
-   */
-  public static void garbageCollection() {
-    org.jboss.profiler.agent.Profiler.garbageCollection();
-  }
+   /**
+    * Garbage collection
+    */
+   public static void garbageCollection()
+   {
+      org.jboss.profiler.agent.Profiler.garbageCollection();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/InventoryDataPoint.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/InventoryDataPoint.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/InventoryDataPoint.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,86 +1,136 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 
 package org.jboss.profiler.jvmti;
 
 import java.lang.ref.WeakReference;
 
 /**
- * Used to return quantity of instances and bytes per class 
- *  */
-public class InventoryDataPoint implements Comparable
+ * 
+ * This class is used to hold the metadata on memory profiler, being generated by JVMTIInterface.
+ * 
+ * @see {@link JVMTIInterface#createIndexMatrix()}
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class InventoryDataPoint implements Comparable<InventoryDataPoint>
 {
 
-   public InventoryDataPoint(final Class clazz)
+   /**
+    * 
+    * @param clazz The class used for this metadata
+    */
+   public InventoryDataPoint(final Class<?> clazz)
    {
-      this.clazz = new WeakReference(clazz);
+      this.clazz = new WeakReference<Class<?>>(clazz);
    }
 
-   public InventoryDataPoint(final Class clazz, final int instances)
+   /**
+    * 
+    * @param clazz The class used for this metadata
+    * @param instances Number of instances
+    */
+   public InventoryDataPoint(final Class<?> clazz, final int instances)
    {
-      this.clazz = new WeakReference(clazz);
+      this(clazz);
       this.instances = instances;
    }
 
-   WeakReference clazz;
+   /** The class */
+   private WeakReference<Class<?>> clazz;
 
+   /** # instances */
    int instances;
 
+   /** # bytes */
    long bytes;
 
+   /**
+    * return bytes
+    * @return bytes
+    */
    public long getBytes()
    {
       return bytes;
    }
 
+   /**
+    * set bytes
+    * @param bytes # bytes
+    */
    public void setBytes(final long bytes)
    {
       this.bytes = bytes;
    }
 
-   public Class getClazz()
+   /**
+    * Return the class used on the metadata
+    * @return the class
+    */
+   public Class<?> getClazz()
    {
-      return (Class)clazz.get();
+      return clazz.get();
    }
 
-   public void setClazz(final Class clazz)
+   /**
+    * Set the class used by the metadata
+    * @param clazz The class
+    */
+   public void setClazz(final Class<?> clazz)
    {
-      this.clazz = new WeakReference(clazz);
+      this.clazz = new WeakReference<Class<?>>(clazz);
    }
 
+   /**
+    * Get the number of instances
+    * @return # instances
+    */
    public int getInstances()
    {
       return instances;
    }
 
+   /**
+    * Set the number of instances 
+    * 
+    * @param instances # instances
+    */
    public void setInstances(final int instances)
    {
       this.instances = instances;
    }
 
-   public int compareTo(final Object o)
+   /**
+    * Used to order datasets and collections
+    * @param o the point being compared
+    * @return look at {@link Comparable#compareTo(Object)}
+    */
+   public int compareTo(final InventoryDataPoint o)
    {
-      InventoryDataPoint that = (InventoryDataPoint)o;
-      long result = that.bytes - bytes;
+      InventoryDataPoint that = o;
+      long result = that.bytes -
+            bytes;
       if (result == 0)
       {
          return 0;

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTICallBack.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTICallBack.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTICallBack.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,30 +1,30 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 
 package org.jboss.profiler.jvmti;
 
 /** 
  * Interface to get notifications for references on JVMTI
- * @author csuconic
+ * @author Clebert Suconic
  *
  */
 public interface JVMTICallBack
@@ -34,18 +34,27 @@
     * @param referenceHolder A tag id of an object  (if -1 means the root)
     * @param referencedObject A tag id of an object
     * @param fieldId A tag id for a Field referencing the object. If -1 that means a static reference in a method
+    * @param classTag A tag for the class holding the reference
+    * @param index The index about the operation (like the field ID, array number.. etc)
+    * @param method The method id (look at JVMTI docs)
+    * @param referenceType Look at {@link JVMTITypes}
     */
-   public void notifyReference(long referenceHolder,
-                               long referencedObject,
-                               long classTag,
-                               long index,
-                               long method,
-                               byte referenceType);
+   public void notifyReference(long referenceHolder, long referencedObject, long classTag, long index, long method,
+         byte referenceType);
 
-   /** Notifications of loaded classes*/
+   /**
+    * Notification about a class
+    * @param classTag the class tag id
+    * @param clazz the class name
+    */
    public void notifyClass(long classTag, Class<?> clazz);
 
-   /** Notifications of loaded classes*/
+   /** 
+    * Notification about an object
+    * @param classTag The class tag id
+    * @param objectId the object id
+    * @param bytes the number of bytes
+    */
    public void notifyObject(long classTag, long objectId, long bytes);
 
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTIInterface.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTIInterface.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTIInterface.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,8 +1,8 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
@@ -19,8 +19,11 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
+
 package org.jboss.profiler.jvmti;
 
+import org.jboss.profiler.jvmti.memoryweb.MemoryProfilerEmbedded;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.CharArrayWriter;
@@ -48,8 +51,6 @@
 import java.util.WeakHashMap;
 import java.util.concurrent.CountDownLatch;
 
-import org.jboss.profiler.jvmti.memoryweb.MemoryProfilerEmbedded;
-
 /**
  * @author Clebert Suconic
  */
@@ -92,7 +93,7 @@
    public Class<?>[] getAllClassMachingName(final String className)
    {
       Class<?> classes[] = getLoadedClasses();
-      
+
       ArrayList<Class<?>> foundClasses = new ArrayList<Class<?>>();
 
       for (Class<?> clazz : classes)
@@ -132,10 +133,8 @@
     * This method will keep every object tagged for later usage. This method is
     * going to tag objects.
     */
-   protected native void notifyInventory(boolean notifyOnClasses,
-                                         String temporaryFileReferences,
-                                         String temporaryFileObjects,
-                                         JVMTICallBack callback);
+   protected native void notifyInventory(boolean notifyOnClasses, String temporaryFileReferences,
+         String temporaryFileObjects, JVMTICallBack callback);
 
    public void notifyOnReferences(final String temporaryFile, final JVMTICallBack callback)
    {
@@ -218,9 +217,10 @@
    public void heapSnapshot(final String basicFileName, final String suffix)
    {
       forceGC();
-      heapSnapshot(basicFileName + "_classes" + "." + suffix,
-                   basicFileName + "_references" + "." + suffix,
-                   basicFileName + "_objects" + "." + suffix);
+      heapSnapshot(basicFileName +
+            "_classes" + "." + suffix, basicFileName +
+            "_references" + "." + suffix, basicFileName +
+            "_objects" + "." + suffix);
    }
 
    /**
@@ -271,7 +271,8 @@
 
       public int compareClassLoader(final ClassLoader left, final ClassLoader right)
       {
-         if (left == null || right == null)
+         if (left == null ||
+               right == null)
          {
             if (left == right)
             {
@@ -324,29 +325,34 @@
          {
             if (callToString)
             {
-               returnValue = "TOSTRING(" + obj.toString() + "), class=" + obj.getClass().getName();
+               returnValue = "TOSTRING(" +
+                     obj.toString() + "), class=" + obj.getClass().getName();
             }
             else
             {
                if (obj instanceof Class)
                {
-                  returnValue = "CLASS(" + obj.toString() + "), identifyHashCode=" + System.identityHashCode(obj);
+                  returnValue = "CLASS(" +
+                        obj.toString() + "), identifyHashCode=" + System.identityHashCode(obj);
                }
                else
                {
-                  returnValue = "OBJ(" + obj.getClass().getName() + "@" + System.identityHashCode(obj) + ")";
+                  returnValue = "OBJ(" +
+                        obj.getClass().getName() + "@" + System.identityHashCode(obj) + ")";
                }
             }
          }
       }
       catch (Throwable e)
       {
-         return obj.getClass().getName() + " toString had an Exception ";
+         return obj.getClass().getName() +
+               " toString had an Exception ";
       }
 
       if (returnValue.length() > 200)
       {
-         return "OBJ(" + obj.getClass().getName() + "@" + System.identityHashCode(obj) + ")";
+         return "OBJ(" +
+               obj.getClass().getName() + "@" + System.identityHashCode(obj) + ")";
       }
       else
       {
@@ -355,14 +361,8 @@
    }
 
    /** Explore references recursevely */
-   private void exploreObject(final PrintWriter out,
-                              final Object source,
-                              final int currentLevel,
-                              final int maxLevel,
-                              final boolean useToString,
-                              final boolean weakAndSoft,
-                              final Map mapDataPoints,
-                              final HashSet alreadyExplored)
+   private void exploreObject(final PrintWriter out, final Object source, final int currentLevel, final int maxLevel,
+         final boolean useToString, final boolean weakAndSoft, final Map mapDataPoints, final HashSet alreadyExplored)
    {
       String level = null;
       {
@@ -374,9 +374,11 @@
          level = levelStr.toString();
       }
 
-      if (maxLevel >= 0 && currentLevel >= maxLevel)
+      if (maxLevel >= 0 &&
+            currentLevel >= maxLevel)
       {
-         out.println("<br>" + level + "<b>MaxLevel</b>");
+         out.println("<br>" +
+               level + "<b>MaxLevel</b>");
          return;
       }
       Integer index = new Integer(System.identityHashCode(source));
@@ -385,21 +387,14 @@
       {
          if (source instanceof Class)
          {
-            out.println("<br>" + level +
-                        " object instanceOf " +
-                        source +
-                        "@" +
-                        index +
-                        " was already described before on this report");
+            out.println("<br>" +
+                  level + " object instanceOf " + source + "@" + index + " was already described before on this report");
          }
          else
          {
-            out.println("<br>" + level +
-                        " object instanceOf " +
-                        source.getClass() +
-                        "@" +
-                        index +
-                        " was already described before on this report");
+            out.println("<br>" +
+                  level + " object instanceOf " + source.getClass() + "@" + index +
+                  " was already described before on this report");
          }
          return;
       }
@@ -421,9 +416,11 @@
 
          Object nextReference = treatReference(level, out, point, useToString);
 
-         if (nextReference != null && !weakAndSoft)
+         if (nextReference != null &&
+               !weakAndSoft)
          {
-            if (nextReference instanceof WeakReference || nextReference instanceof SoftReference)
+            if (nextReference instanceof WeakReference ||
+                  nextReference instanceof SoftReference)
             {
                nextReference = null;
             }
@@ -452,13 +449,12 @@
     * @urlBaseToFollow will be concatenated objId=3> obj </a> to the
     *                  outputStream
     */
-   public Object treatReference(final String level,
-                                final PrintWriter out,
-                                final ReferenceDataPoint point,
-                                final boolean useToString)
+   public Object treatReference(final String level, final PrintWriter out, final ReferenceDataPoint point,
+         final boolean useToString)
    {
       Object referenceHolder = null;
-      if (point.getReferenceHolder() == 0 || point.getReferenceHolder() == -1)
+      if (point.getReferenceHolder() == 0 ||
+            point.getReferenceHolder() == -1)
       {
          referenceHolder = null;
       }
@@ -471,9 +467,8 @@
       {
          case JVMTITypes.JVMTI_REFERENCE_INSTANCE:
             ;// Reference from an object to its class.
-            out.println("<br>" + level +
-                        "InstanceOfReference:ToString=" +
-                        convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "InstanceOfReference:ToString=" + convertToString(referenceHolder, useToString));
 
             nextReference = referenceHolder;
             break;
@@ -507,18 +502,16 @@
                Field field = getObjectField(clazz, (int)point.getIndex());
                if (field == null)
                {
-                  fieldName = "UndefinedField@" + referenceHolder;
+                  fieldName = "UndefinedField@" +
+                        referenceHolder;
                }
                else
                {
                   fieldName = field.toString();
                }
             }
-            out.println("<br>" + level +
-                        " FieldReference " +
-                        fieldName +
-                        "=" +
-                        convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + " FieldReference " + fieldName + "=" + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          }
@@ -529,40 +522,41 @@
             // jvmtiObjectReferenceCallback is the array index.
             if (referenceHolder == null)
             {
-               out.println("<br>" + level + " arrayRef Position " + point.getIndex() + " is gone");
+               out.println("<br>" +
+                     level + " arrayRef Position " + point.getIndex() + " is gone");
             }
             else
             {
-               out.println("<br>" + level +
-                           " arrayRef " +
-                           referenceHolder.getClass().getName() +
-                           "[" +
-                           point.getIndex() +
-                           "] id=@" +
-                           System.identityHashCode(referenceHolder));
+               out.println("<br>" +
+                     level + " arrayRef " + referenceHolder.getClass().getName() + "[" + point.getIndex() + "] id=@" +
+                     System.identityHashCode(referenceHolder));
             }
             nextReference = referenceHolder;
             break;
          case JVMTITypes.JVMTI_REFERENCE_CLASS_LOADER:// Reference from a class
             // to its class loader.
-            out.println("<br>" + level + "ClassLoaderReference @ " + convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "ClassLoaderReference @ " + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          case JVMTITypes.JVMTI_REFERENCE_SIGNERS:// Reference from a class to its
             // signers array.
-            out.println("<br>" + level + "ReferenceSigner@" + convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "ReferenceSigner@" + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          case JVMTITypes.JVMTI_REFERENCE_PROTECTION_DOMAIN:// Reference from a
             // class to its
             // protection
             // domain.
-            out.println("<br>" + level + "ProtectionDomain@" + convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "ProtectionDomain@" + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          case JVMTITypes.JVMTI_REFERENCE_INTERFACE:// Reference from a class to
             // one of its interfaces.
-            out.println("<br>" + level + "ReferenceInterface@" + convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "ReferenceInterface@" + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          case JVMTITypes.JVMTI_REFERENCE_STATIC_FIELD:// Reference from a class
@@ -580,13 +574,15 @@
             String fieldName = null;
             if (field == null)
             {
-               fieldName = "UndefinedField@" + referenceHolder;
+               fieldName = "UndefinedField@" +
+                     referenceHolder;
             }
             else
             {
                fieldName = field.toString();
             }
-            out.println("<br>" + level + " StaticFieldReference " + fieldName);
+            out.println("<br>" +
+                  level + " StaticFieldReference " + fieldName);
             nextReference = null;
             break;
          }
@@ -598,11 +594,13 @@
             // into constant pool table of the class, starting at 1. See
             // The Constant Pool in the Java Virtual Machine
             // Specification.
-            out.println("<br>" + level + "ReferenceInterface@" + convertToString(referenceHolder, useToString));
+            out.println("<br>" +
+                  level + "ReferenceInterface@" + convertToString(referenceHolder, useToString));
             nextReference = referenceHolder;
             break;
          case JVMTITypes.ROOT_REFERENCE:
-            out.println("<br>" + level + "Root");
+            out.println("<br>" +
+                  level + "Root");
             nextReference = null;
             break;
          case JVMTITypes.THREAD_REFERENCE:
@@ -617,12 +615,14 @@
                }
 
                String methodName = getMethodName(point.getMethod());
-               out.println("<br>" + level + " Reference inside a method - " + className + "::" + methodName);
+               out.println("<br>" +
+                     level + " Reference inside a method - " + className + "::" + methodName);
             }
             nextReference = null;
             break;
          default:
-            System.out.println("unexpected reference " + point);
+            System.out.println("unexpected reference " +
+                  point);
       }
       return nextReference;
    }
@@ -643,19 +643,11 @@
       {
          int count = 0;
 
-         public void notifyReference(final long referenceHolder,
-                                     final long referencedObject,
-                                     final long classTag,
-                                     final long index,
-                                     final long method,
-                                     final byte referenceType)
+         public void notifyReference(final long referenceHolder, final long referencedObject, final long classTag,
+               final long index, final long method, final byte referenceType)
          {
-             ReferenceDataPoint dataPoint = new ReferenceDataPoint(referenceHolder,
-                                                                  referencedObject,
-                                                                  classTag,
-                                                                  index,
-                                                                  method,
-                                                                  referenceType);
+            ReferenceDataPoint dataPoint =
+                  new ReferenceDataPoint(referenceHolder, referencedObject, classTag, index, method, referenceType);
             Long indexLong = new Long(referencedObject);
             List<ReferenceDataPoint> arrayList = (ArrayList<ReferenceDataPoint>)referencesMap.get(indexLong);
             if (arrayList == null)
@@ -703,16 +695,13 @@
     *            If true, Will print (with toString) every single instance of
     *            the object passed as parameter
     */
-   public String exploreClassReferences(final String className,
-                                        final int maxLevel,
-                                        final boolean solveReferencesOnClasses,
-                                        final boolean solveReferencesOnClassLoaders,
-                                        final boolean useToString,
-                                        final boolean weakAndSoft,
-                                        final boolean printObjects)
+   public String exploreClassReferences(final String className, final int maxLevel,
+         final boolean solveReferencesOnClasses, final boolean solveReferencesOnClassLoaders,
+         final boolean useToString, final boolean weakAndSoft, final boolean printObjects)
    {
       forceGC();
-      if (!solveReferencesOnClasses && !solveReferencesOnClassLoaders && !printObjects)
+      if (!solveReferencesOnClasses &&
+            !solveReferencesOnClassLoaders && !printObjects)
       {
          return "<b> you have to select at least solveReferences || solveClassLoaders || printObjects </b>";
       }
@@ -756,10 +745,12 @@
 
                   if (objs.length != 0)
                   {
-                     out.println("<br> Instances of:" + clazz.getName() + " ClassLoader=" + clazz.getClassLoader());
+                     out.println("<br> Instances of:" +
+                           clazz.getName() + " ClassLoader=" + clazz.getClassLoader());
                      for (int countOBJ = 0; countOBJ < objs.length; countOBJ++)
                      {
-                        out.println("<br>" + clazz.getName() + "[" + countOBJ + "]=" + objs[countOBJ]);
+                        out.println("<br>" +
+                              clazz.getName() + "[" + countOBJ + "]=" + objs[countOBJ]);
                      }
                   }
                }
@@ -781,13 +772,9 @@
     * This is an overload to reuse the matrix index in case you already have
     * indexed the JVM
     */
-   public String exploreClassReferences(final String className,
-                                        final int maxLevel,
-                                        final boolean solveReferencesOnClasses,
-                                        final boolean solveReferencesOnClassLoaders,
-                                        final boolean useToString,
-                                        final boolean weakAndSoft,
-                                        final Map referencesMap)
+   public String exploreClassReferences(final String className, final int maxLevel,
+         final boolean solveReferencesOnClasses, final boolean solveReferencesOnClassLoaders,
+         final boolean useToString, final boolean weakAndSoft, final Map referencesMap)
    {
       CharArrayWriter charArray = new CharArrayWriter();
       PrintWriter out = new PrintWriter(charArray);
@@ -801,7 +788,8 @@
          {
             if (loadClasse.getName().equals(className))
             {
-               out.println("<br><br><br><b>References to " + loadClasse + "</b>");
+               out.println("<br><br><br><b>References to " +
+                     loadClasse + "</b>");
                if (solveReferencesOnClasses)
                {
                   exploreObject(out, loadClasse, 0, maxLevel, useToString, weakAndSoft, referencesMap, new HashSet());
@@ -810,7 +798,8 @@
                {
                   if (loadClasse.getClassLoader() != null)
                   {
-                     out.println("<br><b><i>references to its classloader " + loadClasse.getClassLoader() + "</i></b>");
+                     out.println("<br><b><i>references to its classloader " +
+                           loadClasse.getClassLoader() + "</i></b>");
                      exploreObject(out,
                                    loadClasse.getClassLoader(),
                                    0,
@@ -849,7 +838,8 @@
 
       Object obj[] = this.getAllObjects(className);
 
-      System.out.println("Obj.length = " + obj.length);
+      System.out.println("Obj.length = " +
+            obj.length);
 
       Map referencesMap = null;
       try
@@ -871,9 +861,9 @@
       {
          for (int i = 0; i < Math.min(50, obj.length); i++)
          {
-            out.println("<br><b>References to obj[" + i +
-                        "]=" +
-                        (useToString ? obj[i].toString() : obj[i].getClass().getName()));
+            out.println("<br><b>References to obj[" +
+                  i + "]=" + (useToString
+                        ? obj[i].toString() : obj[i].getClass().getName()));
             out.println(exploreObjectReferences(referencesMap, obj[i], maxLevel, useToString));
          }
          return charArray.toString();
@@ -889,10 +879,8 @@
     * Show the reference holders tree of an object. This returns a report you
     * can visualize through MBean.
     */
-   public String exploreObjectReferences(final Map referencesMap,
-                                         final Object thatObject,
-                                         final int maxLevel,
-                                         final boolean useToString)
+   public String exploreObjectReferences(final Map referencesMap, final Object thatObject, final int maxLevel,
+         final boolean useToString)
    {
       CharArrayWriter charArray = new CharArrayWriter();
       PrintWriter out = new PrintWriter(charArray);
@@ -926,7 +914,8 @@
       {
          while (true)
          {
-            list.add("A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String " + i++);
+            list.add("A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String " +
+                  i++);
             if (i % 1000 == 0) // doing the check on each 100 elements
             {
                if (reference.get() == null)
@@ -973,7 +962,8 @@
 
    public void startMemoryProfiler(final InetSocketAddress address, final CountDownLatch latchRunning) throws Exception
    {
-      System.out.println("JBoss Memory Profiler running on " + address);
+      System.out.println("JBoss Memory Profiler running on " +
+            address);
       MemoryProfilerEmbedded profilerServer = new MemoryProfilerEmbedded(address, latchRunning, this);
       profilerServer.start();
    }
@@ -1026,12 +1016,14 @@
                      printedHeader = true;
                   }
 
-                  out.println("<br>" + "<b> Class " + currentName + " was loaded on these classLoaders:</b>");
+                  out.println("<br>" +
+                        "<b> Class " + currentName + " was loaded on these classLoaders:</b>");
                   Iterator iterClassLoader = classLoaderDuplicates.iterator();
                   while (iterClassLoader.hasNext())
                   {
                      ClassLoader loader = (ClassLoader)iterClassLoader.next();
-                     out.println("<br>" + loader.toString());
+                     out.println("<br>" +
+                           loader.toString());
                   }
 
                }
@@ -1051,12 +1043,14 @@
 
          if (classLoaderDuplicates.size() > 1)
          {
-            out.println("<br>" + "<b> Class " + currentName + " was loaded on these classLoaders:</b>");
+            out.println("<br>" +
+                  "<b> Class " + currentName + " was loaded on these classLoaders:</b>");
             Iterator iterClassLoader = classLoaderDuplicates.iterator();
             while (iterClassLoader.hasNext())
             {
                ClassLoader loader = (ClassLoader)iterClassLoader.next();
-               out.println("<br>" + loader.toString());
+               out.println("<br>" +
+                     loader.toString());
             }
 
          }
@@ -1078,11 +1072,12 @@
             if (currentClassLoader != clazz.getClassLoader())
             {
                currentClassLoader = clazz.getClassLoader();
-               out.println("<br><b>ClassLoader = " + (currentClassLoader == null ? "System Class Loader"
-                                                                                : currentClassLoader.toString()) +
-                           "</b>");
+               out.println("<br><b>ClassLoader = " +
+                     (currentClassLoader == null
+                           ? "System Class Loader" : currentClassLoader.toString()) + "</b>");
             }
-            out.println("Class = " + clazz.getName());
+            out.println("Class = " +
+                  clazz.getName());
          }
 
          return new String(charArray.toCharArray());
@@ -1157,12 +1152,8 @@
 
       }
 
-      public void notifyReference(final long referenceHolder,
-                                  final long referencedObject,
-                                  final long classTag,
-                                  final long index,
-                                  final long method,
-                                  final byte referenceType)
+      public void notifyReference(final long referenceHolder, final long referencedObject, final long classTag,
+            final long index, final long method, final byte referenceType)
       {
       }
 
@@ -1192,12 +1183,8 @@
     *            instances each class could be generating.
     * @return true if the assertion is okay
     */
-   public boolean compareInventories(final PrintStream reportOutput,
-                                     final Map map1,
-                                     final Map map2,
-                                     final Class[] ignoredClasses,
-                                     final String[] prefixesToIgnore,
-                                     final InventoryDataPoint[] expectedIncreases)
+   public boolean compareInventories(final PrintStream reportOutput, final Map map1, final Map map2,
+         final Class[] ignoredClasses, final String[] prefixesToIgnore, final InventoryDataPoint[] expectedIncreases)
    {
       HashSet ignoredItems = new HashSet();
       if (ignoredClasses != null)
@@ -1246,7 +1233,8 @@
                }
             }
          }
-         if (!isIgnoredPrefix && !ignoredItems.contains(entry.getKey()))
+         if (!isIgnoredPrefix &&
+               !ignoredItems.contains(entry.getKey()))
          {
             InventoryDataPoint point1 = (InventoryDataPoint)entry.getValue();
             InventoryDataPoint point2 = (InventoryDataPoint)map2.get(clazz);
@@ -1258,7 +1246,8 @@
                   boolean failed = true;
                   if (expectedIncrease != null)
                   {
-                     if (point2.getInstances() - point1.getInstances() <= expectedIncrease.getInstances())
+                     if (point2.getInstances() -
+                           point1.getInstances() <= expectedIncrease.getInstances())
                      {
                         failed = false;
                      }
@@ -1271,16 +1260,15 @@
                         expected = expectedIncrease.getInstances();
                      }
                      reportOK = false;
-                     reportOutput.println("<br> Class " + clazz.getName() +
-                                          " had an increase of " +
-                                          (point2.getInstances() - point1.getInstances() - expected) +
-                                          " instances represented by " +
-                                          (point2.getBytes() - point1.getBytes()) +
-                                          " bytes");
+                     reportOutput.println("<br> Class " +
+                           clazz.getName() + " had an increase of " + (point2.getInstances() -
+                                 point1.getInstances() - expected) + " instances represented by " +
+                           (point2.getBytes() - point1.getBytes()) + " bytes");
                      if (expectedIncrease != null)
                      {
-                        reportOutput.print("<br> " + (point2.getInstances() - point1.getInstances() - expectedIncrease.getInstances()) +
-                                           " higher than expected");
+                        reportOutput.print("<br> " +
+                              (point2.getInstances() -
+                                    point1.getInstances() - expectedIncrease.getInstances()) + " higher than expected");
                      }
 
                   }
@@ -1360,12 +1348,9 @@
          InventoryDataPoint point = (InventoryDataPoint)iterDataPoints.next();
          if (html)
          {
-            out.println("<tr><td>" + point.getClazz().getName() +
-                        "</td><td>" +
-                        point.getInstances() +
-                        "</td><td>" +
-                        point.getBytes() +
-                        "</td></tr>");
+            out.println("<tr><td>" +
+                  point.getClazz().getName() + "</td><td>" + point.getInstances() + "</td><td>" + point.getBytes() +
+                  "</td></tr>");
          }
          else
          {
@@ -1403,7 +1388,8 @@
          if (object instanceof Object[])
          {
             out.println("</td><td>");
-            out.println("array of " + ((Object[])object).length);
+            out.println("array of " +
+                  ((Object[])object).length);
             out.println("</td></tr>");
          }
       }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTITypes.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTITypes.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/JVMTITypes.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,8 +1,8 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
@@ -69,7 +69,8 @@
             return "THREAD_REFERENCE";
 
          default:
-            return "UnknownReferenceType(" + referenceType + ")";
+            return "UnknownReferenceType(" +
+                  referenceType + ")";
 
       }
    }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/ReferenceDataPoint.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/ReferenceDataPoint.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/ReferenceDataPoint.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -1,24 +1,24 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 
 package org.jboss.profiler.jvmti;
 
@@ -114,19 +114,9 @@
    @Override
    public String toString()
    {
-      return super.toString() + " {referenceHolder=" +
-             referenceHolder +
-             "\n   referencedObject=" +
-             referencedObject +
-             "\n   classTag=" +
-             classTag +
-             "\n   index=" +
-             index +
-             "\n   method=" +
-             method +
-             "\n   referenceType=" +
-             referenceType +
-             "}";
+      return super.toString() +
+            " {referenceHolder=" + referenceHolder + "\n   referencedObject=" + referencedObject + "\n   classTag=" +
+            classTag + "\n   index=" + index + "\n   method=" + method + "\n   referenceType=" + referenceType + "}";
    }
 
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/AbstractHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/AbstractHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/AbstractHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,6 +22,9 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+
 import java.io.IOException;
 import java.io.PrintStream;
 import java.net.URI;
@@ -29,9 +32,6 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpHandler;
-
 /**
  * A AbstractHandler
  *
@@ -84,12 +84,14 @@
       catch (Throwable e)
       {
          e.printStackTrace();
-         output.println("Error: " + e.getMessage());
+         output.println("Error: " +
+               e.getMessage());
          output.close();
       }
    }
 
-   public abstract void handle(HttpExchange exchange, Map<String, String> queryAttributes, PrintStream output) throws Exception;
+   public abstract void handle(HttpExchange exchange, Map<String, String> queryAttributes, PrintStream output)
+      throws Exception;
 
    // Package protected ---------------------------------------------
 

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/InstancesHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/InstancesHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/InstancesHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,17 +22,17 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
+import org.jboss.profiler.jvmti.JVMTIInterface;
+import org.jboss.profiler.jvmti.JVMTITypes;
+import org.jboss.profiler.jvmti.ReferenceDataPoint;
+
+import com.sun.net.httpserver.HttpExchange;
+
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import com.sun.net.httpserver.HttpExchange;
-
-import org.jboss.profiler.jvmti.JVMTIInterface;
-import org.jboss.profiler.jvmti.JVMTITypes;
-import org.jboss.profiler.jvmti.ReferenceDataPoint;
-
 /**
  * A InstancesHandler
  *
@@ -66,9 +66,8 @@
     * @see org.jboss.profiler.jvmti.webembed.AbstractHandler#handle(com.sun.net.httpserver.HttpExchange, java.util.Map, java.io.PrintStream)
     */
    @Override
-   public synchronized void handle(final HttpExchange exchange,
-                                   final Map<String, String> queryAttributes,
-                                   final PrintStream output) throws Exception
+   public synchronized void handle(final HttpExchange exchange, final Map<String, String> queryAttributes,
+         final PrintStream output) throws Exception
    {
       JVMTIInterface jvmti = server.getJvmti();
       String classToPrint = queryAttributes.get("class");
@@ -81,16 +80,12 @@
 
       int elementNR = Integer.parseInt(elementStr);
 
-      output.println("<a href='./instances?class=" + classToPrint +
-                     "&element=" +
-                     (elementNR + NUMBER_OF_ELEMENTS) +
-                     "'>NEXT</a>");
+      output.println("<a href='./instances?class=" +
+            classToPrint + "&element=" + (elementNR + NUMBER_OF_ELEMENTS) + "'>NEXT</a>");
       if (elementNR > 0)
       {
-         output.println("<a href='./instances?class=" + classToPrint +
-                        "&element=" +
-                        (elementNR - NUMBER_OF_ELEMENTS) +
-                        "'>PREVIOUS</a>");
+         output.println("<a href='./instances?class=" +
+               classToPrint + "&element=" + (elementNR - NUMBER_OF_ELEMENTS) + "'>PREVIOUS</a>");
       }
 
       output.println("<br/>");
@@ -101,17 +96,18 @@
       {
          index = server.createIndex();
       }
-      
+
       Class<?>[] clazzes = jvmti.getAllClassMachingName(classToPrint);
-      
+
       output.println("Classes:<br/>");
       for (Class<?> clazzElement : clazzes)
       {
-         long classTagId = jvmti.getTagOnObject((Object)clazzElement);
-         output.println("<a href='./reference?obj0=" +classTagId + "'>" + clazzElement.getCanonicalName() + " with ClassLoader = (" + clazzElement.getClassLoader() + ")</a><br>");
+         long classTagId = jvmti.getTagOnObject(clazzElement);
+         output.println("<a href='./reference?obj0=" +
+               classTagId + "'>" + clazzElement.getCanonicalName() + " with ClassLoader = (" +
+               clazzElement.getClassLoader() + ")</a><br>");
       }
 
-      
       output.println("<br/><br/> Instances:<br/><br/>");
       Class clazz = jvmti.getClassByName(classToPrint);
 
@@ -124,9 +120,11 @@
 
       List<ReferenceDataPoint> references = index.get(objID);
 
-      if (references == null || references.size() == 0)
+      if (references == null ||
+            references.size() == 0)
       {
-         output.println("No Objects for " + classToPrint);
+         output.println("No Objects for " +
+               classToPrint);
          return;
       }
 
@@ -135,7 +133,8 @@
       int elementFound = 0;
       for (ReferenceDataPoint point : references)
       {
-         System.out.println("Reference = " + JVMTITypes.toString(point.getReferenceType()));
+         System.out.println("Reference = " +
+               JVMTITypes.toString(point.getReferenceType()));
          if (point.getReferenceType() == JVMTITypes.JVMTI_REFERENCE_INSTANCE)
          {
             if (elementFound++ >= elementNR)
@@ -166,7 +165,8 @@
             strName = referenced.toString();
          }
 
-         output.println("<a href='./reference?obj0=" + objReferencedID + "'>" + strName + "</a><br/>");
+         output.println("<a href='./reference?obj0=" +
+               objReferencedID + "'>" + strName + "</a><br/>");
       }
 
    }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/MemoryProfilerEmbedded.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/MemoryProfilerEmbedded.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/MemoryProfilerEmbedded.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,16 +22,16 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
+import org.jboss.profiler.jvmti.JVMTIInterface;
+import org.jboss.profiler.jvmti.ReferenceDataPoint;
+
+import com.sun.net.httpserver.HttpServer;
+
 import java.net.InetSocketAddress;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 
-import com.sun.net.httpserver.HttpServer;
-
-import org.jboss.profiler.jvmti.JVMTIInterface;
-import org.jboss.profiler.jvmti.ReferenceDataPoint;
-
 /**
  * A MemoryProfilerEmbedded
  *

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/ReferenceHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/ReferenceHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/ReferenceHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,17 +22,17 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
+import org.jboss.profiler.jvmti.JVMTIInterface;
+import org.jboss.profiler.jvmti.JVMTITypes;
+import org.jboss.profiler.jvmti.ReferenceDataPoint;
+
+import com.sun.net.httpserver.HttpExchange;
+
 import java.io.PrintStream;
 import java.lang.reflect.Field;
 import java.util.List;
 import java.util.Map;
 
-import com.sun.net.httpserver.HttpExchange;
-
-import org.jboss.profiler.jvmti.JVMTIInterface;
-import org.jboss.profiler.jvmti.JVMTITypes;
-import org.jboss.profiler.jvmti.ReferenceDataPoint;
-
 /**
  * A ReferenceHandler
  *
@@ -64,9 +64,8 @@
     * @see org.jboss.profiler.jvmti.webembed.AbstractHandler#handle(com.sun.net.httpserver.HttpExchange, java.util.Map, java.io.PrintStream)
     */
    @Override
-   public synchronized void handle(final HttpExchange exchange,
-                                   final Map<String, String> queryAttributes,
-                                   final PrintStream output) throws Exception
+   public synchronized void handle(final HttpExchange exchange, final Map<String, String> queryAttributes,
+         final PrintStream output) throws Exception
    {
 
       String query = exchange.getRequestURI().getRawQuery();
@@ -87,23 +86,27 @@
 
       while (true)
       {
-         if (queryAttributes.get("obj" + nparams) != null)
+         if (queryAttributes.get("obj" +
+               nparams) != null)
          {
             if (nparams > 0)
             {
                output.println(" -> ");
             }
-            objId = Integer.parseInt(queryAttributes.get("obj" + nparams));
+            objId = Integer.parseInt(queryAttributes.get("obj" +
+                  nparams));
             obj = jvmti.getObjectOnTag(objId);
 
-            String name = obj != null ? obj.toString() : "Null";
+            String name = obj != null
+                  ? obj.toString() : "Null";
 
             for (int i = 0; i < nparams; i++)
             {
                output.print("...");
             }
 
-            output.print(name + "<br/>");
+            output.print(name +
+                  "<br/>");
             nparams++;
          }
          else
@@ -114,7 +117,8 @@
 
       List<ReferenceDataPoint> list = index.get(objId);
 
-      if (list == null || list.isEmpty())
+      if (list == null ||
+            list.isEmpty())
       {
          output.println("Empty!");
          return;
@@ -122,7 +126,8 @@
 
       for (ReferenceDataPoint point : list)
       {
-         String newURL = "./reference?" + query + "&obj" + nparams + "=" + point.getReferenceHolder();
+         String newURL = "./reference?" +
+               query + "&obj" + nparams + "=" + point.getReferenceHolder();
 
          Object referenceHolder = null;
          if (point.getReferenceHolder() > 0)
@@ -143,24 +148,15 @@
 
             if (referencedField != null)
             {
-               output.println("Field reference:" + referencedField.getDeclaringClass().getCanonicalName() +
-                              "::" +
-                              referencedField.getName() +
+               output.println("Field reference:" +
+                     referencedField.getDeclaringClass().getCanonicalName() + "::" + referencedField.getName() +
 
-                              "<a href='" +
-                              newURL +
-                              "'>(" +
-                              jvmti.convertToString(referenceHolder, true) +
-                              ")</a><br/>");
+                     "<a href='" + newURL + "'>(" + jvmti.convertToString(referenceHolder, true) + ")</a><br/>");
             }
             else
             {
-               output.println("<a href='./reference?" + query +
-                              "&obj" +
-                              nparams +
-                              "=" +
-                              point.getReferenceHolder() +
-                              "'>Unkown Field reference</a><br/>");
+               output.println("<a href='./reference?" +
+                     query + "&obj" + nparams + "=" + point.getReferenceHolder() + "'>Unkown Field reference</a><br/>");
             }
 
          }
@@ -172,7 +168,8 @@
             }
             else
             {
-               output.println("Array Refeference: <a href='" + newURL + "'>" + "array[" + point.getIndex() + "]</a><br/>");
+               output.println("Array Refeference: <a href='" +
+                     newURL + "'>" + "array[" + point.getIndex() + "]</a><br/>");
             }
          }
          else if (point.getReferenceType() == JVMTITypes.ROOT_REFERENCE)
@@ -192,7 +189,8 @@
                }
 
                String methodName = jvmti.getMethodName(point.getMethod());
-               output.println("<br> Reference inside a method - " + className + "::" + methodName);
+               output.println("<br> Reference inside a method - " +
+                     className + "::" + methodName);
             }
          }
          else if (point.getReferenceType() == JVMTITypes.JVMTI_REFERENCE_STATIC_FIELD)
@@ -202,16 +200,16 @@
             String fieldName = null;
             if (field == null)
             {
-               fieldName = "UndefinedField@" + referenceHolder;
+               fieldName = "UndefinedField@" +
+                     referenceHolder;
             }
             else
             {
                fieldName = field.toString();
             }
-            output.println("<a href='" + newURL + "'>Static field reference:" + fieldName + "</a>");
+            output.println("<a href='" +
+                  newURL + "'>Static field reference:" + fieldName + "</a>");
          }
-         
-         
 
       }
    }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/RootHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/RootHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/RootHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,19 +22,16 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
-import java.io.CharArrayWriter;
+import org.jboss.profiler.jvmti.InventoryDataPoint;
+
+import com.sun.net.httpserver.HttpExchange;
+
 import java.io.PrintStream;
-import java.io.PrintWriter;
 import java.net.URLEncoder;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.TreeSet;
 
-import com.sun.net.httpserver.HttpExchange;
-
-import org.jboss.profiler.jvmti.InventoryDataPoint;
-import org.jboss.profiler.jvmti.JVMTIInterface;
-
 /**
  * A RootHandler
  *
@@ -66,9 +63,9 @@
    /* (non-Javadoc)
     * @see org.jboss.profiler.jvmti.webembed.AbstractHandler#handle(com.sun.net.httpserver.HttpExchange, java.util.Map)
     */
-   public synchronized void handle(final HttpExchange exchange,
-                                   final Map<String, String> queryAttributes,
-                                   final PrintStream output) throws Exception
+   @Override
+   public synchronized void handle(final HttpExchange exchange, final Map<String, String> queryAttributes,
+         final PrintStream output) throws Exception
    {
       server.clearIndex();
 
@@ -80,39 +77,26 @@
       output.println("<table>");
 
       output.println("<tr><td>Name</td><td>#Instances</td><td>#Bytes</td></tr>");
-      
-      
-      
-      
 
       while (iterDataPoints.hasNext())
       {
          InventoryDataPoint point = (InventoryDataPoint)iterDataPoints.next();
-         output.println("<tr><td><a href='./instances?class=" + URLEncoder.encode(point.getClazz().getName()) +
-                        "'>" +
-                        point.getClazz().getName() +
-                        "</a>" +
-                        "</td><td>" +
-                        point.getInstances() +
-                        "</td><td>" +
-                        point.getBytes() +
-                        "</td></tr>");
+         output.println("<tr><td><a href='./instances?class=" +
+               URLEncoder.encode(point.getClazz().getName()) + "'>" + point.getClazz().getName() + "</a>" +
+               "</td><td>" + point.getInstances() + "</td><td>" + point.getBytes() + "</td></tr>");
       }
 
       output.println("</table>");
    }
-   
-   
-   public synchronized void handle2(final HttpExchange exchange,
-                                   final Map<String, String> queryAttributes,
-                                   final PrintStream output) throws Exception
+
+   public synchronized void handle2(final HttpExchange exchange, final Map<String, String> queryAttributes,
+         final PrintStream output) throws Exception
    {
       server.clearIndex();
-      
+
       output.println(server.getJvmti().inventoryReport(true));
-      
+
    }
-   
 
    // Package protected ---------------------------------------------
 

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/StopHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/StopHandler.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/jvmti/memoryweb/StopHandler.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -22,11 +22,11 @@
 
 package org.jboss.profiler.jvmti.memoryweb;
 
+import com.sun.net.httpserver.HttpExchange;
+
 import java.io.PrintStream;
 import java.util.Map;
 
-import com.sun.net.httpserver.HttpExchange;
-
 /**
  * A StopHandler
  *
@@ -58,7 +58,8 @@
     * @see org.jboss.profiler.jvmti.webembed.AbstractHandler#handle(com.sun.net.httpserver.HttpExchange, java.util.Map, java.io.PrintStream)
     */
    @Override
-   public void handle(final HttpExchange exchange, final Map<String, String> queryAttributes, final PrintStream output) throws Exception
+   public void handle(final HttpExchange exchange, final Map<String, String> queryAttributes, final PrintStream output)
+      throws Exception
    {
       output.println("Profiler stopped");
       server.stop();

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Hibernate.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Hibernate.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Hibernate.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -44,225 +44,272 @@
  * The Hibernate plugin
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Hibernate implements Plugin {
+public class Hibernate implements Plugin
+{
 
-  /** The Hibernate constant */
-  private static final int HIBERNATE = 100;
+   /** The Hibernate constant */
+   private static final int HIBERNATE = 100;
 
-  /** The vendor */
-  private static final String VENDOR = "JBoss"; 
+   /** The vendor */
+   private static final String VENDOR = "JBoss";
 
-  /** The product */
-  private static final String PRODUCT = "Hibernate Profiler Plugin"; 
+   /** The product */
+   private static final String PRODUCT = "Hibernate Profiler Plugin";
 
-  /** The version */
-  private static final String VERSION = "1.0.CR1";
+   /** The version */
+   private static final String VERSION = "1.0.CR1";
 
-  /** Full version */
-  private static final String FULL_VERSION = VENDOR + " " + PRODUCT + " " + VERSION;
+   /** Full version */
+   private static final String FULL_VERSION = VENDOR + " " + PRODUCT + " " + VERSION;
 
-  /** HBM XML map */
-  private Map<ClassLoader, List<String>> hbmMap;
+   /** HBM XML map */
+   private Map<ClassLoader, List<String>> hbmMap;
 
-  /** Known classes */
-  private Set<String> known;
+   /** Known classes */
+   private Set<String> known;
 
-  /**
-   * Constructor
-   */
-  public Hibernate() {
-    known = new HashSet<String>();
-    hbmMap = new HashMap<ClassLoader, List<String>>();
-  }
+   /**
+    * Constructor
+    */
+   public Hibernate()
+   {
+      known = new HashSet<String>();
+      hbmMap = new HashMap<ClassLoader, List<String>>();
+   }
 
-  /**
-   * Get the name of the plugin
-   * @return The name
-   */
-  public String getName() {
-    return FULL_VERSION;
-  }
+   /**
+    * Get the name of the plugin
+    * @return The name
+    */
+   public String getName()
+   {
+      return FULL_VERSION;
+   }
 
-  /**
-   * Is the class supported by the plugin
-   * @param c The class
-   * @return True if supported; otherwise false
-   */
-  public boolean isSupported(Class c) {
+   /**
+    * Is the class supported by the plugin
+    * @param c The class
+    * @return True if supported; otherwise false
+    */
+   public boolean isSupported(Class c)
+   {
 
-    if (isAnnotated(c) || isHbmXml(c)) {
-      known.add(c.getName());
-      return true;
-    }
+      if (isAnnotated(c) || isHbmXml(c))
+      {
+         known.add(c.getName());
+         return true;
+      }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Get the type of the class
-   * @param c The class
-   * @return The type; negative if unknown
-   */
-  public int getType(Class c) {
-    if (known.contains(c.getName())) {
-      return HIBERNATE;
-    }
-    return -1;
-  }
+   /**
+    * Get the type of the class
+    * @param c The class
+    * @return The type; negative if unknown
+    */
+   public int getType(Class c)
+   {
+      if (known.contains(c.getName()))
+      {
+         return HIBERNATE;
+      }
+      return -1;
+   }
 
-  /**
-   * Get the description of the type
-   * @param type The type
-   * @return The description; otherwise null
-   */
-  public String getDescription(int type) {
-    if (HIBERNATE == type) {
-      return "HIBERNATE";
-    }
-    return null;
-  }
+   /**
+    * Get the description of the type
+    * @param type The type
+    * @return The description; otherwise null
+    */
+   public String getDescription(int type)
+   {
+      if (HIBERNATE == type)
+      {
+         return "HIBERNATE";
+      }
+      return null;
+   }
 
-  /**
-   * Annotated with @Entity
-   * @param clz The class
-   * @return True if found; otherwise false
-   */
-  private boolean isAnnotated(Class clz) {
-    if (clz != null) {
-      Annotation[] annotations = clz.getDeclaredAnnotations();
-      for (Annotation ca : annotations) {
-        if (ca.annotationType().getName().startsWith("org.hibernate.annotations.Entity")) {
-          return true;
-        }
+   /**
+    * Annotated with @Entity
+    * @param clz The class
+    * @return True if found; otherwise false
+    */
+   private boolean isAnnotated(Class clz)
+   {
+      if (clz != null)
+      {
+         Annotation[] annotations = clz.getDeclaredAnnotations();
+         for (Annotation ca : annotations)
+         {
+            if (ca.annotationType().getName().startsWith("org.hibernate.annotations.Entity"))
+            {
+               return true;
+            }
+         }
+
+         return isAnnotated(clz.getSuperclass());
       }
 
-      return isAnnotated(clz.getSuperclass());
-    }
+      return false;
+   }
 
-    return false;
-  }
+   /**
+    * .hbm.xml
+    * @param clz The class
+    * @return True if found; otherwise false
+    */
+   private boolean isHbmXml(Class clz)
+   {
+      if (hbmMap.get(clz.getClassLoader()) == null)
+      {
+         loadHibernateCfgXml(clz);
+      }
 
-  /**
-   * .hbm.xml
-   * @param clz The class
-   * @return True if found; otherwise false
-   */
-  private boolean isHbmXml(Class clz) {
-    if (hbmMap.get(clz.getClassLoader()) == null) {
-      loadHibernateCfgXml(clz);
-    }
+      List<String> classes = hbmMap.get(clz.getClassLoader());
 
-    List<String> classes = hbmMap.get(clz.getClassLoader());
-
-    for (String c : classes) {
-      if (clz.getName().equals(c)) {
-        return true;
+      for (String c : classes)
+      {
+         if (clz.getName().equals(c))
+         {
+            return true;
+         }
       }
-    }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Load
-   * @param clz The class
-   */
-  private void loadHibernateCfgXml(Class clz) {
-    List<String> result = new ArrayList<String>();
+   /**
+    * Load
+    * @param clz The class
+    */
+   private void loadHibernateCfgXml(Class clz)
+   {
+      List<String> result = new ArrayList<String>();
 
-    InputStream hibernateCfgXml = null;
+      InputStream hibernateCfgXml = null;
 
-    try {
-      ClassLoader cl = clz.getClassLoader();
-      String file = "hibernate.cfg.xml";
+      try
+      {
+         ClassLoader cl = clz.getClassLoader();
+         String file = "hibernate.cfg.xml";
 
-      hibernateCfgXml = cl.getResourceAsStream(file);
-      
-      while (hibernateCfgXml == null && cl != null) {
-        cl = cl.getParent();
-        if (cl != null) {
-          hibernateCfgXml = cl.getResourceAsStream(file);
-        }
-      }
-      
-      if (hibernateCfgXml != null) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Document wd = db.parse(hibernateCfgXml);
+         hibernateCfgXml = cl.getResourceAsStream(file);
 
-        NodeList nl = wd.getElementsByTagName("mapping");
+         while (hibernateCfgXml == null && cl != null)
+         {
+            cl = cl.getParent();
+            if (cl != null)
+            {
+               hibernateCfgXml = cl.getResourceAsStream(file);
+            }
+         }
 
-        for (int i = 0; i < nl.getLength(); i++) {
-          Node n = nl.item(i);
+         if (hibernateCfgXml != null)
+         {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document wd = db.parse(hibernateCfgXml);
 
-          if (n.hasAttributes()) {
-            Node att = n.getAttributes().getNamedItem("resource");
-            if (att != null) {
-              result.addAll(loadHbmXml(cl, att.getNodeValue()));
+            NodeList nl = wd.getElementsByTagName("mapping");
+
+            for (int i = 0; i < nl.getLength(); i++)
+            {
+               Node n = nl.item(i);
+
+               if (n.hasAttributes())
+               {
+                  Node att = n.getAttributes().getNamedItem("resource");
+                  if (att != null)
+                  {
+                     result.addAll(loadHbmXml(cl, att.getNodeValue()));
+                  }
+               }
             }
-          }
-        }
-      }
+         }
 
-    } catch (Exception e) {
-      //
-    } finally {
-      if (hibernateCfgXml != null) {
-        try {
-          hibernateCfgXml.close();
-        } catch (IOException ioe) {
-          //
-        }
       }
-    }
+      catch (Exception e)
+      {
+         //
+      }
+      finally
+      {
+         if (hibernateCfgXml != null)
+         {
+            try
+            {
+               hibernateCfgXml.close();
+            }
+            catch (IOException ioe)
+            {
+               //
+            }
+         }
+      }
 
-    hbmMap.put(clz.getClassLoader(), result);
-  }
+      hbmMap.put(clz.getClassLoader(), result);
+   }
 
-  /**
-   * Load hbm.xml file
-   * @param cl The class loader
-   * @param file The file
-   * @return The Hibernate classes
-   */
-  private List<String> loadHbmXml(ClassLoader cl, String file) {
-    List<String> result = new ArrayList<String>();
-    InputStream hbmXml = null;
+   /**
+    * Load hbm.xml file
+    * @param cl The class loader
+    * @param file The file
+    * @return The Hibernate classes
+    */
+   private List<String> loadHbmXml(ClassLoader cl, String file)
+   {
+      List<String> result = new ArrayList<String>();
+      InputStream hbmXml = null;
 
-    try {
-      hbmXml = cl.getResourceAsStream(file);
-      
-      if (hbmXml != null) {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Document wd = db.parse(hbmXml);
+      try
+      {
+         hbmXml = cl.getResourceAsStream(file);
 
-        NodeList nl = wd.getElementsByTagName("class");
-          
-        for (int i = 0; i < nl.getLength(); i++) {
-          Node n = nl.item(i);
+         if (hbmXml != null)
+         {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document wd = db.parse(hbmXml);
 
-          if (n.hasAttributes()) {
-            Node att = n.getAttributes().getNamedItem("name");
-            if (att != null) {
-              result.add(att.getNodeValue());
+            NodeList nl = wd.getElementsByTagName("class");
+
+            for (int i = 0; i < nl.getLength(); i++)
+            {
+               Node n = nl.item(i);
+
+               if (n.hasAttributes())
+               {
+                  Node att = n.getAttributes().getNamedItem("name");
+                  if (att != null)
+                  {
+                     result.add(att.getNodeValue());
+                  }
+               }
             }
-          }
-        }
+         }
+
       }
-      
-    } catch (Exception e) {
-      //
-    } finally {
-      if (hbmXml != null) {
-        try {
-          hbmXml.close();
-        } catch (IOException ioe) {
-          //
-        }
+      catch (Exception e)
+      {
+         //
       }
-    }
+      finally
+      {
+         if (hbmXml != null)
+         {
+            try
+            {
+               hbmXml.close();
+            }
+            catch (IOException ioe)
+            {
+               //
+            }
+         }
+      }
 
-    return result;
-  }
+      return result;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Seam.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Seam.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/plugins/Seam.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,97 +31,110 @@
  * The Seam plugin
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Seam implements Plugin {
+public class Seam implements Plugin
+{
 
-  /** The Seam constant */
-  private static final int SEAM = 100;
+   /** The Seam constant */
+   private static final int SEAM = 100;
 
-  /** The vendor */
-  private static final String VENDOR = "JBoss"; 
+   /** The vendor */
+   private static final String VENDOR = "JBoss";
 
-  /** The product */
-  private static final String PRODUCT = "Seam Profiler Plugin"; 
+   /** The product */
+   private static final String PRODUCT = "Seam Profiler Plugin";
 
-  /** The version */
-  private static final String VERSION = "1.0.CR1";
+   /** The version */
+   private static final String VERSION = "1.0.CR1";
 
-  /** Full version */
-  private static final String FULL_VERSION = VENDOR + " " + PRODUCT + " " + VERSION;
+   /** Full version */
+   private static final String FULL_VERSION = VENDOR + " " + PRODUCT + " " + VERSION;
 
-  /** Known classes */
-  private Set<String> known;
+   /** Known classes */
+   private Set<String> known;
 
-  /**
-   * Constructor
-   */
-  public Seam() {
-    known = new HashSet<String>();
-  }
+   /**
+    * Constructor
+    */
+   public Seam()
+   {
+      known = new HashSet<String>();
+   }
 
-  /**
-   * Get the name of the plugin
-   * @return The name
-   */
-  public String getName() {
-    return FULL_VERSION;
-  }
+   /**
+    * Get the name of the plugin
+    * @return The name
+    */
+   public String getName()
+   {
+      return FULL_VERSION;
+   }
 
-  /**
-   * Is the class supported by the plugin
-   * @param c The class
-   * @return True if supported; otherwise false
-   */
-  public boolean isSupported(Class c) {
+   /**
+    * Is the class supported by the plugin
+    * @param c The class
+    * @return True if supported; otherwise false
+    */
+   public boolean isSupported(Class c)
+   {
 
-    if (isAnnotated(c)) {
-      known.add(c.getName());
-      return true;
-    }
+      if (isAnnotated(c))
+      {
+         known.add(c.getName());
+         return true;
+      }
 
-    return false;
-  }
+      return false;
+   }
 
-  /**
-   * Get the type of the class
-   * @param c The class
-   * @return The type; negative if unknown
-   */
-  public int getType(Class c) {
-    if (known.contains(c.getName())) {
-      return SEAM;
-    }
-    return -1;
-  }
+   /**
+    * Get the type of the class
+    * @param c The class
+    * @return The type; negative if unknown
+    */
+   public int getType(Class c)
+   {
+      if (known.contains(c.getName()))
+      {
+         return SEAM;
+      }
+      return -1;
+   }
 
-  /**
-   * Get the description of the type
-   * @param type The type
-   * @return The description; otherwise null
-   */
-  public String getDescription(int type) {
-    if (SEAM == type) {
-      return "SEAM";
-    }
-    return null;
-  }
+   /**
+    * Get the description of the type
+    * @param type The type
+    * @return The description; otherwise null
+    */
+   public String getDescription(int type)
+   {
+      if (SEAM == type)
+      {
+         return "SEAM";
+      }
+      return null;
+   }
 
-  /**
-   * Annotated with @Entity
-   * @param clz The class
-   * @return True if found; otherwise false
-   */
-  private boolean isAnnotated(Class clz) {
-    if (clz != null) {
-      Annotation[] annotations = clz.getDeclaredAnnotations();
-      for (Annotation ca : annotations) {
-        if (ca.annotationType().getName().startsWith("org.jboss.seam.annotations.Name")) {
-          return true;
-        }
+   /**
+    * Annotated with @Entity
+    * @param clz The class
+    * @return True if found; otherwise false
+    */
+   private boolean isAnnotated(Class clz)
+   {
+      if (clz != null)
+      {
+         Annotation[] annotations = clz.getDeclaredAnnotations();
+         for (Annotation ca : annotations)
+         {
+            if (ca.annotationType().getName().startsWith("org.jboss.seam.annotations.Name"))
+            {
+               return true;
+            }
+         }
+
+         return isAnnotated(clz.getSuperclass());
       }
 
-      return isAnnotated(clz.getSuperclass());
-    }
-
-    return false;
-  }
+      return false;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,21 +28,28 @@
  * Allocation comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class AllocationComparator implements Comparator<AllocationInfo>, Serializable {
+public class AllocationComparator implements Comparator<AllocationInfo>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param a1 Allocation info
-   * @param a2 Allocation info
-   * @return Positive if a1 greater than a2; zero if equal otherwise negative
-   */
-  public int compare(AllocationInfo a1, AllocationInfo a2) {
-    if (a2.getCount() > a1.getCount()) {
-      return 1;
-    } else if (a2.getCount() == a1.getCount()) { 
-      return a1.getClassName().compareTo(a2.getClassName());
-    } else {
-      return -1;
-    }
-  }
+   /**
+    * Compare two objects
+    * @param a1 Allocation info
+    * @param a2 Allocation info
+    * @return Positive if a1 greater than a2; zero if equal otherwise negative
+    */
+   public int compare(AllocationInfo a1, AllocationInfo a2)
+   {
+      if (a2.getCount() > a1.getCount())
+      {
+         return 1;
+      }
+      else if (a2.getCount() == a1.getCount())
+      {
+         return a1.getClassName().compareTo(a2.getClassName());
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/AllocationInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,46 +27,51 @@
  * Represents allocations for a class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class AllocationInfo implements Serializable {
+public class AllocationInfo implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -2265307853705778866L;
+   /** Serial version UID */
+   static final long serialVersionUID = -2265307853705778866L;
 
-  /** The class name */
-  private String className;
+   /** The class name */
+   private String className;
 
-  /** The allocation count */
-  private long count;
-  
-  /**
-   * Constructor
-   * @param className The class name
-   */
-  public AllocationInfo(String className) {
-    this.className = className.replace('/', '.');
-    this.count = 0;
-  }
-  
-  /**
-   * Get the class name
-   * @return The name
-   */
-  public String getClassName() {
-    return className;
-  }
+   /** The allocation count */
+   private long count;
 
-  /**
-   * Get the allocation count
-   * @return The count
-   */
-  public long getCount() {
-    return count;
-  }
+   /**
+    * Constructor
+    * @param className The class name
+    */
+   public AllocationInfo(String className)
+   {
+      this.className = className.replace('/', '.');
+      this.count = 0;
+   }
 
-  /**
-   * Increase the allocation count (agent only)
-   */
-  public void increase() {
-    count++;
-  }
+   /**
+    * Get the class name
+    * @return The name
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Get the allocation count
+    * @return The count
+    */
+   public long getCount()
+   {
+      return count;
+   }
+
+   /**
+    * Increase the allocation count (agent only)
+    */
+   public void increase()
+   {
+      count++;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,15 +28,17 @@
  * Class comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassComparator implements Comparator<ClassInfo>, Serializable {
+public class ClassComparator implements Comparator<ClassInfo>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param ca Class info
-   * @param cb Class info
-   * @return Positive if ca greater than cb; zero if equal otherwise negative
-   */
-  public int compare(ClassInfo ca, ClassInfo cb) {
-    return ca.getClassName().compareTo(cb.getClassName());
-  }
+   /**
+    * Compare two objects
+    * @param ca Class info
+    * @param cb Class info
+    * @return Positive if ca greater than cb; zero if equal otherwise negative
+    */
+   public int compare(ClassInfo ca, ClassInfo cb)
+   {
+      return ca.getClassName().compareTo(cb.getClassName());
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,73 +27,82 @@
  * Represents a class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ClassInfo implements Serializable {
+public class ClassInfo implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = 7377350379376880440L;
+   /** Serial version UID */
+   static final long serialVersionUID = 7377350379376880440L;
 
-  /** The class name */
-  private String className;
-  
-  /** The class type */
-  private int classType;
-  
-  /**
-   * Constructor
-   * @param className The class name
-   * @param classType The class type
-   */
-  public ClassInfo(String className, int classType) {
-    this.className = className;
-    this.classType = classType;
-  }
+   /** The class name */
+   private String className;
 
-  /**
-   * Get the class name
-   * @return The name
-   */
-  public String getClassName() {
-    return className;
-  }
+   /** The class type */
+   private int classType;
 
-  /**
-   * Get the class type
-   * @return The type
-   */
-  public int getClassType() {
-    return classType;
-  }
+   /**
+    * Constructor
+    * @param className The class name
+    * @param classType The class type
+    */
+   public ClassInfo(String className, int classType)
+   {
+      this.className = className;
+      this.classType = classType;
+   }
 
-  /**
-   * Equals
-   * @param other The other object
-   * @return True if equal; otherwise false
-   */
-  @Override
-  public boolean equals(Object other) {
-    if (!(other instanceof ClassInfo)) {
-      return false;
-    }
+   /**
+    * Get the class name
+    * @return The name
+    */
+   public String getClassName()
+   {
+      return className;
+   }
 
-    ClassInfo ci = (ClassInfo)other;
-    return this.className.equals(ci.getClassName());
-  }
+   /**
+    * Get the class type
+    * @return The type
+    */
+   public int getClassType()
+   {
+      return classType;
+   }
 
-  /**
-   * Hash code
-   * @return The hash code
-   */
-  @Override
-  public int hashCode() {
-    return className.hashCode();
-  }
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+      if (!(other instanceof ClassInfo))
+      {
+         return false;
+      }
 
-  /**
-   * Get the string representation
-   * @return The string
-   */
-  @Override
-  public String toString() {
-    return className + "," + classType;
-  }
+      ClassInfo ci = (ClassInfo)other;
+      return this.className.equals(ci.getClassName());
+   }
+
+   /**
+    * Hash code
+    * @return The hash code
+    */
+   @Override
+   public int hashCode()
+   {
+      return className.hashCode();
+   }
+
+   /**
+    * Get the string representation
+    * @return The string
+    */
+   @Override
+   public String toString()
+   {
+      return className +
+            "," + classType;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassType.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassType.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ClassType.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -26,80 +26,81 @@
  * This is not an enum since plugins should be able to defined their own constants.
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface ClassType {
+public interface ClassType
+{
 
-  /**
-   * Plain Old Java Object (POJO)
-   */
-  public static final int POJO = 0;
+   /**
+    * Plain Old Java Object (POJO)
+    */
+   public static final int POJO = 0;
 
-  /**
-   * Throwable
-   */
-  public static final int THROWABLE = 1;
+   /**
+    * Throwable
+    */
+   public static final int THROWABLE = 1;
 
-  /**
-   * Enterprise JavaBean: Session
-   */
-  public static final int EJB_SESSION = 2;
+   /**
+    * Enterprise JavaBean: Session
+    */
+   public static final int EJB_SESSION = 2;
 
-  /**
-   * Enterprise JavaBean: Entity
-   */
-  public static final int EJB_ENTITY = 3;
+   /**
+    * Enterprise JavaBean: Entity
+    */
+   public static final int EJB_ENTITY = 3;
 
-  /**
-   * Enterprise JavaBean: Message
-   */
-  public static final int EJB_MESSAGE = 4;
+   /**
+    * Enterprise JavaBean: Message
+    */
+   public static final int EJB_MESSAGE = 4;
 
-  /**
-   * Servlet
-   */
-  public static final int SERVLET = 5;
+   /**
+    * Servlet
+    */
+   public static final int SERVLET = 5;
 
-  /**
-   * Servlet filter
-   */
-  public static final int SERVLET_FILTER = 6;
+   /**
+    * Servlet filter
+    */
+   public static final int SERVLET_FILTER = 6;
 
-  /**
-   * JavaServer Page
-   */
-  public static final int JSP = 7;
+   /**
+    * JavaServer Page
+    */
+   public static final int JSP = 7;
 
-  /**
-   * JMX: MBean
-   */
-  public static final int JMX_MBEAN = 8;
+   /**
+    * JMX: MBean
+    */
+   public static final int JMX_MBEAN = 8;
 
-  /**
-   * JavaServer Faces: Converter
-   */
-  public static final int JSF_CONVERTER = 9;
+   /**
+    * JavaServer Faces: Converter
+    */
+   public static final int JSF_CONVERTER = 9;
 
-  /**
-   * JavaServer Faces: Managed bean
-   */
-  public static final int JSF_MANAGED_BEAN = 10;
+   /**
+    * JavaServer Faces: Managed bean
+    */
+   public static final int JSF_MANAGED_BEAN = 10;
 
-  /**
-   * RMI: Remote
-   */
-  public static final int RMI_REMOTE = 11;
+   /**
+    * RMI: Remote
+    */
+   public static final int RMI_REMOTE = 11;
 
-  /**
-   * RMI: Server
-   */
-  public static final int RMI_SERVER = 12;
+   /**
+    * RMI: Server
+    */
+   public static final int RMI_SERVER = 12;
 
-  /**
-   * CORBA: Object
-   */
-  public static final int CORBA_OBJECT = 13;
+   /**
+    * CORBA: Object
+    */
+   public static final int CORBA_OBJECT = 13;
 
-  /**
-   * CORBA: Servant
-   */
-  public static final int CORBA_SERVANT = 14;
+   /**
+    * CORBA: Servant
+    */
+   public static final int CORBA_SERVANT = 14;
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Command.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Command.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Command.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,48 +27,53 @@
  * The client / server API
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Command implements Serializable {
+public class Command implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -5659221681712713474L;
+   /** Serial version UID */
+   static final long serialVersionUID = -5659221681712713474L;
 
-  /** The command type */
-  private CommandType cmd;
+   /** The command type */
+   private CommandType cmd;
 
-  /** The argument */
-  private Object[] args;
+   /** The argument */
+   private Object[] args;
 
-  /**
-   * Constructor
-   * @param cmd The command
-   */
-  public Command(CommandType cmd) {
-    this(cmd, null);
-  }
+   /**
+    * Constructor
+    * @param cmd The command
+    */
+   public Command(CommandType cmd)
+   {
+      this(cmd, null);
+   }
 
-  /**
-   * Constructor
-   * @param cmd The command
-   * @param args The arguments
-   */
-  public Command(CommandType cmd, Object[] args) {
-    this.cmd = cmd;
-    this.args = args;
-  }
+   /**
+    * Constructor
+    * @param cmd The command
+    * @param args The arguments
+    */
+   public Command(CommandType cmd, Object[] args)
+   {
+      this.cmd = cmd;
+      this.args = args;
+   }
 
-  /**
-   * Get the command
-   * @return The command
-   */
-  public CommandType getCommand() {
-    return cmd;
-  }
+   /**
+    * Get the command
+    * @return The command
+    */
+   public CommandType getCommand()
+   {
+      return cmd;
+   }
 
-  /**
-   * Get the arguments
-   * @return The arguments
-   */
-  public Object[] getArguments() {
-    return args;
-  }
+   /**
+    * Get the arguments
+    * @return The arguments
+    */
+   public Object[] getArguments()
+   {
+      return args;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,80 +25,81 @@
  * Defines the different command types
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public enum CommandType {
+public enum CommandType
+{
 
-  /**
-   * Start the profiler
-   */
-  START_PROFILER,
-  
-  /**
-   * Stop the profiler
-   */
-  STOP_PROFILER,
-  
-  /**
-   * Take a snapshot
-   */
-  SNAPSHOT,
-  
-  /**
-   * Get a snapshot
-   */
-  GET_SNAPSHOT,
-  
-  /**
-   * List snapshots
-   */
-  LIST_SNAPSHOTS,
-  
-  /**
-   * Clear snapshots
-   */
-  CLEAR_SNAPSHOTS,
-  
-  /**
-   * Trigger garbage collection
-   */
-  GC,
+   /**
+    * Start the profiler
+    */
+   START_PROFILER,
 
-  /**
-   * Enable profiler
-   */
-  ENABLE,
+   /**
+    * Stop the profiler
+    */
+   STOP_PROFILER,
 
-  /**
-   * Disable profiler
-   */
-  DISABLE,
+   /**
+    * Take a snapshot
+    */
+   SNAPSHOT,
 
-  /**
-   * Load a snapshot
-   */
-  LOAD,
+   /**
+    * Get a snapshot
+    */
+   GET_SNAPSHOT,
 
-  /**
-   * Save a snapshot
-   */
-  SAVE,
+   /**
+    * List snapshots
+    */
+   LIST_SNAPSHOTS,
 
-  /**
-   * Difference between snapshots
-   */
-  DIFFERENCE,
+   /**
+    * Clear snapshots
+    */
+   CLEAR_SNAPSHOTS,
 
-  /**
-   * Add classes
-   */
-  ADD_CLASSES,
+   /**
+    * Trigger garbage collection
+    */
+   GC,
 
-  /**
-   * Remove classes
-   */
-  REMOVE_CLASSES,
+   /**
+    * Enable profiler
+    */
+   ENABLE,
 
-  /**
-   * List classes
-   */
-  LIST_CLASSES
+   /**
+    * Disable profiler
+    */
+   DISABLE,
+
+   /**
+    * Load a snapshot
+    */
+   LOAD,
+
+   /**
+    * Save a snapshot
+    */
+   SAVE,
+
+   /**
+    * Difference between snapshots
+    */
+   DIFFERENCE,
+
+   /**
+    * Add classes
+    */
+   ADD_CLASSES,
+
+   /**
+    * Remove classes
+    */
+   REMOVE_CLASSES,
+
+   /**
+    * List classes
+    */
+   LIST_CLASSES
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,21 +28,28 @@
  * Frame comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class FrameComparator implements Comparator<FrameInfo>, Serializable {
+public class FrameComparator implements Comparator<FrameInfo>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param fa Frame info
-   * @param fb Frame info
-   * @return Positive if fb greater than fa; zero if equal otherwise negative
-   */
-  public int compare(FrameInfo fa, FrameInfo fb) {
-    if (fa.getNetTime() < fb.getNetTime()) {
-      return 1;
-    } else if (fa.getNetTime() == fb.getNetTime()) { 
-      return 0;
-    } else {
-      return -1;
-    }
-  }
+   /**
+    * Compare two objects
+    * @param fa Frame info
+    * @param fb Frame info
+    * @return Positive if fb greater than fa; zero if equal otherwise negative
+    */
+   public int compare(FrameInfo fa, FrameInfo fb)
+   {
+      if (fa.getNetTime() < fb.getNetTime())
+      {
+         return 1;
+      }
+      else if (fa.getNetTime() == fb.getNetTime())
+      {
+         return 0;
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameHelper.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameHelper.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameHelper.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -34,80 +34,102 @@
  * The frame helper
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class FrameHelper {
+public class FrameHelper
+{
 
-  /**
-   * Constructor
-   */
-  private FrameHelper() {
-  }
+   /**
+    * Constructor
+    */
+   private FrameHelper()
+   {
+   }
 
-  /**
-   * Load a frame
-   * @param file The file
-   * @return The frame
-   * @exception IOException If an error occurs
-   */
-  public static FrameInfo load(File file) throws IOException {
-    FrameInfo fi = null;
-    FileInputStream fis = null;
+   /**
+    * Load a frame
+    * @param file The file
+    * @return The frame
+    * @exception IOException If an error occurs
+    */
+   public static FrameInfo load(File file) throws IOException
+   {
+      FrameInfo fi = null;
+      FileInputStream fis = null;
 
-    if (file != null && file.exists()) {
-      try {
-        fis = new FileInputStream(file);
-        GZIPInputStream gis = new GZIPInputStream(fis);
-        ObjectInputStream ois = new ObjectInputStream(gis);
-        fi = (FrameInfo)ois.readObject();
-      } catch (Exception e) {
-        IOException ioe = new IOException(e.getMessage());
-        ioe.initCause(e);
-        throw ioe;
-      } finally {
-        if (fis != null) {
-          try {
-            fis.close();
-          } catch (Exception ne) {
-            // Ignore
-          }
-        }
+      if (file != null &&
+            file.exists())
+      {
+         try
+         {
+            fis = new FileInputStream(file);
+            GZIPInputStream gis = new GZIPInputStream(fis);
+            ObjectInputStream ois = new ObjectInputStream(gis);
+            fi = (FrameInfo)ois.readObject();
+         }
+         catch (Exception e)
+         {
+            IOException ioe = new IOException(e.getMessage());
+            ioe.initCause(e);
+            throw ioe;
+         }
+         finally
+         {
+            if (fis != null)
+            {
+               try
+               {
+                  fis.close();
+               }
+               catch (Exception ne)
+               {
+                  // Ignore
+               }
+            }
+         }
       }
-    } else {
-      throw new IOException("File " + file + " does not exist");
-    }
+      else
+      {
+         throw new IOException("File " +
+               file + " does not exist");
+      }
 
-    return fi;
-  }
+      return fi;
+   }
 
-  /**
-   * Save
-   * @param fi The frame
-   * @param number The frame number
-   * @param directory The directory
-   * @exception IOException If an error occurs
-   */
-  public static void save(FrameInfo fi, Long number, File directory) throws IOException {
-    if (fi == null) {
-      throw new IOException("FrameInfo is null");
-    }
-    
-    if (directory == null) {
-      throw new IOException("Directory is null");
-    }
+   /**
+    * Save
+    * @param fi The frame
+    * @param number The frame number
+    * @param directory The directory
+    * @exception IOException If an error occurs
+    */
+   public static void save(FrameInfo fi, Long number, File directory) throws IOException
+   {
+      if (fi == null)
+      {
+         throw new IOException("FrameInfo is null");
+      }
 
-    if (number == null) {
-      throw new IOException("Number is null");
-    }
+      if (directory == null)
+      {
+         throw new IOException("Directory is null");
+      }
 
-    if (!directory.exists()) {
-      directory.mkdirs();
-    }
+      if (number == null)
+      {
+         throw new IOException("Number is null");
+      }
 
-    File file = new File(directory, number.toString());
-    FileOutputStream fos = new FileOutputStream(file);
-    GZIPOutputStream gos = new GZIPOutputStream(fos);
-    ObjectOutputStream oos = new ObjectOutputStream(gos);
-    oos.writeObject(fi);
-    oos.flush();
-    oos.close();
-  }
+      if (!directory.exists())
+      {
+         directory.mkdirs();
+      }
+
+      File file = new File(directory, number.toString());
+      FileOutputStream fos = new FileOutputStream(file);
+      GZIPOutputStream gos = new GZIPOutputStream(fos);
+      ObjectOutputStream oos = new ObjectOutputStream(gos);
+      oos.writeObject(fi);
+      oos.flush();
+      oos.close();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -24,7 +24,6 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -32,289 +31,338 @@
  * Represents a frame
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class FrameInfo implements Serializable {
+public class FrameInfo implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -7566505769269778532L;
+   /** Serial version UID */
+   static final long serialVersionUID = -7566505769269778532L;
 
-  /** The method */
-  private Integer method;
+   /** The method */
+   private Integer method;
 
-  /** The parent frame */
-  private FrameInfo parent;
+   /** The parent frame */
+   private FrameInfo parent;
 
-  /** The child frames */
-  private List<FrameInfo> children;
-  
-  /** The count */
-  private long count;
+   /** The child frames */
+   private List<FrameInfo> children;
 
-  /** The time */
-  private long time;
+   /** The count */
+   private long count;
 
-  /** The wait time */
-  private long waitTime;
+   /** The time */
+   private long time;
 
-  /** Child map */
-  private transient Map<Integer, Integer> childMap;
+   /** The wait time */
+   private long waitTime;
 
-  /** The net time */
-  private transient long netTime;
+   /** Child map */
+   private transient Map<Integer, Integer> childMap;
 
-  /** The total time */
-  private transient long totalTime;
+   /** The net time */
+   private transient long netTime;
 
-  /** The last start time */
-  private transient long lastStartTime;
+   /** The total time */
+   private transient long totalTime;
 
-  /** The last wait start time */
-  private transient long lastWaitStartTime;
+   /** The last start time */
+   private transient long lastStartTime;
 
-  /**
-   * Constructor
-   * @param method The method
-   * @param parent The parent
-   */
-  public FrameInfo(Integer method, FrameInfo parent) {
-    this.method = method;
-    this.parent = parent;
-    this.children = null;
-    this.count = 0;
-    this.time = 0;
-    this.waitTime = 0;
+   /** The last wait start time */
+   private transient long lastWaitStartTime;
 
-    this.childMap = null;
-    this.netTime = -1;
-    this.totalTime = -1;
-    this.lastStartTime = 0;
-    this.lastWaitStartTime = 0;
-    
-    if (parent != null) {
-      parent.addChild(method, this);
-    }
-  }
+   /**
+    * Constructor
+    * @param method The method
+    * @param parent The parent
+    */
+   public FrameInfo(Integer method, FrameInfo parent)
+   {
+      this.method = method;
+      this.parent = parent;
+      this.children = null;
+      this.count = 0;
+      this.time = 0;
+      this.waitTime = 0;
 
-  /**
-   * Get the method
-   * @return The method
-   */
-  public Integer getMethod() {
-    return method;
-  }
-  
-  /**
-   * Get the parent
-   * @return The parent
-   */
-  public FrameInfo getParent() {
-    return parent;
-  }
-  
-  /**
-   * Get the children
-   * @return The children
-   */
-  public List<FrameInfo> getChildren() {
-    return children;
-  }
-  
-  /**
-   * Get the net time
-   * @return The net time
-   */
-  public long getNetTime() {
-    if (netTime <= 0) {
-      computeNetTime();
-    }
+      this.childMap = null;
+      this.netTime = -1;
+      this.totalTime = -1;
+      this.lastStartTime = 0;
+      this.lastWaitStartTime = 0;
 
-    return netTime;
-  }
+      if (parent != null)
+      {
+         parent.addChild(method, this);
+      }
+   }
 
-  /**
-   * Get the count
-   * @return The count
-   */
-  public long getCount() {
-    return count;
-  }
+   /**
+    * Get the method
+    * @return The method
+    */
+   public Integer getMethod()
+   {
+      return method;
+   }
 
-  /**
-   * Get the time
-   * @return The time
-   */
-  public long getTime() {
-    return time;
-  }
+   /**
+    * Get the parent
+    * @return The parent
+    */
+   public FrameInfo getParent()
+   {
+      return parent;
+   }
 
-  /**
-   * Get the wait time
-   * @return The wait time
-   */
-  public long getWaitTime() {
-    return waitTime;
-  }
+   /**
+    * Get the children
+    * @return The children
+    */
+   public List<FrameInfo> getChildren()
+   {
+      return children;
+   }
 
-  /**
-   * Set the begin time (agent only)
-   * @param t The time
-   */
-  public void setBeginTime(long t) {
-    lastStartTime = t;
-  }
-  
-  /**
-   * Set the end time (agent only)
-   * @param t The time
-   */
-  public void setEndTime(long t) {
-    long delta = t - lastStartTime;
+   /**
+    * Get the net time
+    * @return The net time
+    */
+   public long getNetTime()
+   {
+      if (netTime <= 0)
+      {
+         computeNetTime();
+      }
 
-    if (lastStartTime > 0 && delta > 0) {
-      time += delta;
-    }
+      return netTime;
+   }
 
-    count++;
-    lastStartTime = 0;
-  }
-  
-  /**
-   * Set the begin wait time (agent only)
-   * @param t The time
-   */
-  public void setBeginWaitTime(long t) {
-    lastWaitStartTime = t;
-  }
-  
-  /**
-   * Set the end wait time (agent only)
-   * @param t The time
-   */
-  public void setEndWaitTime(long t) {
-    long delta = t - lastWaitStartTime;
+   /**
+    * Get the count
+    * @return The count
+    */
+   public long getCount()
+   {
+      return count;
+   }
 
-    if (lastWaitStartTime > 0 && delta > 0) {
-      waitTime += delta;
-    }
-    lastWaitStartTime = 0;
-  }
-  
-  /**
-   * Get the child for a method (agent only)
-   * @param m The method
-   * @return The frame
-   */
-  public FrameInfo getChild(Integer m) {
-    if (childMap != null) {
-      Integer i = childMap.get(m);
-      if (i != null) {
-        return children.get(i.intValue());
+   /**
+    * Get the time
+    * @return The time
+    */
+   public long getTime()
+   {
+      return time;
+   }
+
+   /**
+    * Get the wait time
+    * @return The wait time
+    */
+   public long getWaitTime()
+   {
+      return waitTime;
+   }
+
+   /**
+    * Set the begin time (agent only)
+    * @param t The time
+    */
+   public void setBeginTime(long t)
+   {
+      lastStartTime = t;
+   }
+
+   /**
+    * Set the end time (agent only)
+    * @param t The time
+    */
+   public void setEndTime(long t)
+   {
+      long delta = t -
+            lastStartTime;
+
+      if (lastStartTime > 0 &&
+            delta > 0)
+      {
+         time += delta;
       }
-    }
-    return null;
-  }
-  
-  /**
-   * Set overhead (agent only)
-   * @param overhead The overhead
-   */
-  public void setOverhead(long overhead) {
-    if (overhead > 0 && (time - overhead) > 0) {
-      time -= overhead;
-    }
-  }
-  
-  /**
-   * Get the total time
-   * @return The total time
-   */
-  public long getTotalTime() {
-    if (totalTime <= 0) {
-      computeTotalTime();
-    }
 
-    return totalTime;
-  }
+      count++;
+      lastStartTime = 0;
+   }
 
-  /**
-   * Close the frame (agent only)
-   */
-  public void close() {
-    if (lastStartTime > 0) {
-      setEndTime(System.nanoTime());
-    }
+   /**
+    * Set the begin wait time (agent only)
+    * @param t The time
+    */
+   public void setBeginWaitTime(long t)
+   {
+      lastWaitStartTime = t;
+   }
 
-    if (getChildren() != null) {
-      synchronized (children) {
-        for (FrameInfo child : children) {
-          child.close();
-        }
+   /**
+    * Set the end wait time (agent only)
+    * @param t The time
+    */
+   public void setEndWaitTime(long t)
+   {
+      long delta = t -
+            lastWaitStartTime;
 
-        childMap = null;
+      if (lastWaitStartTime > 0 &&
+            delta > 0)
+      {
+         waitTime += delta;
       }
-    }
-  }
+      lastWaitStartTime = 0;
+   }
 
-  /**
-   * Compute the net time
-   */
-  private void computeNetTime() {
-    long childTime = 0;
-    
-    List<FrameInfo> l = getChildren();
-    if (l != null) {
-      for (FrameInfo child : l) {
-        childTime += child.getTime();
+   /**
+    * Get the child for a method (agent only)
+    * @param m The method
+    * @return The frame
+    */
+   public FrameInfo getChild(Integer m)
+   {
+      if (childMap != null)
+      {
+         Integer i = childMap.get(m);
+         if (i != null)
+         {
+            return children.get(i.intValue());
+         }
       }
-    }
-      
-    netTime = getTime() - childTime - waitTime;
-    
-    if (netTime < 0) {
-      netTime = 0;
-    }
-  }
+      return null;
+   }
 
-  /**
-   * Compute the total time
-   */
-  private void computeTotalTime() {
-    totalTime = getNetTime();
+   /**
+    * Set overhead (agent only)
+    * @param overhead The overhead
+    */
+   public void setOverhead(long overhead)
+   {
+      if (overhead > 0 &&
+            (time - overhead) > 0)
+      {
+         time -= overhead;
+      }
+   }
 
-    List<FrameInfo> l = getChildren();
-    if (l != null) {
-      for (FrameInfo child : l) {
-        totalTime += child.getTotalTime();
+   /**
+    * Get the total time
+    * @return The total time
+    */
+   public long getTotalTime()
+   {
+      if (totalTime <= 0)
+      {
+         computeTotalTime();
       }
-    }
-  }
 
-  /**
-   * Init children
-   */
-  private void initChildren() {
-    if (childMap == null) {
-      childMap = new HashMap<Integer, Integer>(); 
-    }
-    if (children == null) {
-      children = new ArrayList<FrameInfo>(); 
-    }
-  }
-  
-  /**
-   * Add a child
-   * @param mi The method
-   * @param fi The child
-   */
-  private void addChild(Integer mi, FrameInfo fi) {
-    if (children == null || childMap == null) {
-      initChildren();
-    }
+      return totalTime;
+   }
 
-    synchronized (children) {
-      children.add(fi);
-      childMap.put(mi, Integer.valueOf(children.size() - 1));
-      netTime = -1;
-      totalTime = -1;
-    }
-  }
+   /**
+    * Close the frame (agent only)
+    */
+   public void close()
+   {
+      if (lastStartTime > 0)
+      {
+         setEndTime(System.nanoTime());
+      }
+
+      if (getChildren() != null)
+      {
+         synchronized (children)
+         {
+            for (FrameInfo child : children)
+            {
+               child.close();
+            }
+
+            childMap = null;
+         }
+      }
+   }
+
+   /**
+    * Compute the net time
+    */
+   private void computeNetTime()
+   {
+      long childTime = 0;
+
+      List<FrameInfo> l = getChildren();
+      if (l != null)
+      {
+         for (FrameInfo child : l)
+         {
+            childTime += child.getTime();
+         }
+      }
+
+      netTime = getTime() -
+            childTime - waitTime;
+
+      if (netTime < 0)
+      {
+         netTime = 0;
+      }
+   }
+
+   /**
+    * Compute the total time
+    */
+   private void computeTotalTime()
+   {
+      totalTime = getNetTime();
+
+      List<FrameInfo> l = getChildren();
+      if (l != null)
+      {
+         for (FrameInfo child : l)
+         {
+            totalTime += child.getTotalTime();
+         }
+      }
+   }
+
+   /**
+    * Init children
+    */
+   private void initChildren()
+   {
+      if (childMap == null)
+      {
+         childMap = new HashMap<Integer, Integer>();
+      }
+      if (children == null)
+      {
+         children = new ArrayList<FrameInfo>();
+      }
+   }
+
+   /**
+    * Add a child
+    * @param mi The method
+    * @param fi The child
+    */
+   private void addChild(Integer mi, FrameInfo fi)
+   {
+      if (children == null ||
+            childMap == null)
+      {
+         initChildren();
+      }
+
+      synchronized (children)
+      {
+         children.add(fi);
+         childMap.put(mi, Integer.valueOf(children.size() - 1));
+         netTime = -1;
+         totalTime = -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Math.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Math.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Math.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,34 +25,38 @@
  * Math utility functions
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Math {
+public class Math
+{
 
-  /**
-   * Convert nano to millis
-   * @param nanos The nanos
-   * @return The millis
-   */
-  public static double nanoToMilli(long nanos) {
-    return ((double)nanos) / 1000000.0;
-  }
-  
-  /**
-   * Get the percent
-   * @param nom The nomenator
-   * @param denom The denomenator
-   * @return The percent
-   */
-  public static double toPercent(long nom, double denom) {
-    return toPercent((double)nom, denom);
-  }
+   /**
+    * Convert nano to millis
+    * @param nanos The nanos
+    * @return The millis
+    */
+   public static double nanoToMilli(long nanos)
+   {
+      return ((double)nanos) / 1000000.0;
+   }
 
-  /**
-   * Get the percent
-   * @param nom The nomenator
-   * @param denom The denomenator
-   * @return The percent
-   */
-  public static double toPercent(double nom, double denom) {
-    return (nom / denom) * 100.0;
-  }
+   /**
+    * Get the percent
+    * @param nom The nomenator
+    * @param denom The denomenator
+    * @return The percent
+    */
+   public static double toPercent(long nom, double denom)
+   {
+      return toPercent((double)nom, denom);
+   }
+
+   /**
+    * Get the percent
+    * @param nom The nomenator
+    * @param denom The denomenator
+    * @return The percent
+    */
+   public static double toPercent(double nom, double denom)
+   {
+      return (nom / denom) * 100.0;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,74 +27,84 @@
  * Represents a method
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class MethodInfo implements Serializable {
+public class MethodInfo implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = 7334560988667012888L;
+   /** Serial version UID */
+   static final long serialVersionUID = 7334560988667012888L;
 
-  /** The method name */
-  private String methodName;
+   /** The method name */
+   private String methodName;
 
-  /** The class name */
-  private String className;
-  
-  /**
-   * Constructor
-   * @param methodName The method name
-   * @param className The class name
-   */
-  public MethodInfo(String methodName, String className) {
-    this.methodName = methodName;
-    this.className = className;
-  }
+   /** The class name */
+   private String className;
 
-  /**
-   * Get the method name
-   * @return The name
-   */
-  public String getMethodName() {
-    return methodName;
-  }
+   /**
+    * Constructor
+    * @param methodName The method name
+    * @param className The class name
+    */
+   public MethodInfo(String methodName, String className)
+   {
+      this.methodName = methodName;
+      this.className = className;
+   }
 
-  /**
-   * Get the class name
-   * @return The name
-   */
-  public String getClassName() {
-    return className;
-  }
+   /**
+    * Get the method name
+    * @return The name
+    */
+   public String getMethodName()
+   {
+      return methodName;
+   }
 
-  /**
-   * Equals
-   * @param other The other object
-   * @return True if equal; otherwise false
-   */
-  @Override
-  public boolean equals(Object other) {
-    if (!(other instanceof MethodInfo)) {
-      return false;
-    }
+   /**
+    * Get the class name
+    * @return The name
+    */
+   public String getClassName()
+   {
+      return className;
+   }
 
-    MethodInfo mi = (MethodInfo)other;
-    return this.methodName.equals(mi.getMethodName())
-      && this.className.equals(mi.getClassName());
-  }
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+      if (!(other instanceof MethodInfo))
+      {
+         return false;
+      }
 
-  /**
-   * Hash code
-   * @return The hash code
-   */
-  @Override
-  public int hashCode() {
-    return methodName.hashCode() + className.hashCode();
-  }
+      MethodInfo mi = (MethodInfo)other;
+      return this.methodName.equals(mi.getMethodName()) &&
+            this.className.equals(mi.getClassName());
+   }
 
-  /**
-   * Get the string representation
-   * @return The string
-   */
-  @Override
-  public String toString() {
-    return methodName + "," + className;
-  }
+   /**
+    * Hash code
+    * @return The hash code
+    */
+   @Override
+   public int hashCode()
+   {
+      return methodName.hashCode() +
+            className.hashCode();
+   }
+
+   /**
+    * Get the string representation
+    * @return The string
+    */
+   @Override
+   public String toString()
+   {
+      return methodName +
+            "," + className;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,44 +29,49 @@
  * Represents a method repository
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class MethodRepository implements Serializable {
+public class MethodRepository implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -8088834763036458711L;
+   /** Serial version UID */
+   static final long serialVersionUID = -8088834763036458711L;
 
-  /** The methods */
-  private ConcurrentMap<Integer, MethodInfo> methods;
+   /** The methods */
+   private ConcurrentMap<Integer, MethodInfo> methods;
 
-  /**
-   * Constructor
-   */
-  public MethodRepository() {
-    methods = new ConcurrentHashMap<Integer, MethodInfo>();
-  }
+   /**
+    * Constructor
+    */
+   public MethodRepository()
+   {
+      methods = new ConcurrentHashMap<Integer, MethodInfo>();
+   }
 
-  /**
-   * Get the method id
-   * @param className The class name
-   * @param methodName The method name
-   * @return The method id
-   */
-  public synchronized Integer getId(String className, String methodName) {
-    MethodInfo method = new MethodInfo(methodName, className);
-    Integer hash = Integer.valueOf(method.hashCode());
+   /**
+    * Get the method id
+    * @param className The class name
+    * @param methodName The method name
+    * @return The method id
+    */
+   public synchronized Integer getId(String className, String methodName)
+   {
+      MethodInfo method = new MethodInfo(methodName, className);
+      Integer hash = Integer.valueOf(method.hashCode());
 
-    if (!methods.containsKey(hash)) {
-      methods.put(hash, method);
-    }
+      if (!methods.containsKey(hash))
+      {
+         methods.put(hash, method);
+      }
 
-    return hash;
-  }
+      return hash;
+   }
 
-  /**
-   * Get the method info
-   * @param id The method id
-   * @return The method info
-   */
-  public MethodInfo getInfo(Integer id) {
-    return methods.get(id);
-  }
+   /**
+    * Get the method info
+    * @param id The method id
+    * @return The method info
+    */
+   public MethodInfo getInfo(Integer id)
+   {
+      return methods.get(id);
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Plugin.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Plugin.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Plugin.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,32 +25,33 @@
  * Defines the component class plugin interface.
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface Plugin {
+public interface Plugin
+{
 
-  /**
-   * Get the name of the plugin
-   * @return The name
-   */
-  public String getName();
+   /**
+    * Get the name of the plugin
+    * @return The name
+    */
+   public String getName();
 
-  /**
-   * Is the class supported by the plugin
-   * @param c The class
-   * @return True if supported; otherwise false
-   */
-  public boolean isSupported(Class c);
+   /**
+    * Is the class supported by the plugin
+    * @param c The class
+    * @return True if supported; otherwise false
+    */
+   public boolean isSupported(Class c);
 
-  /**
-   * Get the type of the class
-   * @param c The class
-   * @return The type; negative if unknown
-   */
-  public int getType(Class c);
+   /**
+    * Get the type of the class
+    * @param c The class
+    * @return The type; negative if unknown
+    */
+   public int getType(Class c);
 
-  /**
-   * Get the description of the type
-   * @param type The type
-   * @return The description; otherwise null
-   */
-  public String getDescription(int type);
+   /**
+    * Get the description of the type
+    * @param type The type
+    * @return The description; otherwise null
+    */
+   public String getDescription(int type);
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/PluginHelper.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/PluginHelper.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/PluginHelper.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,53 +32,64 @@
  * The plugin helper
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class PluginHelper {
+public class PluginHelper
+{
 
-  /**
-   * Constructor
-   */
-  private PluginHelper() {
-  }
+   /**
+    * Constructor
+    */
+   private PluginHelper()
+   {
+   }
 
-  /**
-   * Load a list of plugins
-   * @param properties The properties
-   * @return The list
-   */
-  public static List<Plugin> load(Properties properties) {
-    List<Plugin> result = new ArrayList<Plugin>();
+   /**
+    * Load a list of plugins
+    * @param properties The properties
+    * @return The list
+    */
+   public static List<Plugin> load(Properties properties)
+   {
+      List<Plugin> result = new ArrayList<Plugin>();
 
-    if (properties != null) {
-      Map<Integer, String> plugins = new TreeMap<Integer, String>();
-      
-      Iterator it = properties.entrySet().iterator();
-      while (it.hasNext()) {
-        Map.Entry entry = (Map.Entry)it.next();
+      if (properties != null)
+      {
+         Map<Integer, String> plugins = new TreeMap<Integer, String>();
 
-        String key = (String)entry.getKey();
-        String value = (String)entry.getValue();
+         Iterator it = properties.entrySet().iterator();
+         while (it.hasNext())
+         {
+            Map.Entry entry = (Map.Entry)it.next();
 
-        if (key.startsWith("plugin.")) {
-          Integer idx = Integer.parseInt(key.substring(key.indexOf(".") + 1));
-          plugins.put(idx, value);
-        }
-      }
+            String key = (String)entry.getKey();
+            String value = (String)entry.getValue();
 
-      List<String> classes = new ArrayList<String>(plugins.values());
-      for (String clz : classes) {
-        clz = clz.trim();
+            if (key.startsWith("plugin."))
+            {
+               Integer idx = Integer.parseInt(key.substring(key.indexOf(".") + 1));
+               plugins.put(idx, value);
+            }
+         }
 
-        try {
-          Class c = Class.forName(clz);
-          Plugin p = (Plugin)c.newInstance();
-          result.add(p);
-        } catch (Exception e) {
-          // Nothing to do
-          System.err.println("Plugin " + clz + " could not be loaded");
-        }
+         List<String> classes = new ArrayList<String>(plugins.values());
+         for (String clz : classes)
+         {
+            clz = clz.trim();
+
+            try
+            {
+               Class c = Class.forName(clz);
+               Plugin p = (Plugin)c.newInstance();
+               result.add(p);
+            }
+            catch (Exception e)
+            {
+               // Nothing to do
+               System.err.println("Plugin " +
+                     clz + " could not be loaded");
+            }
+         }
       }
-    }
 
-    return result;
-  }
+      return result;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Snapshot.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Snapshot.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Snapshot.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,97 +29,105 @@
  * The snapshot
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Snapshot implements Serializable {
+public class Snapshot implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -7221125527680152722L;
+   /** Serial version UID */
+   static final long serialVersionUID = -7221125527680152722L;
 
-  /** The threads list */
-  private List<ThreadInfo> threadList;
+   /** The threads list */
+   private List<ThreadInfo> threadList;
 
-  /** The allocation list */
-  private List<AllocationInfo> allocationList;
-  
-  /** The class list */
-  private List<ClassInfo> classList;
+   /** The allocation list */
+   private List<AllocationInfo> allocationList;
 
-  /** The method repository */
-  private MethodRepository methodRepository;
-  
-  /** From date */
-  private Date from;
+   /** The class list */
+   private List<ClassInfo> classList;
 
-  /** To date */
-  private Date to;
+   /** The method repository */
+   private MethodRepository methodRepository;
 
-  /**
-   * Constructor
-   * @param threadList The thread list
-   * @param allocationList The allocation list
-   * @param classList The class list
-   * @param methodRepository The method repository
-   * @param from The from date
-   * @param to The to date
-   */
-  public Snapshot(List <ThreadInfo> threadList,
-                  List<AllocationInfo> allocationList,
-                  List<ClassInfo> classList,
-                  MethodRepository methodRepository,
-                  Date from,
-                  Date to) {
-    this.threadList = threadList;
-    this.allocationList = allocationList;
-    this.classList = classList;
-    this.methodRepository = methodRepository;
-    this.from = from;
-    this.to = to;
-  }
+   /** From date */
+   private Date from;
 
-  /**
-   * Get the from date
-   * @return The date
-   */
-  public Date getFrom() {
-    return from;
-  }
+   /** To date */
+   private Date to;
 
-  /**
-   * Get the to date
-   * @return The date
-   */
-  public Date getTo() {
-    return to;
-  }
+   /**
+    * Constructor
+    * @param threadList The thread list
+    * @param allocationList The allocation list
+    * @param classList The class list
+    * @param methodRepository The method repository
+    * @param from The from date
+    * @param to The to date
+    */
+   public Snapshot(List<ThreadInfo> threadList,
+                   List<AllocationInfo> allocationList,
+                   List<ClassInfo> classList,
+                   MethodRepository methodRepository,
+                   Date from,
+                   Date to)
+   {
+      this.threadList = threadList;
+      this.allocationList = allocationList;
+      this.classList = classList;
+      this.methodRepository = methodRepository;
+      this.from = from;
+      this.to = to;
+   }
 
-  /**
-   * Get the threads
-   * @return The threads
-   */
-  public List<ThreadInfo> getThreads() {
-    return threadList;
-  }
+   /**
+    * Get the from date
+    * @return The date
+    */
+   public Date getFrom()
+   {
+      return from;
+   }
 
-  /**
-   * Get the allocations
-   * @return The allocations
-   */
-  public List<AllocationInfo> getAllocations() {
-    return allocationList;
-  }
+   /**
+    * Get the to date
+    * @return The date
+    */
+   public Date getTo()
+   {
+      return to;
+   }
 
-  /**
-   * Get the classes
-   * @return The classes
-   */
-  public List<ClassInfo> getClasses() {
-    return classList;
-  }
+   /**
+    * Get the threads
+    * @return The threads
+    */
+   public List<ThreadInfo> getThreads()
+   {
+      return threadList;
+   }
 
-  /**
-   * Get the method repository
-   * @return The method repository
-   */
-  public MethodRepository getMethodRepository() {
-    return methodRepository;
-  }
+   /**
+    * Get the allocations
+    * @return The allocations
+    */
+   public List<AllocationInfo> getAllocations()
+   {
+      return allocationList;
+   }
+
+   /**
+    * Get the classes
+    * @return The classes
+    */
+   public List<ClassInfo> getClasses()
+   {
+      return classList;
+   }
+
+   /**
+    * Get the method repository
+    * @return The method repository
+    */
+   public MethodRepository getMethodRepository()
+   {
+      return methodRepository;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/SnapshotHelper.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/SnapshotHelper.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/SnapshotHelper.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -38,148 +38,175 @@
  * The snapshot helper
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class SnapshotHelper {
+public class SnapshotHelper
+{
 
-  /**
-   * Constructor
-   */
-  private SnapshotHelper() {
-  }
+   /**
+    * Constructor
+    */
+   private SnapshotHelper()
+   {
+   }
 
-  /**
-   * Default name for a snapshot
-   * @param snapshot The snapshot
-   * @return The name
-   */
-  public static String getName(Snapshot snapshot) {
-    StringBuffer sb = new StringBuffer();
-    DecimalFormat df = new DecimalFormat("00"); 
-    DecimalFormat df3 = new DecimalFormat("000");
-             
-    Calendar c = Calendar.getInstance();
-    c.setTime(snapshot.getFrom());
-    
-    sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
-    sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
-    sb = sb.append(df.format(c.get(Calendar.DATE)));
-    sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
-    sb = sb.append(df.format(c.get(Calendar.MINUTE)));
-    sb = sb.append(df.format(c.get(Calendar.SECOND)));
-    sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
-    
-    sb = sb.append("-");
-    
-    c.setTime(snapshot.getTo());
-    sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
-    sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
-    sb = sb.append(df.format(c.get(Calendar.DATE)));
-    sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
-    sb = sb.append(df.format(c.get(Calendar.MINUTE)));
-    sb = sb.append(df.format(c.get(Calendar.SECOND)));
-    sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
-    
-    return sb.toString();
-  }
+   /**
+    * Default name for a snapshot
+    * @param snapshot The snapshot
+    * @return The name
+    */
+   public static String getName(Snapshot snapshot)
+   {
+      StringBuffer sb = new StringBuffer();
+      DecimalFormat df = new DecimalFormat("00");
+      DecimalFormat df3 = new DecimalFormat("000");
 
-  /**
-   * Load a snapshot
-   * @param file The file
-   * @return The snapshot
-   * @exception IOException If an error occurs
-   */
-  public static Snapshot load(File file) throws IOException {
-    Snapshot snapshot = null;
-    FileInputStream fis = null;
+      Calendar c = Calendar.getInstance();
+      c.setTime(snapshot.getFrom());
 
-    if (file != null && file.exists()) {
-      try {
-        fis = new FileInputStream(file);
-        GZIPInputStream gis = new GZIPInputStream(fis);
-        ObjectInputStream ois = new ObjectInputStream(gis);
-        snapshot = (Snapshot)ois.readObject();
-      } catch (Exception e) {
-        IOException ioe = new IOException(e.getMessage());
-        ioe.initCause(e);
-        throw ioe;
-      } finally {
-        if (fis != null) {
-          try {
-            fis.close();
-          } catch (Exception ne) {
-            // Ignore
-          }
-        }
+      sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
+      sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
+      sb = sb.append(df.format(c.get(Calendar.DATE)));
+      sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
+      sb = sb.append(df.format(c.get(Calendar.MINUTE)));
+      sb = sb.append(df.format(c.get(Calendar.SECOND)));
+      sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
+
+      sb = sb.append("-");
+
+      c.setTime(snapshot.getTo());
+      sb = sb.append(Integer.toString(c.get(Calendar.YEAR)));
+      sb = sb.append(df.format(c.get(Calendar.MONTH) + 1));
+      sb = sb.append(df.format(c.get(Calendar.DATE)));
+      sb = sb.append(df.format(c.get(Calendar.HOUR_OF_DAY)));
+      sb = sb.append(df.format(c.get(Calendar.MINUTE)));
+      sb = sb.append(df.format(c.get(Calendar.SECOND)));
+      sb = sb.append(df3.format(c.get(Calendar.MILLISECOND)));
+
+      return sb.toString();
+   }
+
+   /**
+    * Load a snapshot
+    * @param file The file
+    * @return The snapshot
+    * @exception IOException If an error occurs
+    */
+   public static Snapshot load(File file) throws IOException
+   {
+      Snapshot snapshot = null;
+      FileInputStream fis = null;
+
+      if (file != null &&
+            file.exists())
+      {
+         try
+         {
+            fis = new FileInputStream(file);
+            GZIPInputStream gis = new GZIPInputStream(fis);
+            ObjectInputStream ois = new ObjectInputStream(gis);
+            snapshot = (Snapshot)ois.readObject();
+         }
+         catch (Exception e)
+         {
+            IOException ioe = new IOException(e.getMessage());
+            ioe.initCause(e);
+            throw ioe;
+         }
+         finally
+         {
+            if (fis != null)
+            {
+               try
+               {
+                  fis.close();
+               }
+               catch (Exception ne)
+               {
+                  // Ignore
+               }
+            }
+         }
       }
-    } else {
-      throw new IOException("File " + file + " does not exist");
-    }
+      else
+      {
+         throw new IOException("File " +
+               file + " does not exist");
+      }
 
-    return snapshot;
-  }
+      return snapshot;
+   }
 
-  /**
-   * Save
-   * @param snapshot The snapshot
-   * @exception IOException If an error occurs
-   */
-  public static void save(Snapshot snapshot) throws IOException {
-    save(snapshot, new File(getName(snapshot) + ".jps"));
-  }
+   /**
+    * Save
+    * @param snapshot The snapshot
+    * @exception IOException If an error occurs
+    */
+   public static void save(Snapshot snapshot) throws IOException
+   {
+      save(snapshot, new File(getName(snapshot) +
+            ".jps"));
+   }
 
-  /**
-   * Save
-   * @param snapshot The snapshot
-   * @param file The file
-   * @exception IOException If an error occurs
-   */
-  public static void save(Snapshot snapshot, File file) throws IOException {
-    if (snapshot == null) {
-      throw new IOException("Snapshot is null");
-    }
-    
-    if (file == null) {
-      throw new IOException("File is null");
-    }
+   /**
+    * Save
+    * @param snapshot The snapshot
+    * @param file The file
+    * @exception IOException If an error occurs
+    */
+   public static void save(Snapshot snapshot, File file) throws IOException
+   {
+      if (snapshot == null)
+      {
+         throw new IOException("Snapshot is null");
+      }
 
-    FileOutputStream fos = new FileOutputStream(file);
-    GZIPOutputStream gos = new GZIPOutputStream(fos);
-    ObjectOutputStream oos = new ObjectOutputStream(gos);
-    oos.writeObject(snapshot);
-    oos.flush();
-    oos.close();
-  }
+      if (file == null)
+      {
+         throw new IOException("File is null");
+      }
 
-  /**
-   * Generate a snapshot from a directory
-   * @param directory The directory
-   * @return The snapshot
-   * @exception IOException If an error occurs
-   */
-  public static Snapshot generate(File directory) throws IOException {
-    if (directory == null) {
-      throw new IOException("Directory is null");
-    }
+      FileOutputStream fos = new FileOutputStream(file);
+      GZIPOutputStream gos = new GZIPOutputStream(fos);
+      ObjectOutputStream oos = new ObjectOutputStream(gos);
+      oos.writeObject(snapshot);
+      oos.flush();
+      oos.close();
+   }
 
-    File baseFile = new File(directory, "data");
-    Snapshot base = load(baseFile);
+   /**
+    * Generate a snapshot from a directory
+    * @param directory The directory
+    * @return The snapshot
+    * @exception IOException If an error occurs
+    */
+   public static Snapshot generate(File directory) throws IOException
+   {
+      if (directory == null)
+      {
+         throw new IOException("Directory is null");
+      }
 
-    List<ThreadInfo> threads = new ArrayList<ThreadInfo>();
+      File baseFile = new File(directory, "data");
+      Snapshot base = load(baseFile);
 
-    File[] entries = directory.listFiles();
-    for (File entry : entries) {
-      if (entry.isDirectory()) {
-        File tf = new File(directory, entry.getName());
-        ThreadInfo ti = ThreadHelper.load(tf);
-        ThreadInfoProxy tip = new ThreadInfoProxy(entry, ti);
-        threads.add(tip);
+      List<ThreadInfo> threads = new ArrayList<ThreadInfo>();
+
+      File[] entries = directory.listFiles();
+      for (File entry : entries)
+      {
+         if (entry.isDirectory())
+         {
+            File tf = new File(directory, entry.getName());
+            ThreadInfo ti = ThreadHelper.load(tf);
+            ThreadInfoProxy tip = new ThreadInfoProxy(entry, ti);
+            threads.add(tip);
+         }
       }
-    }
 
-    return new Snapshot(threads,
-                        base.getAllocations(),
-                        base.getClasses(),
-                        base.getMethodRepository(),
-                        base.getFrom(),
-                        base.getTo());
-  }
+      return new Snapshot(threads,
+                          base.getAllocations(),
+                          base.getClasses(),
+                          base.getMethodRepository(),
+                          base.getFrom(),
+                          base.getTo());
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadComparator.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadComparator.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,26 +28,36 @@
  * Thread comparator
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ThreadComparator implements Comparator<ThreadInfo>, Serializable {
+public class ThreadComparator implements Comparator<ThreadInfo>, Serializable
+{
 
-  /**
-   * Compare two objects
-   * @param ta Thread info
-   * @param tb Thread info
-   * @return Positive if tb greater than ta; zero if equal otherwise negative
-   */
-  public int compare(ThreadInfo ta, ThreadInfo tb) {
-    if (ta.getTotalTime() < tb.getTotalTime()) {
-      return 1;
-    } else if (ta.getTotalTime() == tb.getTotalTime()) { 
-      if (ta.getId() < tb.getId()) {
-        return -1;
-      } else if (ta.getId() > tb.getId()) {
-        return 1;
+   /**
+    * Compare two objects
+    * @param ta Thread info
+    * @param tb Thread info
+    * @return Positive if tb greater than ta; zero if equal otherwise negative
+    */
+   public int compare(ThreadInfo ta, ThreadInfo tb)
+   {
+      if (ta.getTotalTime() < tb.getTotalTime())
+      {
+         return 1;
       }
-      return 0;
-    } else {
-      return -1;
-    }
-  }
+      else if (ta.getTotalTime() == tb.getTotalTime())
+      {
+         if (ta.getId() < tb.getId())
+         {
+            return -1;
+         }
+         else if (ta.getId() > tb.getId())
+         {
+            return 1;
+         }
+         return 0;
+      }
+      else
+      {
+         return -1;
+      }
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadHelper.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadHelper.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadHelper.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -35,87 +35,108 @@
  * The thread helper
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ThreadHelper {
+public class ThreadHelper
+{
 
-  /**
-   * Constructor
-   */
-  private ThreadHelper() {
-  }
+   /**
+    * Constructor
+    */
+   private ThreadHelper()
+   {
+   }
 
-  /**
-   * Load a thread
-   * @param directory The directory
-   * @return The thread
-   * @exception IOException If an error occurs
-   */
-  public static ThreadInfo load(File directory) throws IOException {
-    ThreadInfo ti = null;
-    FileInputStream fis = null;
+   /**
+    * Load a thread
+    * @param directory The directory
+    * @return The thread
+    * @exception IOException If an error occurs
+    */
+   public static ThreadInfo load(File directory) throws IOException
+   {
+      ThreadInfo ti = null;
+      FileInputStream fis = null;
 
-    if (directory != null && directory.exists()) {
-      try {
-        fis = new FileInputStream(new File(directory, "base"));
-        GZIPInputStream gis = new GZIPInputStream(fis);
-        ObjectInputStream ois = new ObjectInputStream(gis);
+      if (directory != null &&
+            directory.exists())
+      {
+         try
+         {
+            fis = new FileInputStream(new File(directory, "base"));
+            GZIPInputStream gis = new GZIPInputStream(fis);
+            ObjectInputStream ois = new ObjectInputStream(gis);
 
-        long id = ois.readLong();
-        String name = ois.readUTF();
-        int priority = ois.readInt();
-        boolean daemon = ois.readBoolean();
-        List<String> groups = (List<String>)ois.readObject();
+            long id = ois.readLong();
+            String name = ois.readUTF();
+            int priority = ois.readInt();
+            boolean daemon = ois.readBoolean();
+            List<String> groups = (List<String>)ois.readObject();
 
-        ti = new ThreadInfo(id, name, priority, daemon, groups);
+            ti = new ThreadInfo(id, name, priority, daemon, groups);
 
-      } catch (Exception e) {
-        IOException ioe = new IOException(e.getMessage());
-        ioe.initCause(e);
-        throw ioe;
-      } finally {
-        if (fis != null) {
-          try {
-            fis.close();
-          } catch (Exception ne) {
-            // Ignore
-          }
-        }
+         }
+         catch (Exception e)
+         {
+            IOException ioe = new IOException(e.getMessage());
+            ioe.initCause(e);
+            throw ioe;
+         }
+         finally
+         {
+            if (fis != null)
+            {
+               try
+               {
+                  fis.close();
+               }
+               catch (Exception ne)
+               {
+                  // Ignore
+               }
+            }
+         }
       }
-    } else {
-      throw new IOException("Directory " + directory + " does not exist");
-    }
+      else
+      {
+         throw new IOException("Directory " +
+               directory + " does not exist");
+      }
 
-    return ti;
-  }
+      return ti;
+   }
 
-  /**
-   * Save
-   * @param ti The thread
-   * @param directory The directory
-   * @exception IOException If an error occurs
-   */
-  public static void save(ThreadInfo ti, File directory) throws IOException {
-    if (ti == null) {
-      throw new IOException("ThreadInfo is null");
-    }
-    
-    if (directory == null) {
-      throw new IOException("Directory is null");
-    }
+   /**
+    * Save
+    * @param ti The thread
+    * @param directory The directory
+    * @exception IOException If an error occurs
+    */
+   public static void save(ThreadInfo ti, File directory) throws IOException
+   {
+      if (ti == null)
+      {
+         throw new IOException("ThreadInfo is null");
+      }
 
-    if (!directory.exists()) {
-      directory.mkdirs();
-    }
+      if (directory == null)
+      {
+         throw new IOException("Directory is null");
+      }
 
-    File file = new File(directory, "base");
-    FileOutputStream fos = new FileOutputStream(file);
-    GZIPOutputStream gos = new GZIPOutputStream(fos);
-    ObjectOutputStream oos = new ObjectOutputStream(gos);
-    oos.writeLong(ti.getId());
-    oos.writeUTF(ti.getName());
-    oos.writeInt(ti.getPriority());
-    oos.writeBoolean(ti.isDaemon());
-    oos.writeObject(ti.getGroups());
-    oos.flush();
-    oos.close();
-  }
+      if (!directory.exists())
+      {
+         directory.mkdirs();
+      }
+
+      File file = new File(directory, "base");
+      FileOutputStream fos = new FileOutputStream(file);
+      GZIPOutputStream gos = new GZIPOutputStream(fos);
+      ObjectOutputStream oos = new ObjectOutputStream(gos);
+      oos.writeLong(ti.getId());
+      oos.writeUTF(ti.getName());
+      oos.writeInt(ti.getPriority());
+      oos.writeBoolean(ti.isDaemon());
+      oos.writeObject(ti.getGroups());
+      oos.flush();
+      oos.close();
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfo.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfo.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,148 +29,165 @@
  * Represents a thread and its frames
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ThreadInfo implements Serializable {
+public class ThreadInfo implements Serializable
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -1310252393096580495L;
+   /** Serial version UID */
+   static final long serialVersionUID = -1310252393096580495L;
 
-  /** The thread id */
-  private long id;
+   /** The thread id */
+   private long id;
 
-  /** The thread name */
-  private String name;
+   /** The thread name */
+   private String name;
 
-  /** The thread priority */
-  private int priority;
+   /** The thread priority */
+   private int priority;
 
-  /** Is daemon */
-  private boolean daemon;
+   /** Is daemon */
+   private boolean daemon;
 
-  /** The thread groups */
-  private List<String> groups;
+   /** The thread groups */
+   private List<String> groups;
 
-  /** Frames */
-  protected LinkedList<FrameInfo> frames;
+   /** Frames */
+   protected LinkedList<FrameInfo> frames;
 
-  /** The total time */
-  private transient long totalTime;
+   /** The total time */
+   private transient long totalTime;
 
-  /**
-   * Constructor
-   * @param id The thread id
-   * @param name The thread name
-   * @param priority The thread priority
-   * @param daemon The thread daemon status
-   * @param groups The thread groups
-   */
-  public ThreadInfo(long id, String name, int priority, boolean daemon, List<String> groups) {
-    this.id = id;
-    this.name = name;
-    this.priority = priority;
-    this.daemon = daemon;
-    this.groups = groups;
-    this.frames = new LinkedList<FrameInfo>();
-    this.totalTime = 0;
-  }
+   /**
+    * Constructor
+    * @param id The thread id
+    * @param name The thread name
+    * @param priority The thread priority
+    * @param daemon The thread daemon status
+    * @param groups The thread groups
+    */
+   public ThreadInfo(long id, String name, int priority, boolean daemon, List<String> groups)
+   {
+      this.id = id;
+      this.name = name;
+      this.priority = priority;
+      this.daemon = daemon;
+      this.groups = groups;
+      this.frames = new LinkedList<FrameInfo>();
+      this.totalTime = 0;
+   }
 
-  /**
-   * Get the id
-   * @return The id
-   */
-  public long getId() {
-    return id;
-  }
+   /**
+    * Get the id
+    * @return The id
+    */
+   public long getId()
+   {
+      return id;
+   }
 
-  /**
-   * Get the name
-   * @return The name
-   */
-  public String getName() {
-    return name;
-  }
+   /**
+    * Get the name
+    * @return The name
+    */
+   public String getName()
+   {
+      return name;
+   }
 
-  /**
-   * Get the priority
-   * @return The priority
-   */
-  public int getPriority() {
-    return priority;
-  }
+   /**
+    * Get the priority
+    * @return The priority
+    */
+   public int getPriority()
+   {
+      return priority;
+   }
 
-  /**
-   * Is daemon
-   * @return The daemon status
-   */
-  public boolean isDaemon() {
-    return daemon;
-  }
+   /**
+    * Is daemon
+    * @return The daemon status
+    */
+   public boolean isDaemon()
+   {
+      return daemon;
+   }
 
-  /**
-   * Get the thread groups
-   * @return The thread groups
-   */
-  public List<String> getGroups() {
-    return groups;
-  }
+   /**
+    * Get the thread groups
+    * @return The thread groups
+    */
+   public List<String> getGroups()
+   {
+      return groups;
+   }
 
-  /**
-   * Get the frames
-   * @return The frames
-   */
-  public List<FrameInfo> getFrames() {
-    return frames;
-  }
-  
-  /**
-   * Add a frame to a thread
-   * @param f The frame
-   */
-  public void add(FrameInfo f) {
-    frames.addLast(f);
-    totalTime = 0;
-  }
-  
-  /**
-   * Get the recent frame for a thread
-   * @return The frame
-   */
-  public FrameInfo getRecentFrame() {
-    return frames.getLast();
-  }
+   /**
+    * Get the frames
+    * @return The frames
+    */
+   public List<FrameInfo> getFrames()
+   {
+      return frames;
+   }
 
-  /**
-   * Get the total time
-   * @return The total time
-   */
-  public long getTotalTime() {
-    if (totalTime <= 0) {
+   /**
+    * Add a frame to a thread
+    * @param f The frame
+    */
+   public void add(FrameInfo f)
+   {
+      frames.addLast(f);
       totalTime = 0;
+   }
 
-      if (getFrames() != null) {
-        for (FrameInfo f : getFrames()) {
-          totalTime += f.getNetTime();
-          totalTime += getTotalTime(f.getChildren());
-        }
+   /**
+    * Get the recent frame for a thread
+    * @return The frame
+    */
+   public FrameInfo getRecentFrame()
+   {
+      return frames.getLast();
+   }
+
+   /**
+    * Get the total time
+    * @return The total time
+    */
+   public long getTotalTime()
+   {
+      if (totalTime <= 0)
+      {
+         totalTime = 0;
+
+         if (getFrames() != null)
+         {
+            for (FrameInfo f : getFrames())
+            {
+               totalTime += f.getNetTime();
+               totalTime += getTotalTime(f.getChildren());
+            }
+         }
       }
-    }
-    return totalTime;
-  }
+      return totalTime;
+   }
 
-  /**
-   * Get the total time for a thread
-   * @param ti The thread
-   * @return The total time (ns)
-   */
-  private long getTotalTime(List<FrameInfo> l) {
-    long r = 0;
+   /**
+    * Get the total time for a thread
+    * @param ti The thread
+    * @return The total time (ns)
+    */
+   private long getTotalTime(List<FrameInfo> l)
+   {
+      long r = 0;
 
-    if (l != null) {
-      for (FrameInfo f : l) {
-        r += f.getNetTime();
-        r += getTotalTime(f.getChildren());
+      if (l != null)
+      {
+         for (FrameInfo f : l)
+         {
+            r += f.getNetTime();
+            r += getTotalTime(f.getChildren());
+         }
       }
-    }
 
-    return r;
-  }
+      return r;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfoProxy.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfoProxy.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/ThreadInfoProxy.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -29,111 +29,130 @@
  * Represents a thread and its frames - the frame for this class are lazy initialized
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ThreadInfoProxy extends ThreadInfo {
+public class ThreadInfoProxy extends ThreadInfo
+{
 
-  /** Serial version UID */
-  static final long serialVersionUID = -4842008327790962286L;
+   /** Serial version UID */
+   static final long serialVersionUID = -4842008327790962286L;
 
-  /** Frame path */
-  private File framePath;
+   /** Frame path */
+   private File framePath;
 
-  /** Initialized */
-  private boolean initialized;
+   /** Initialized */
+   private boolean initialized;
 
-  /**
-   * Constructor
-   * @param fp The frame path
-   * @param ti The thread info
-   */
-  public ThreadInfoProxy(File fp, ThreadInfo ti) {
-    super(ti.getId(), ti.getName(), ti.getPriority(), ti.isDaemon(), ti.getGroups());
+   /**
+    * Constructor
+    * @param fp The frame path
+    * @param ti The thread info
+    */
+   public ThreadInfoProxy(File fp, ThreadInfo ti)
+   {
+      super(ti.getId(), ti.getName(), ti.getPriority(), ti.isDaemon(), ti.getGroups());
 
-    this.framePath = fp;
-    this.initialized = false;
-  }
+      this.framePath = fp;
+      this.initialized = false;
+   }
 
-  /**
-   * Get the frames
-   * @return The frames
-   */
-  @Override
-  public List<FrameInfo> getFrames() {
-    if (!initialized) {
-      init();
-    }
+   /**
+    * Get the frames
+    * @return The frames
+    */
+   @Override
+   public List<FrameInfo> getFrames()
+   {
+      if (!initialized)
+      {
+         init();
+      }
 
-    return super.getFrames();
-  }
-  
-  /**
-   * Add a frame to a thread
-   * @param f The frame
-   */
-  @Override
-  public void add(FrameInfo f) {
-    if (!initialized) {
-      init();
-    }
+      return super.getFrames();
+   }
 
-    super.add(f);
-  }
-  
-  /**
-   * Get the recent frame for a thread
-   * @return The frame
-   */
-  @Override
-  public FrameInfo getRecentFrame() {
-    if (!initialized) {
-      init();
-    }
+   /**
+    * Add a frame to a thread
+    * @param f The frame
+    */
+   @Override
+   public void add(FrameInfo f)
+   {
+      if (!initialized)
+      {
+         init();
+      }
 
-    return super.getRecentFrame();
-  }
+      super.add(f);
+   }
 
-  /**
-   * Get the total time
-   * @return The total time
-   */
-  @Override
-  public long getTotalTime() {
-    if (!initialized) {
-      init();
-    }
+   /**
+    * Get the recent frame for a thread
+    * @return The frame
+    */
+   @Override
+   public FrameInfo getRecentFrame()
+   {
+      if (!initialized)
+      {
+         init();
+      }
 
-    return super.getTotalTime();
-  }
+      return super.getRecentFrame();
+   }
 
-  /**
-   * Reset the frame info
-   */
-  public void resetFrames() {
-    frames = new LinkedList<FrameInfo>();
-    initialized = false;
-  }
+   /**
+    * Get the total time
+    * @return The total time
+    */
+   @Override
+   public long getTotalTime()
+   {
+      if (!initialized)
+      {
+         init();
+      }
 
-  /**
-   * Init
-   */
-  private void init() {
-    boolean found = true;
-    long counter = 0;
-    while (found) {
-      try {
-        File f = new File(framePath, Long.toString(counter));
-        if (f.exists()) {
-          FrameInfo fi = FrameHelper.load(f);
-          super.add(fi);
-          
-          counter += 1;
-        } else {
-          found = false;
-        }
-      } catch (Exception e) {
-        found = false;
+      return super.getTotalTime();
+   }
+
+   /**
+    * Reset the frame info
+    */
+   public void resetFrames()
+   {
+      frames = new LinkedList<FrameInfo>();
+      initialized = false;
+   }
+
+   /**
+    * Init
+    */
+   private void init()
+   {
+      boolean found = true;
+      long counter = 0;
+      while (found)
+      {
+         try
+         {
+            File f = new File(framePath, Long.toString(counter));
+            if (f.exists())
+            {
+               FrameInfo fi = FrameHelper.load(f);
+               super.add(fi);
+
+               counter += 1;
+            }
+            else
+            {
+               found = false;
+            }
+         }
+         catch (Exception e)
+         {
+            found = false;
+         }
       }
-    }
 
-    initialized = true;
-  }
+      initialized = true;
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Version.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Version.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Version.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,23 +25,26 @@
  * The version class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Version {
+public class Version
+{
 
-  /** The vendor */
-  public static final String VENDOR = "JBoss"; 
+   /** The vendor */
+   public static final String VENDOR = "JBoss";
 
-  /** The product */
-  public static final String PRODUCT = "Profiler"; 
+   /** The product */
+   public static final String PRODUCT = "Profiler";
 
-  /** The version */
-  public static final String VERSION = "2.0.0.Beta6";
+   /** The version */
+   public static final String VERSION = "2.0.0.Beta6";
 
-  /** Full version */
-  public static final String FULL_VERSION = VENDOR + " " + PRODUCT + " " + VERSION;
+   /** Full version */
+   public static final String FULL_VERSION = VENDOR +
+         " " + PRODUCT + " " + VERSION;
 
-  /**
-   * Constructor
-   */
-  private Version() {
-  }
+   /**
+    * Constructor
+    */
+   private Version()
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Visibility.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Visibility.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/Visibility.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,25 +25,26 @@
  * Defines the method visibility
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public enum Visibility {
+public enum Visibility
+{
 
-  /**
-   * Private
-   */
-  PRIVATE,
+   /**
+    * Private
+    */
+   PRIVATE,
 
-  /**
-   * Protected
-   */
-  PROTECTED,
+   /**
+    * Protected
+    */
+   PROTECTED,
 
-  /**
-   * Package
-   */
-  PACKAGE,
+   /**
+    * Package
+    */
+   PACKAGE,
 
-  /**
-   * Public
-   */
-  PUBLIC
+   /**
+    * Public
+    */
+   PUBLIC
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Complex.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Complex.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Complex.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,31 +25,36 @@
  * The complex class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Complex {
+public class Complex
+{
 
-  /**
-   * Constructor
-   */
-  public Complex() {
-  }
+   /**
+    * Constructor
+    */
+   public Complex()
+   {
+   }
 
-  /**
-   * Call: Public
-   */
-  public void call() {
-    privateCall();
-  }
+   /**
+    * Call: Public
+    */
+   public void call()
+   {
+      privateCall();
+   }
 
-  /**
-   * Call: Private
-   */
-  private void privateCall() {
-    publicCall();
-  }
+   /**
+    * Call: Private
+    */
+   private void privateCall()
+   {
+      publicCall();
+   }
 
-  /**
-   * Call: Public
-   */
-  public void publicCall() {
-  }
+   /**
+    * Call: Public
+    */
+   public void publicCall()
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -31,100 +31,109 @@
  * Entity
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Entity implements EntityBean {
-  /** Entity context */
-  protected EntityContext ejbContext;
+public class Entity implements EntityBean
+{
+   /** Entity context */
+   protected EntityContext ejbContext;
 
-  /**
-   * A container invokes this method when the instance is
-   * taken out of the pool of available instances to become
-   * associated with a specific EJB object.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbActivate() throws EJBException {
-  }
-  
-  /**
-   * A container invokes this method on an instance before
-   * the instance becomes disassociated with a specific EJB object.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbPassivate() throws EJBException {
-  }
-  
-  /**
-   * A container invokes this method before it removes the EJB object
-   * that is currently associated with the instance.
-   *
-   * @exception RemoveException Thrown by the method to indicate a failure
-   *                            caused by a remove error.
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbRemove() throws RemoveException, EJBException {
-  }
-  
-  /**
-   * A container invokes this method to instruct the instance to
-   * synchronize its state by loading it state from the underlying
-   * database.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbLoad() throws EJBException {
-  }
-  
-  /**
-   * A container invokes this method to instruct the instance to
-   * synchronize its state by storing it to the underlying database.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbStore() throws EJBException {
-  }
-  
-  /**
-   * Set the associated entity context.
-   *
-   * @param ctx An EntityContext interface for the instance. The instance should store the reference
-   *            to the context in an instance variable.
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void setEntityContext(EntityContext ctx) throws EJBException {
-    ejbContext = ctx;
-  }
-  
-  /**
-   * Unset the associated entity context.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void unsetEntityContext() throws EJBException {
-    ejbContext = null;
-  }
+   /**
+    * A container invokes this method when the instance is
+    * taken out of the pool of available instances to become
+    * associated with a specific EJB object.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbActivate() throws EJBException
+   {
+   }
 
-  /**
-   * Create
-   * @return The primary key of the new instance
-   * @exception CreateException Thrown if a create error occurs
-   */
-  public Long ejbCreate() throws CreateException {
-    return null;
-  }
+   /**
+    * A container invokes this method on an instance before
+    * the instance becomes disassociated with a specific EJB object.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbPassivate() throws EJBException
+   {
+   }
 
-  /**
-   * Post create method
-   * @exception CreateException Thrown if a create error occurs
-   */
-  public void ejbPostCreate()
-    throws CreateException {
-  }
+   /**
+    * A container invokes this method before it removes the EJB object
+    * that is currently associated with the instance.
+    *
+    * @exception RemoveException Thrown by the method to indicate a failure
+    *                            caused by a remove error.
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbRemove() throws RemoveException, EJBException
+   {
+   }
+
+   /**
+    * A container invokes this method to instruct the instance to
+    * synchronize its state by loading it state from the underlying
+    * database.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbLoad() throws EJBException
+   {
+   }
+
+   /**
+    * A container invokes this method to instruct the instance to
+    * synchronize its state by storing it to the underlying database.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbStore() throws EJBException
+   {
+   }
+
+   /**
+    * Set the associated entity context.
+    *
+    * @param ctx An EntityContext interface for the instance. The instance should store the reference
+    *            to the context in an instance variable.
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void setEntityContext(EntityContext ctx) throws EJBException
+   {
+      ejbContext = ctx;
+   }
+
+   /**
+    * Unset the associated entity context.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void unsetEntityContext() throws EJBException
+   {
+      ejbContext = null;
+   }
+
+   /**
+    * Create
+    * @return The primary key of the new instance
+    * @exception CreateException Thrown if a create error occurs
+    */
+   public Long ejbCreate() throws CreateException
+   {
+      return null;
+   }
+
+   /**
+    * Post create method
+    * @exception CreateException Thrown if a create error occurs
+    */
+   public void ejbPostCreate() throws CreateException
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity3.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity3.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Entity3.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,5 +28,6 @@
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
 @Entity
-public class Entity3 {
+public class Entity3
+{
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMX.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMX.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMX.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,11 +25,13 @@
  * JMX MBean: Implementation
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class JMX implements JMXMBean {
+public class JMX implements JMXMBean
+{
 
-  /**
-   * Constructor
-   */
-  public JMX() {
-  }
+   /**
+    * Constructor
+    */
+   public JMX()
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMXMBean.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMXMBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/JMXMBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,5 +25,6 @@
  * JMX MBean: Interface
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public interface JMXMBean {
+public interface JMXMBean
+{
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/ManagedBean.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/ManagedBean.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/ManagedBean.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -27,11 +27,13 @@
  * JSF: Managed Bean
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class ManagedBean implements Serializable {
+public class ManagedBean implements Serializable
+{
 
-  /**
-   * Constructor
-   */
-  public ManagedBean() {
-  }
+   /**
+    * Constructor
+    */
+   public ManagedBean()
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -30,44 +30,49 @@
  * Message
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Message implements MessageDrivenBean, MessageListener {
-  /** Message context */
-  protected MessageDrivenContext ejbContext;
+public class Message implements MessageDrivenBean, MessageListener
+{
+   /** Message context */
+   protected MessageDrivenContext ejbContext;
 
-  /**
-   * Default message driven create method
-   */
-  public void ejbCreate() {
-  }
+   /**
+    * Default message driven create method
+    */
+   public void ejbCreate()
+   {
+   }
 
-  /**
-   * A container invokes this method before it removes the EJB object
-   * that is currently associated with the instance.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbRemove() throws EJBException {
-    ejbContext = null;
-  }
-  
-  /**
-   * Set the associated message context.
-   *
-   * @param ctx A MessageDrivenContext interface for the instance. The instance should store the
-   *            reference to the context in an instance variable.
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException {
-    ejbContext = ctx;
-  }
+   /**
+    * A container invokes this method before it removes the EJB object
+    * that is currently associated with the instance.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbRemove() throws EJBException
+   {
+      ejbContext = null;
+   }
 
-  /**
-   * On message
-   * @param message The incoming message
-   */
-  public void onMessage(javax.jms.Message message) {
-  }
+   /**
+    * Set the associated message context.
+    *
+    * @param ctx A MessageDrivenContext interface for the instance. The instance should store the
+    *            reference to the context in an instance variable.
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
+   {
+      ejbContext = ctx;
+   }
 
+   /**
+    * On message
+    * @param message The incoming message
+    */
+   public void onMessage(javax.jms.Message message)
+   {
+   }
+
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message3.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message3.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Message3.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,5 +28,6 @@
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
 @MessageDriven
-public class Message3 {
+public class Message3
+{
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -30,64 +30,71 @@
  * Session
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Session implements SessionBean {
-  /** Session context */
-  protected SessionContext ejbContext;
+public class Session implements SessionBean
+{
+   /** Session context */
+   protected SessionContext ejbContext;
 
-  /**
-   * A container invokes this method when the instance is
-   * taken out of the pool of available instances to become
-   * associated with a specific EJB object.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbActivate() throws EJBException {
-  }
-  
-  /**
-   * A container invokes this method on an instance before
-   * the instance becomes disassociated with a specific EJB object.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbPassivate() throws EJBException {
-  }
-  
-  /**
-   * A container invokes this method before it removes the EJB object
-   * that is currently associated with the instance.
-   *
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void ejbRemove() throws EJBException {
-  }
-  
-  /**
-   * Set the associated session context.
-   *
-   * @param ctx A SessionContext interface for the instance. The instance should store the reference
-   *            to the context in an instance variable.
-   * @exception EJBException Thrown by the method to indicate a failure
-   *                         caused by a system-level error.
-   */
-  public void setSessionContext(SessionContext ctx) throws EJBException {
-    ejbContext = ctx;
-  }
+   /**
+    * A container invokes this method when the instance is
+    * taken out of the pool of available instances to become
+    * associated with a specific EJB object.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbActivate() throws EJBException
+   {
+   }
 
-  /**
-   * Unset the associated session context.
-   */
-  public void unsetSessionContext() {
-    ejbContext = null;
-  }
+   /**
+    * A container invokes this method on an instance before
+    * the instance becomes disassociated with a specific EJB object.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbPassivate() throws EJBException
+   {
+   }
 
-  /**
-   * Create
-   * @exception CreateException Thrown if a create error occurs
-   */
-  public void ejbCreate() throws CreateException {
-  }
+   /**
+    * A container invokes this method before it removes the EJB object
+    * that is currently associated with the instance.
+    *
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void ejbRemove() throws EJBException
+   {
+   }
+
+   /**
+    * Set the associated session context.
+    *
+    * @param ctx A SessionContext interface for the instance. The instance should store the reference
+    *            to the context in an instance variable.
+    * @exception EJBException Thrown by the method to indicate a failure
+    *                         caused by a system-level error.
+    */
+   public void setSessionContext(SessionContext ctx) throws EJBException
+   {
+      ejbContext = ctx;
+   }
+
+   /**
+    * Unset the associated session context.
+    */
+   public void unsetSessionContext()
+   {
+      ejbContext = null;
+   }
+
+   /**
+    * Create
+    * @exception CreateException Thrown if a create error occurs
+    */
+   public void ejbCreate() throws CreateException
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session3.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session3.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Session3.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -28,5 +28,6 @@
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
 @Stateless
-public class Session3 {
+public class Session3
+{
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Simple.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Simple.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Simple.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,17 +25,20 @@
  * The simple class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Simple {
+public class Simple
+{
 
-  /**
-   * Constructor
-   */
-  public Simple() {
-  }
+   /**
+    * Constructor
+    */
+   public Simple()
+   {
+   }
 
-  /**
-   * Call
-   */
-  public void call() {
-  }
+   /**
+    * Call
+    */
+   public void call()
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -25,111 +25,131 @@
  * The test class
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class Test {
+public class Test
+{
 
-  /**
-   * Method: A
-   * @param times The number of times
-   */
-  public void a(int times) {
-    for (int i = 0; i < times; i++) {
-      Simple s = new Simple();
-      s.call();
-    }
-  }
+   /**
+    * Method: A
+    * @param times The number of times
+    */
+   public void a(int times)
+   {
+      for (int i = 0; i < times; i++)
+      {
+         Simple s = new Simple();
+         s.call();
+      }
+   }
 
-  /**
-   * Method: B
-   */
-  public void b() {
-    for (int i = 0; i < 5000; i++) {
-      Complex c = new Complex();
-      c.call();
-    }
-  }
+   /**
+    * Method: B
+    */
+   public void b()
+   {
+      for (int i = 0; i < 5000; i++)
+      {
+         Complex c = new Complex();
+         c.call();
+      }
+   }
 
-  /**
-   * Method: C
-   */
-  public void c() {
-    for (int i = 0; i < 10; i++) {
-      Thread t  = new Thread() {
-        @Override
-        public void run() {
-          d();
-        }
-      };
-      t.start();
-    }
-  }
+   /**
+    * Method: C
+    */
+   public void c()
+   {
+      for (int i = 0; i < 10; i++)
+      {
+         Thread t = new Thread()
+         {
+            @Override
+            public void run()
+            {
+               d();
+            }
+         };
+         t.start();
+      }
+   }
 
-  /**
-   * Method: D
-   */
-  public void d() {
-  }
- 
-  /**
-   * Method: E
-   */
-  public void e() {
-    try {
-      Session session = new Session();
-      session.ejbCreate();
+   /**
+    * Method: D
+    */
+   public void d()
+   {
+   }
 
-      Entity entity = new Entity();
-      entity.ejbCreate();
+   /**
+    * Method: E
+    */
+   public void e()
+   {
+      try
+      {
+         Session session = new Session();
+         session.ejbCreate();
 
-      Message message = new Message();
-      message.onMessage(null);
+         Entity entity = new Entity();
+         entity.ejbCreate();
 
-      TestServlet servlet = new TestServlet();
-      servlet.doGet(null, null);
+         Message message = new Message();
+         message.onMessage(null);
 
-      JMX jmx = new JMX();
+         TestServlet servlet = new TestServlet();
+         servlet.doGet(null, null);
 
-      ManagedBean mb = new ManagedBean();
+         JMX jmx = new JMX();
 
-      Session3 session3 = new Session3();
+         ManagedBean mb = new ManagedBean();
 
-      Entity3 entity3 = new Entity3();
+         Session3 session3 = new Session3();
 
-      Message3 message3 = new Message3();
+         Entity3 entity3 = new Entity3();
 
-    } catch (Exception e) {
-      // Ignore
-    }
-  }
- 
-  /**
-   * Method: F
-   */
-  void f() {
-    try {
-      Thread.sleep(2000);
-    } catch (InterruptedException ie) {
-      // Ignore
-    }
-  }
- 
-  /**
-   * The main method
-   * @param args The arguments
-   */
-  public static void main(String[] args) {
-    Test t = new Test();
+         Message3 message3 = new Message3();
 
-    int i = 10000;
+      }
+      catch (Exception e)
+      {
+         // Ignore
+      }
+   }
 
-    if (args != null && args.length > 0) {
-      i = Integer.parseInt(args[0]);
-    }
+   /**
+    * Method: F
+    */
+   void f()
+   {
+      try
+      {
+         Thread.sleep(2000);
+      }
+      catch (InterruptedException ie)
+      {
+         // Ignore
+      }
+   }
 
-    t.a(i);
-    t.b();
-    t.c();
-    t.e();
-    t.f();
-    System.out.println("Done.");
-  }
+   /**
+    * The main method
+    * @param args The arguments
+    */
+   public static void main(String[] args)
+   {
+      Test t = new Test();
+
+      int i = 10000;
+
+      if (args != null && args.length > 0)
+      {
+         i = Integer.parseInt(args[0]);
+      }
+
+      t.a(i);
+      t.b();
+      t.c();
+      t.e();
+      t.f();
+      System.out.println("Done.");
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/TestServlet.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/TestServlet.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/TestServlet.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -32,16 +32,17 @@
  * Servlet
  * @author Jesper Pedersen <jesper.pedersen at jboss.org>
  */
-public class TestServlet extends HttpServlet {
+public class TestServlet extends HttpServlet
+{
 
-  /**
-   * Handles the GET requests
-   * @param req The servlet request
-   * @param resp The servlet response
-   * @throws ServletException in case of servlet error
-   * @throws IOException in case of IO error
-   */
-  public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    throws ServletException, IOException {
-  }
+   /**
+    * Handles the GET requests
+    * @param req The servlet request
+    * @param resp The servlet response
+    * @throws ServletException in case of servlet error
+    * @throws IOException in case of IO error
+    */
+   public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+   {
+   }
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/JVMTIWebTestManual.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/JVMTIWebTestManual.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/JVMTIWebTestManual.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -80,16 +80,15 @@
       staticField = str[0];
 
       JVMTIInterface jvmti = new JVMTIInterface();
-      
+
       System.out.println(jvmti.inventoryReport());
 
       CountDownLatch latch = new CountDownLatch(1);
 
       jvmti.startMemoryProfiler(new InetSocketAddress(3232), latch);
-      
 
       latch.await();
-      
+
       System.out.println("strroot = " + strroot2);
    }
 

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/StressReportTest.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/StressReportTest.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/StressReportTest.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -20,7 +20,6 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-
 package org.jboss.profiler.test.jvmti;
 
 import org.jboss.profiler.jvmti.JVMTIInterface;
@@ -46,16 +45,16 @@
    // Constructors --------------------------------------------------
 
    // Public --------------------------------------------------------
-   
+
    public void testReports() throws Exception
    {
       long i = 0;
-      
+
       JVMTIInterface jvmti = new JVMTIInterface();
-      
+
       while (true)
       {
-         if (i ++ % 100 == 0)
+         if (i++ % 100 == 0)
          {
             System.out.println("i = " + i);
          }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/TestClass.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/TestClass.java	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/jvmti/TestClass.java	2009-08-18 02:08:43 UTC (rev 561)
@@ -20,7 +20,6 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-
 package org.jboss.profiler.test.jvmti;
 
 /**
@@ -34,8 +33,11 @@
 {
 
    long a = 1;
+
    long a2 = 1;
+
    long a3 = 1;
+
    long a4 = 1;
    // Constants -----------------------------------------------------
 

Modified: branches/JBossProfiler2/tools/checkstyle/checkstyle.xml
===================================================================
--- branches/JBossProfiler2/tools/checkstyle/checkstyle.xml	2009-08-17 17:30:58 UTC (rev 560)
+++ branches/JBossProfiler2/tools/checkstyle/checkstyle.xml	2009-08-18 02:08:43 UTC (rev 561)
@@ -43,10 +43,10 @@
 
     <!-- Code layout -->
     <module name="LeftCurly">
-      <property name="option" value="eol"/>
+      <property name="option" value="nl"/>
     </module>
     <module name="RightCurly">
-      <property name="option" value="same"/>
+      <property name="option" value="alone"/>
     </module>
     <module name="ParenPad"/>
 
@@ -103,7 +103,7 @@
     <!-- Simplify your code -->
     <module name="AvoidStarImport"/>
     <module name="RedundantImport"/>
-    <!-- <module name="UnusedImports"/> -->
+    <module name="UnusedImports"/>
     <module name="SimplifyBooleanExpression"/>
     <module name="SimplifyBooleanReturn"/>
 
@@ -134,13 +134,20 @@
 
     <!-- Indentation -->
     <module name="Indentation">
-      <property name="basicOffset" value="2"/>
-      <property name="caseIndent" value="2"/>
+      <property name="basicOffset" value="3"/>
+      <property name="caseIndent" value="3"/>
     </module>
 
     <!-- StringLiteralEquality -->
     <module name="StringLiteralEquality"/>
 
+    <!-- Annotations -->
+    <module name="AnnotationUseStyle">
+      <property name="elementStyle" value="ignore"/>
+      <property name="trailingArrayComma" value="never"/>
+      <property name="closingParens" value="ignore"/>
+    </module>
+
   </module>
 
   <!-- Enforce License Header -->




More information about the jboss-cvs-commits mailing list