Java synchronized method concurrent execution

I read this puzzle years ago (unfortunately I can't find the reference) but didn't appreciate it at the time. Java synchronized methods [1] can supposedly be invoked only by a single thread at a time. The essence of aforementioned puzzle was that, if the synchronized method obtains a lock on the object the method belongs … Continue reading Java synchronized method concurrent execution

End-to-end testing Java web applications with an embedded Tomcat

 In this instalment on assembly testing [1] I'll talk about how automated system tests run over my Java web applications. The set-up is rather cheap, not very labour-intensive and can incrementally evolve from a simple assembly test (aka smoke test) to a full-fledged system test. Since this post is rather concrete naming tools and frameworks, … Continue reading End-to-end testing Java web applications with an embedded Tomcat

SSLHandshakeException: unsupported certificate

When: loading client certificates from a custom keystore Reason: multiple certificates for the same domain but different purposes, e.g. one certificate handles email authentication, the other authenticates the user against a web server Solution: either fix the buggy code that selects the wrong certificate from the keystore or make sure only one certificate per domain … Continue reading SSLHandshakeException: unsupported certificate

Spring MVC REST controller says 406 when emails are part URL path

You've got this Spring @RestController and mapped a URL that contains an email as part of the URL path. You cunningly worked around the dot truncation issue [1] and you are ready to roll. And suddenly, on some URLs, Spring will return a 406 [2] which says that the browser requested a certain content type … Continue reading Spring MVC REST controller says 406 when emails are part URL path

Fauxjsp: productive JSP development

Important note: This post is not being updated. For up-to-date information refer to the project repository: https://github.com/ggeorgovassilis/fauxjsp/ About JSP In this post I'll present a new open source project I'm currently working on, fauxjsp [1] which re-implements JSP in a way that is more robust and faster for developers. It is intended for development, where … Continue reading Fauxjsp: productive JSP development

Reactive programming for Java, revisited

Abstract Rewritten on 15 January 2015 In this post I'll talk about the problems callbacks introduce into the readability of asynchronous Java programs. I'll also discuss an implementation of method pointers for Java which aids the transformation of a callback-style program into a linear program flow, greatly increasing readability while still being a 100% asynchronous … Continue reading Reactive programming for Java, revisited

Tomcat/Scala: invalid byte tag in constant pool: 110

When deploying a Scala application on Tomcat 7 I got this weird error: invalid byte tag in constant pool: 110 from Tomcat's annotation scanning in the scala utils jar. There is this bug report that claims it's fixed, but it seems to still happen wit 7.0.53. Since the application doesn't rely on Tomcat's annotation scanning, … Continue reading Tomcat/Scala: invalid byte tag in constant pool: 110

On JPA identifiers and business keys (or why business keys are a bad idea)

JPA, and for that matter Hibernate, depends on identifying entity instances (I'll refer to them as entities for short) by some key. That key can either be a single property (like a numeric ID column in the corresponding table) or a business key (also referred to as natural key). Business keys are entity properties which … Continue reading On JPA identifiers and business keys (or why business keys are a bad idea)

On coarse- vs. fine-grained synchronization

Performance related topics seem to constantly attract attention and everyone seems to have strong opinions on the matter. Writing code that can be proved [1] to perform according to a certain pattern is probably not the worst place to start with, although the web is full of counterintuitive [2] examples [3] where hardware details weigh … Continue reading On coarse- vs. fine-grained synchronization