Synchronized code in distributed systems
I encountered some code recently where a GUI client was listening for Object updates from a multi-threaded server, and it was using the version number on the Object to determine whether the incoming Object was the latest version. The server incremented the version of the Object by inserting a new row into a table in [...]
Reflection HashCodeBuilder Performance
I recently embarked upon a performance investigation to figure out why a particular operation was slow. My theory was that it was the serialization/deserialization cost with a set of large objects; my colleague’s theory was the iteration over the set. We were both wrong. The investigation became intriguing when we started measuring the elapsed time [...]
A new assignment
My ex-project and I had been together for ten months. We had our fair share ups and downs, particularly in the early days, but over the last few months we had settled into a nice routine. It wasn’t particularly exciting any more but at least it was predictable. And then yesterday I was asked to [...]
How to insulate yourself from static methods
Sometimes your code needs to call a static method in a 3rd party library and unit testing suddenly becomes difficult, particularly when that static method requires context in order to work. Enter the insulating class (also known as a Facade). Create a new interface that declares a method with the same signature as the static method [...]
Two Eclipse Icons in Windows 7 taskbar
I had an annoying problem on Windows 7 x64 with Helios x64 where I had pinned Eclipse to the taskbar but would see two icons whenever Eclipse was running. I found that the following workaround works with the option “Always combine, hide labels” for taskbar buttons. Check your “eclipse.ini” in your Eclipse directory for the [...]