Archive for the 'Java' Category

Jul '06
Mocking context lookups
by Frank Spychalski filed under Java, Work

Sorry for another non-ruby post, but I’m currently very busy at work playing with JBoss 4, EJB 3, EasyMock, and a bunch of other pretty cool technologies.

I’m a big fan of EasyMock but frequently I ran into problems when code performed lookups to get resources like:

Context ctx = new InitialContext();
UserTransaction trans = (UserTransaction) ctx.lookup("UserTransaction");

Read the rest of this entry »

Jul '06
Getting rid of Hypersonic Db in Jboss 4
by Frank Spychalski filed under articles, Java, Work

I don’t know how much time I could have saved, if someone told me I should not use the hypersonic database for a production JBoss system.
hsqldb is not a production quality database.

Read the rest of this entry »

Jun '06
Java 6 (aka Mustang) goes Ruby
by Frank Spychalski filed under Computer, Java, Ruby

Some time ago Martin Fowler wrote about Humane Interfaces which led to an lively debate. This is really old stuff, but yesterday I read about the upcoming Java 6 aka Mustang and one of the changes was adding the isEmpty() method to String.

So it seems like Java is slowly getting more humane :-)

Apr '06
Errorhandling Ruby vs. Java
by Frank Spychalski filed under articles, Computer, Java, Rants, Ruby

At my daytime job I had to rewrite a class which sends a Message to a Queue. Sounds simple? With EJB3 it is reasonably simple and can be done in around 10 lines of code involving lots of lookups. But if you are looking for a reliable solution which works even when the application server reboots every once in a while your code gets messy. My current solution has 120 lines of code and there are still some things to add like buffering of unsent messages. Read the rest of this entry »

Mar '06
Eclipse vs. Idea
by schlumpf filed under Computer, Java, Rants, Work

I just read this blog entry about switching from Eclipse to Idea, and I fully agree with the author. Read the rest of this entry »

Dec '05
Java Tuning Whitepaper
by Frank Spychalski filed under Java, Work

Sun provides a Java Tuning White Paper which provides an overview over VM settings beyond the well known -Xmx, -Xms and -server.

Additionally, the document contains a lot of useful pointers for further reading.

Aug '05
Useful classes?
by Frank Spychalski filed under Java, Work

My article about Proxy and InvocationHandle made me think about other useful classes. I don’t know how long it took me to realize how much useful stuff can be found in Collections.

Are there other classes out there (I’m not talking about yet another cool third party jar but about foundation classes) that I haven’t found yet?

Aug '05
Weave in an aspect via Proxy
by Frank Spychalski filed under articles, Java, Work

This article shows how to use AOP with nothing but java – No code generation or bytecode manipulation.

Sample Scenario:
You want to insert logging statements for every call to every method of a certain class. This sounds like the default example used to promote AOP, but there is an easier solution if you know about java.lang.reflect.Proxy and java.lang.reflect.InvocationHandler. Read the rest of this entry »

Mar '05
Ant macrodef
by Frank Spychalski filed under articles, Java, Work

Finally Ant 1.6. supports a macrodef target. This article provides a not so short example to see macrodefs in action. Read the rest of this entry »

Feb '05
Jetif, jet another Java testing framework
by Frank Spychalski filed under Java, Work

At TheServerSide there’s a short note about Jetif. As far as I can tell it’s jet another testing framework. It tries to solve the problem of redundant code when testing a method call for multiple values, but I couldn’t find support for anything beyond simple types and arrays. So when my method returns one of my own objects it’s no use. So nice idea, but not enough for me to switch from JUnit…

edited 28.2.05
I was wrong. Now that Vicky mentioned it, I found a paragraph at the bottom of the comparison page saying just that. Still the bonus is not enough to change my existing code, but I’m sure I’ll soon have to write some new tests, where I can give it a try. During the discussion at Vicky mentioned something about a eclipse plugin which will raise my chances of actually using it greatly. Unfortunatly, no info about when it will be available…