Wednesday, June 22, 2011

IDEs for the Polyglot Programmer on Windows

First off, I'm never going to pay for an IDE. It goes against my nature of being resourceful and cheap. Here is what I've found in the Open Source space. I am not talking about pure Java Enterprise development. (For that you should standardize on one of the big 3: eclipse/netbeans/intelliJ). This is for the person who enjoys playing in Ruby, Groovy, PHP, or your language of the day. On a Mac, I'm told the favorite is TextMate. But what should we use on Windows....???

IDE
1. Komodo Edit - very lightweight (50MB RAM). Ctrl+J for code completion. Add-ons are great and done like Firefox add-ons. No Groovy.
2. Aptana Studio - awesome Git integration. it's eclipse with better layout and color scheme. but it's a bit bulky (150MB RAM). No Groovy.

Just a Text Editor with Syntax Highlighting:
Notepad++

No
RubyMine - cool, but only 30-day trial is free.
SciTE Scintilla Based Text Editor - just a text editor. Notepad++ is better.

Read More »

Monday, June 13, 2011

Groovy JMX MBean Viewer instead of JConsole

You might be monitoring something with JConsole, and thinking, how can I automate this check?

Answer: With Groovy!

Here is an example of how easy it is to probe an ActiveMQ MBean that sits on 2 App Servers.

import javax.management.remote.*

['11.12.13.123', '11.12.13.124'].each { serverIp ->
   def server = jmxConnect(serverIp)
   def mbean = new GroovyMBean(server, 'org.apache.activemq:BrokerName=appEventBroker,Type=Queue,Destination=appEventQueue')
   println "On app server $serverIp"
   printQueueStatus(mbean)
}

def jmxConnect(serverIp) {
   def url = "service:jmx:rmi:///jndi/rmi://$serverIp:8999/jmxrmi"
   def env = [(JMXConnector.CREDENTIALS): (String[])['myRole', 'myPassword']]
   def connection = JMXConnectorFactory.connect(new JMXServiceURL(url), env)
   def server = connection.MBeanServerConnection
   return server
}

def printQueueStatus(mbean) {
   println "DequeueCount: $mbean.DequeueCount"
   println "EnqueueCount: $mbean.EnqueueCount"
}

Read More »