June, 2008


15
Jun 08

Running out of filehandles the easy way – Java

Java has finalizer methods. These are blocks of code that run on certain times, but you usually don’t know when. When the planets are aligned you can do some finalization. You usually avoid these or should try to avoid them.

Luckily Java will sometimes use finalizers without telling. An innocent piece of code that opens a connection to an URL and checks for the last modification date (getLastModified()) will open a java.io.FileInputStream and close it only in the finalizer, i.e. exactly when the planets are aligned.

I stumbled upon this while debugging JavaRebel and trying to figure out why JBoss needed couple of thousand filehandles when no applications were deployed. A deployment scanner checking all of the files every few seconds will do the trick:)


10
Jun 08

Yet Another Java Trick, Revisited

Interestingly enough I rewrote by now both places in code that I did according to the Yet Another Java Trick. It’s a neat trick, which may come back to me in some other context, but it definitely isn’t as useful as I thought for logging result.


8
Jun 08

TheServerSide Java Symposium Europe

Lately there has not been much time to post as we are working on a lot of stuff before the summer vacation. We are exhibiting again at TSSJS: Europe and this time I am going with Juhan Aasaru, who is also the guy working with me on typesafe DSLs, specially the SQL one, which we’ll announce soon.

This time besides the booth I’ll also be giving two talks that you are welcome to attend if you’re in Prague. One of them is Zero Turnaround in Java Development, which will be more of a panel with Geert Bevin (the guy behind RIFE and continuations in Java) and Guillaume LaForge (Groovy main guy); should be loads of fun. The other talk is Typesafe Embedded Java DSLs and is based on the research article we wrote recently; this one may be less fun, but I’ll cover lot of interesting stuff we came up with.

Hopefully some of you reading this blog are also coming to Prague. If that’s the case let us know in the comments and we can taste the famous Czech beer together :)