Definition of Scalability

"Scalability describes the ability to improve throughput or capacity when additional computing resources (such as additional CPU's, memory, storage, or I/O bandwidth) are added." Java Concurrency in Practice Read more

Web Project’s “lib” Folder Cleanup

If your Maven-built Web project has a large number of dependencies or depends on projects whose version number is updated frequently, you may want to cleanup its .../WEB-INF/lib directory. After dabbling quite a bit with bat/bash scripts and some maven plugins I found out that an additional cleanup directory can be included to the Maven Clean Plugin. Below is the pom.xml excerpt to instruct maven-clean-plugin to delete all .jar files under the project's .../WEB-INF/lib directory. Read more

Puzzled? Try another Data Structure*!

You know those times when you find yourself from mildly to totally perplexed with the complexity of your own creation? Have you ever gotten a feeling that some more engineering would make your code much simpler, professional, and easier to maintain --- and that same engineering is something you ignore? The number of data structures a developer knows and the level of intimacy with each of them substantially impacts her or his ability to tackle problems. No matter the programming language, the ... Read more

Speeding up JBoss 6 Deployments in Development Environment

For several I was convinced that the application deployment process implemented by WebSphere was the worst-performing in the world. Well, that happened until I met JBoss AS 6.  In order to properly deploy an application JBoss simply explodes all of its JARs into a temporary folder, “$JBOSS_HOME/server/<server>/tmp”.  This is a known JBoss bug, more details can be found here: Depending on the footprint of your application tens of JAR files will be unpacked into the aforementioned folder every time you deploy ... Read more

Search and Replace

Sometimes you just need to search all files in a folder and replace everything that matches to a regular expression. Here is a program that does this trick. Of course you need to update the regular expression and other constants with values that meet your requirements. ATTENTION: This program can (depending on the values you assign to the constants) screw up any/all of your files, so make yourself a favor before running it: backup the files under the target folder. Read more

Any Language Anywhere

I was reading my SCJP Study Guide (PDF format, on my iPhone) while waiting for my turn at a barber shop. As I was going through one of the sections I fell into a tricky question -- all of a sudden found myself craving for a Java compiler. Just Googled "online java compiler" and found a wonderful resource called Ideone, it allows you to write, compile, debug and run your code online. Besides Java it also supports a multitude of languages (vide ... Read more

Falling Through

A real-life example of a switch statement with fall-through cases. [geolocation] Read more

How Evolution Harms a Programming Language

Java is a lovely programming language, but after its biggest evolutionary step (from 1.4 to 1.5) some awkward things started occurring, since the new compiler should be backwards compatible. Java programmers must recall about some backwards compatibility aspects in order to understand why the Java compiler acts in a somewhat strange way at times. Method overloading, for example, became pretty tricky. Guess what's the result for the program below... Result: double (What the heck? Hã? Co to jest? Что это? ¿Qué es esto?) Explanation: ... Read more

Avoiding StaleConnectionException on WebSphere Application Server

StaleConnectionException is one of the most popular issues that occur when one implements an application that employs JDBC to connect to a database through WAS' connection pool. Depending on the container's connection pool settings, it keeps stale (no longer usable due to database failure) connections. Therefore when your application gets a new connection and tries to use it, it will fail. As recommended by IBM, I have implemented several approaches to detect stale connections, and retry. Although OK, the retry approach is ... Read more

Transaction Management Using Spring

In order to effectively design and implement software that handles transactions using Spring, knowledge on the concepts below is vital: Isolation: the degree of isolation this transaction has from the work of other transactions. For example, can this transaction see uncommitted writes from other transactions? Propagation: normally all code executed within a transaction scope will run in that transaction. However, there are several options specifying behavior if a transactional method is executed when a transaction context already exists: for example, simply continue running ... Read more