Sunday, June 22, 2014

Simple in-memory caching with Spring 3.2 and Google Guava

    There was a proposal (not really original :)) that we can use cache to relieve external system and make our own system faster. It should be a really simple in-memory cache without any replication and fancy mechanisms. It should only have max-number-of-elements and expiration-time-after-write properties. Can that requirement be implemented in Spring easily?

Thursday, June 12, 2014

A gentle touch of functional programming with Java 8 - prime numbers

    'Functional programming' are buzz words nowadays. Let's try to play a little bit with that. The only assumption of this post is... to have some fun :).

Saturday, May 31, 2014

Multiple SOAP headers in Apache Camel's Spring WS endpoint

    Life is all about abstraction. When you read this article you do not think about electrical impulses which travel through your brain between synapses. When you drive a car you do not need to know the internal details on how it works. By no doubt abstraction is good. But is it always that good?

Tuesday, May 6, 2014

Liquibase and PL/SQL with Oracle DB

If you have ever dreamed about Continuous Delivery (CD) you surely thought about deployment which is fully automated. It implies automated management of database scripts. With the help provided by Liquibase it is easy to add some automation to database change sets deployment. However, there is a small downside in Liquibase implementation that makes it a little bit trickier to execute PL/SQL pieces.

Tuesday, February 25, 2014

NoSuchMethodError and binary compatibility

    Some time ago I received NoSuchMethodError when I was dealing with multiple versions of the same library. I decided to dig into mentioned error's root cause.

Sunday, February 2, 2014

Memory leak detection in a real world application

    Some time ago I was performing a soak test of the application in order to minimize the possibility of problems after final production deployment. I discovered some interesting facts.

Friday, December 27, 2013

Design patterns in validation

    Validation is a pretty common business requirement. We need to be sure that the input data is valid and remember that: junk in -> junk out. Let's say that we want to validate a request object. The easiest way is to produce a big chunk of IF statements. Do you like that IF ... IF ... IF ... blocks one after another? I hate them. So how to deal with validation?

Saturday, December 7, 2013

Are connectTimeout and readTimeout enough for a good night's sleep?

    When it comes to communication with external resources we need to be sure that reasonable timeouts were set. Network is like a black hole - we send a request and many bad things can happen. Without timeouts our thread pool can saturate because of threads stuck deep inside socket read method. It is usual to set connect timeout and read timeout. But is it enough? Can we have a good night's sleep when connect and read timeouts are set in our application? Let's check!

Monday, November 25, 2013

Oracle's XMLTYPE with Hibernate 4

    XML is quite popular nowadays. You can store XML as a VARCHAR type in a DB. However, it has some limitations, e.g. you cannot perform XPath DB queries on a VARCHAR. Oracle DB comes with XML dedicated type - XMLTYPE that allows to perform XPath queries, has XML validation logic built-in and some storage optimizations. On the contrary, Hibernate does not support XMLTYPE out of the box. We need to define our custom UserType.

Tuesday, November 5, 2013

Robust DB connection pool configuration

    Martin Fowler claims: 'Any fool can write code that a computer can understand. Good programmers write code that humans can understand'. I would add: 'Any fool can write code that survives a happy path'. Some time ago I posted a data source configuration for H2 DB. Was the configuration really robust?