A better eq() when matching method arguments with Mockito

I learned late of Mockito [1], even so more I love it. Walking a little farther away from the basics, a frequent needs presents itself to match method parameters (either when specifying or verifying behaviour) based on properties of complex objects which do not implement the java equals contract. Such an example would be verifying … Continue reading A better eq() when matching method arguments with Mockito

Spring @PathVariable mapping incomplete path when dots are included

In all my projects this happens at least once, and I'm surprised over and over again: a controller will not map just anything to @PathVariable by default. Contrary to intuition, the annotation's argument is a regular expression which excludes some characters per default. For instance the url http://localhost:8080/myapp/api/user/testuser@example when mapped to a controller: @RequestMapping(value = … Continue reading Spring @PathVariable mapping incomplete path when dots are included

Cache collision and ehcache spring annotations module

If you are looking for a way to implement declarative caching with Spring, there is no way around Ehcache Spring Annotations [1]. This superimposes a transparent aspect on methods of any proxied bean, taking the method arguments as a key. Little known but easy to stumble upon [2] is an implementation (design?) quirk which expects … Continue reading Cache collision and ehcache spring annotations module

New open source project: Product Catalogue Engine

Together with some colleagues from Technopolis we recently started PCE, an open source project for managing products and business rules. Why PCE? The need for a framework like PCE stems from the recurring task of having to manage, persist, retrieve and display products (or for that matter entities that can be viewed as products) of … Continue reading New open source project: Product Catalogue Engine

Non-blocking JDBC with the Asynchonous Mysql connector

Event driven application architecture If you've been following Hackernews or my favorite, the Highscalability blog, you can't have missed the trend towards event driven server applications which are inherently different from the request-per-thread based design of traditional web applications. Event driven applications evolve around asynchronous, non-blocking APIs and use few threads, typically around the number … Continue reading Non-blocking JDBC with the Asynchonous Mysql connector

Annotations, Java compiler and missing debugging information

So I play with my favorite ant build script and a day later nearly every annotation is broken: java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either. as far as the eye goes. What actually happened is that the new deployment skips debugging information … Continue reading Annotations, Java compiler and missing debugging information

Non-Latin characters, openID and the openid4java library

The openid4java [1] library is a very handy set of components that handles openid and oauth for java applications and definitely worth a look before you capitulate in frustration before all that modern openid stuff. For those of us living and working outside the 7bit-speaking ANSI niche there is one webserver setting to verify: the … Continue reading Non-Latin characters, openID and the openid4java library

ID trouble with multiple Hibernate entities on the same table

Just a while ago I ran into a case where Hibernate would auto generate a wrong database schema when two entities were mapped on the same table. The good news: it's my fault and not a bug. The better news: here's an account of how to avoid it. Let's assume a mutable entity A mapped … Continue reading ID trouble with multiple Hibernate entities on the same table

A counterintuitive relation between CPU and memory usage

Continuing my tests on low-end server environments, I recently set up a stress test of a load balanced tomcat webapp. Part of that tests consist in reducing the available memory for the webapp (JVM -Xmx switch) and see how low it could go before negatively affecting performance. It's common knowledge that once available memory runs … Continue reading A counterintuitive relation between CPU and memory usage