module JMX
require 'java'
include_class 'java.util.HashMap'
include_package 'java.lang.management'
include_package 'javax.management'
include_package 'javax.management.remote'
url = JMXServiceURL.new "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi"
connector = JMXConnectorFactory::connect url, HashMap.new
mbsc = connector.mbean_server_connection
memory_mbean = ManagementFactory::newPlatformMXBeanProxy mbsc, "java.lang:type=Memory",
MemoryMXBean::java_class
memory_mbean.verbose = !memory_mbean.verbose
puts "verbose = #{memory_mbean.verbose}"
memory_mbean.gc
end
Saturday, June 9, 2007
Nice Blog on JRuby + JMX
While stumbling around trying to replicate a JXTA Hello world type application in JRuby, I ran across a well-written tutorial by Jeff Mesnil on how to script JMX with JRuby as well a part II.
Wednesday, June 6, 2007
Why are there no Awk Jobs?
My buddy over on OReilly Ruby Blog posed the profound question why there are no Ruby jobs?.
Although I was shocked that Dice (for Chicago) just brought up 32 hits. Amazing, far more than the last time I checked. Compared to 41 for Python, 202 for Perl, 784 for Java, and 351 for C#. And don't forget awk. Five whole jobs in Chicagoland.
To quote:
Shitty documentation. Lack of decent built-in APIs. Rubyforge sucking big-time compared to CPAN or Cheese Shop. All the Japanese? Everything starting with R. Not coming default on Real OS's (OSX doesn't count, spare me). Being cute? Not being used in the application infrastructure of any Real OS's. (FreeBSD is an anomaly in that it doesn't require Perl, all the other distros I can think of Require at least Perl and some like Ubuntu, Python). All the crap about programming being fun? A significantly large number of Ruby-ists (or RoR-ists) that use OSX? Should I go on?I guess it could be a lot of things, any of the below or a combination might be to blame:
- Lack of good marketing for non-web oriented Ruby
- Assumption that Ruby is not general purpose as a side effect of the success of RoR’s marketing
- Technical issues that I can’t think of that make it an inferior choice to other languages
- Ruby adoption might be in nature slower than Rails adoption, but on it’s way
- MRI isn’t robust enough for the ‘enterprise’, so companies are waiting on JRuby
Alls of these equate to non-ENTERPRISE.
Waiting for JRuby? Please. That is so rich I almost spit my fruit bar onto the screen. And I think JRuby is cool. Maybe that nobody does any "real work" (meaning the pays $$, blogging doesn't count) in Ruby. Well, except maybe Matasano.
Running Ruby on Ancient Solaris Boxes
If you think I hate Ruby, well I hate Solaris even more. It's lack of GNU. Hell, it's lack about about anything useful built-in. It's like *BSD on steroids.
But believe it or not I (sort of) even managed to get Ruby 1.8.6 built and (sort of) running on an old 2.6 and 2.8 box today. It nearly killed the 2.6 box (an Ultra-5) but here's how I did it:
But be warned, all I ran was a simple hello world app and parsed a YAML file, so it will be interesting to see what works and what sends these boxes to a timely death.
But believe it or not I (sort of) even managed to get Ruby 1.8.6 built and (sort of) running on an old 2.6 and 2.8 box today. It nearly killed the 2.6 box (an Ultra-5) but here's how I did it:
- Make sure you at least have gcc, GNU Make, and a version of of GNU Grep in your path somewhere. You probably need more. The latter were things that I know I tripped up on.
- Rip out most of the directories in ext. All I had left in mine were: enumerator, etc, fcnctl, io, pty, racc, socket, socket, stringio, strscan, syck, thread.
- If you need to use YAML, change the first require in yaml.rb to require 'yaml/stringio'
But be warned, all I ran was a simple hello world app and parsed a YAML file, so it will be interesting to see what works and what sends these boxes to a timely death.
Subscribe to:
Posts (Atom)