<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/jdk/jdk4.rb</filename>
    </added>
    <added>
      <filename>lib/jdk/jdk5.rb</filename>
    </added>
    <added>
      <filename>lib/jdk/jdk6.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -29,6 +29,11 @@ jmx4r helps to manage Java applications using JMX in a simple and powerful way:
   # trigger a Garbage Collection
   memory.gc
 
+  # For local processes not publishing jmxrmi ports, instead:
+
+  # connect to the local JConsole process
+  JMX::MBean.establish_connection :command =&gt; /jconsole/i
+
 == Help
 
 * Wiki[http://jmesnil.net/wiki/Jmx4r]</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,35 +1,32 @@
 
 module JMX
   module JDKHelper
-    class &lt;&lt; self
-      include_class 'java.lang.System'
-
-      def init
-        @helper = nil
+    include_class 'java.lang.System'
 
-        if has_java_class?(&quot;com.sun.tools.attach.VirtualMachine&quot;)
-          require &quot;jdk/jdk6_helper&quot;
-          @helper = JDK6Helper
-          return
-        end
-
-        if has_java_class?('sun.jvmstat.monitor.MonitoredHost')
-          require &quot;jdk/jdk5_helper&quot;
-          @helper = JDK5Helper
-          return
-        end
-      end
+    class &lt;&lt; self
 
       def method_missing(method, *args, &amp;block)
-        unless @helper
-          raise &quot;JDKHelper implementation is not available - \
-            maybe only JREs are installed properly.&quot;
-        end
-        @helper.send method, *args, &amp;block
+        init unless @jdk
+        @jdk.send method, *args, &amp;block
       end
 
     private
 
+      def init
+        @jdk =
+          case
+          when has_java_class?(&quot;com.sun.tools.attach.VirtualMachine&quot;)
+            require &quot;jdk/jdk6&quot;
+            JDK6
+          when has_java_class?('sun.jvmstat.monitor.MonitoredHost')
+            require &quot;jdk/jdk5&quot;
+            JDK5
+          else
+            require &quot;jdk/jdk4&quot;
+            JDK4
+          end
+      end
+
       def has_java_class?(name)
         begin
           include_class name
@@ -67,8 +64,6 @@ module JMX
       end
     end
 
-    self.init
   end
-
 end
 </diff>
      <filename>lib/jdk_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,7 @@ module JMX
   require 'dynamic_mbean'
   require 'open_data_helper'
   require 'objectname_helper'
+  require 'jdk_helper'
   require 'jruby'
 
   class MBeanServerConnectionProxy
@@ -145,8 +146,9 @@ module JMX
     #                     not taken into account
     #
     # [:command]          the pattern matches the command line of the local
-    #                     JVM process.
-    #                     (listed as 'local processes' on JConsole).
+    #                     JVM process including the MBean server.
+    #                     (command lines are listed on the connection dialog
+    #                      in JConsole).
     #                     No default.
     #                     this feature needs a JDK (&gt;=5) installed on the local
     #                     system.
@@ -175,7 +177,6 @@ module JMX
       provider_package = args[:provider_package]
       
       if args[:command]
-        require 'jdk_helper'
         url = JDKHelper.find_local_url(args[:command]) or
           raise &quot;no locally attacheable VMs&quot;
       else</diff>
      <filename>lib/jmx4r.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/jdk/jdk5_helper.rb</filename>
    </removed>
    <removed>
      <filename>lib/jdk/jdk6_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>478de5bc0bc49dd8bc7145d87056080e8a3ee1df</id>
    </parent>
  </parents>
  <author>
    <name>sat13f</name>
    <email>sat13f@gmail.com</email>
  </author>
  <url>http://github.com/jmesnil/jmx4r/commit/383d9b45df487a36b0c4f3b7bb3b35ba853c1460</url>
  <id>383d9b45df487a36b0c4f3b7bb3b35ba853c1460</id>
  <committed-date>2009-10-22T01:41:08-07:00</committed-date>
  <authored-date>2009-08-03T09:26:25-07:00</authored-date>
  <message>refactored</message>
  <tree>6b347b2a3f2fb4831e2de2e3fe262dd528f3e3fd</tree>
  <committer>
    <name>Jeff Mesnil</name>
    <email>jmesnil@gmail.com</email>
  </committer>
</commit>
