Moving right along... We have a roof, a door and some further siding.
Saturday, October 31, 2009
Wednesday, October 28, 2009
Shed Again
Monday, October 26, 2009
Saturday, October 24, 2009
Friday, October 23, 2009
Intercepting Log Messages in Glassfish
Image by Getty Images via Daylife
There weren't a lot of examples of this to be found, so here some code. First, the MBean itself. The MBean needs to be built in conformance with some simple but very specific rules.
- It must implement javax.management.NotificationListener
- It must have an interface of its own with the same name as the MBean, but ending in "MBean"
package com.log.monitor;It is a trivial Java Bean interface with one getter/setter pair added here just as an example. Here is the implementation class:
import javax.management.Notification;
import javax.management.NotificationListener;
public interface CustomActionMBean {
public int getA();
public void setA(int a);
}
package com.log.monitor;
import javax.management.Notification;
import javax.management.NotificationListener;
public class CustomAction implements CustomActionMBean, NotificationListener {
private int a = 0;
public CustomAction() {
}
public void setA(int a) {
this.a = a;
}
public int getA() {
return a;
}
public void handleNotification(Notification arg0, Object arg1) {
System.out.println("Called... " + arg0.getMessage());
}
}
These get built into a jar file called CutomAction.jar, using whatever IDE or command line you prefer. I used Eclipse, and I found that I had to uncheck the compression option to get this to fully work.I deployed the jar file to Glassfish using its web-based administration console. This is done in a manner simular to deploying anything else, but using the section under "custom mbeans." There is a command line method too, using asadmin. The deployment will fail if there's anything wrong with the MBean, such as an incorrect interface name or referring to the wrong Notification classes.
Once this is done, a Management Rule can be created. The key here is that the "event type" should be "log". The MBean deployed above should appear in the "Action" drop down list. Each event type has different options. In the case of a log type it is also possible to select a log level, and a specific logger as filters. But once activated, this rule will call the new MBean as needed when an appropriate log message is created. The raw message string is available from the Notification object with getMessage().
Here's a few good resources on all this:
http://weblogs.java.net/blog/sankara/archive/2006/02/self_management.html
http://blogs.sun.com/technical/entry/self_management_rules
https://glassfish.dev.java.net/javaee5/selfmanagement/selfmanagementhome.html
http://www.caucho.com/resin-3.0/jmx/tutorial/listener/index.xtp
Thursday, October 22, 2009
Shed, Part One
Monday, August 10, 2009
US Internet Service is Pathetic
Image by [ r ♥ c e y t ♥ y ] {I br♥ke for bokeh} via Flickr
"Portugal ISP Zon will be offering its customers 1Gbps service starting this September. The country will then become the world’s third (and the first in Europe) to provide such speeds, along with Japan and South Korea."
Wednesday, July 22, 2009
Apollo
Image by Vaguely Artistic via Flickr
http://www.nytimes.com/2009/07/19/opinion/19wolfe.html?pagewanted=1&_r=1
"Three months after the landing, however, in October 1969, I began to wonder ... I was in Florida, at Cape Kennedy, the space program’s launching facility, aboard a NASA tour bus. The bus’s Spielmeister was a tall-fair-and-handsome man in his late 30s ... and a real piece of lumber when it came to telling tourists on a tour bus what they were looking at. He was so bad, I couldn’t resist striking up a conversation at the end of the tour.
"Sure enough, it turned out he had not been put on Earth for this job. He was an engineer who until recently had been a NASA heat-shield specialist. A baffling wave of layoffs had begun, and his job was eliminated. It was so bad he was lucky to have gotten this stand-up Spielmeister gig on a tour bus. Neil Armstrong and his two crew mates, Buzz Aldrin and Mike Collins, were still on their triumphal world tour ... while back home, NASA’s irreplaceable team of highly motivated space scientists — irreplaceable! — there were no others! ...anywhere! ... You couldn’t just run an ad saying, “Help Wanted: Experienced heat-shield expert” ... the irreplaceable team was breaking up, scattering in nobody knows how many hopeless directions."Several years ago I read an article that seriously questioned whether or not a project on the scale of Apollo was even possible today. It may well not be. It's an odd thing for someone from my generation to consider; that, for all sorts of reasons, the time and achievements of Apollo represent a high point, the very best, a peak of technology, will, project organization, and plain quality... Just memory, never to come again.
Tuesday, July 21, 2009
Toast
Image via Wikipedia
http://www.thetoasterproject.org/
"So are toasters ridiculous? It depends on the scale at which you look. Looking close up, a desire (for toast) and the fulfilment of that desire is totally reasonable. Perhaps the majority of human activity can be reduced to a desire to make life more comfortable for ourselves, and has thus far led to being able to buy a toaster for £3.99 [among other achievements]. But looking at toasters in relation to global industry, at a moment in time when the effects of our industry are no longer trivial compared to the insignificant when our, they seem unreasonable. I think our position is ambiguous - the scale of industry involved in making a toaster [etc.] is ridiculous but at the same time the chain of discoveries and small technological developments that occurred along the way make it entirely reasonable."
Monday, July 20, 2009
What Could Go Wrong?
The company explains: "Despite the far-reaching reports that this includes 'human bodies,' the public can be assured that the engine Cyclone has developed to power the EATR runs on fuel no scarier than twigs, grass clippings and wood chips."
...
Well quite. Cyclone CEO Harry Schoell further assures: “We completely understand the public’s concern about futuristic robots feeding on the human population, but that is not our mission."
Whew! That's a relief!
Jeff Sexton