Category Archives: Java

Java 101: building your java classpath from a lib folder

OK – I admit it – my IDE and tools make me weak in many ways.  I was just having the hardest time getting my maven-managed project to run from a basic “java my.class.ClassName” command line invocation.  Why?  Because the freaking classpath is a million miles away from being a concern to me anymore.  So, [...]

A Conventionally Annotated Configuration – Spring, Hibernate, Eclipse

I’m starting on a personal project and decided I was going to take the time to do things right.  This means different things to different folks, but to me it basically entails: Using the latest and greatest versions of everything.  Eclipse 3.4.  Hibernate 3.3.1.  Spring 2.5.6.  Tomcat 6.  Maven 2.0.9.  Java 6 ( 7? ), [...]

ArrayList vs Vector

I’ve done some more work on the ArrayList vs Vector performance issue.  The post below originally stated that Vector would/could outperform ArrayList even though it is synchronized while ArrayList is not.  Well, in digging deeper into the issue, I”ve determined that there is a problem with the benchmarking framework being used.  I ran a very [...]

The cost of Autoboxing

Simple question: How expensive is autoboxing of int/Integer types? Simple answer: 15 nanoseconds per boxing. No autoboxing ( ints only ) [source:java] public void runInternalTrial() throws Exception { int i = getRandomWithoutAutobox(); } public int getRandomWithoutAutobox() { return rnd.nextInt(1000); } [/source] Autoboxing [source:java] public void runInternalTrial() throws Exception { int i = getRandom(); } // [...]

JVM Comparison and Java Optimization Myths

Here’s a fairly comprehensive overview of 6 performance related myths as they relate to 7 different JVMs.  I now feel safer running with try/catch blocks and with synchronization.  We’ll be running our own benchmarks on these and the results will be up pretty soon.  Here’s the link to the paper.

JBoss Seam Presentation

Seam is a must learn technology – check it out. clipped from www.theserverside.com In this presentation, recorded at the recent Grails Exchange event in London, organized by Skills Matter, Christian Bauer discusses how JBoss Seam simplifies the handling of stateful conversations, multi-window operations and concurrent, fine-grained Ajax requests. He also shows how Seam unifies and [...]

Using Patterns to Suppliment your Spring Configuration

Your Spring configuration probably consists of one or more well know XML files which are loaded by name. Have you ever wanted to override something without having to touch your base configuration? Here’s what we do. After we load our base configuration we use a pattern to load any XML files which exist in a [...]

Integrating Google Earth with a Java webapp

I did this at work the other day and thought I’d give the broad sweeping overview here should else want to do it. It’s not too bad after all’s said and done ( and sifted through… ). Here’s the quick and easy: 1) Add these mimetypes in web.xml: application/vnd.google-earth.kml+xml kml application/vnd.google-earth.kmz kmz 2) You’ll want [...]

C3P0 ConnectionPool Configuration Rules of Thumb

C3P0 is a fantastic open source ConnectionPool that is feature rich, stable, and positively production ready. I personally like it more than DBCP because there is too much blocking encountered when checking in/out connections with DBCP. C3P0 dodges that problem with an asynchronous return to the pool, but you might end up using a lot [...]