about 1 year ago - No comments
Here’s the bug that had me working today (a Sukot holiday): _myMap.put(key.toLowerCase()) … _myMap.get(key) // without lower casing the key. At first you might think of this as a common human error, but I claim that it’s no less of a code smell: Why trust yourself to always remember to lower/upper case all of the…
about 1 year ago - No comments
I spent today at the IBM Programming Languages and Development Environments Seminar 2010, that took place at the beautiful Haifa Research lab mount Carmel campus. Things worth mentioning: Gilad Bracha, father of Java Generics and auto-boxing, spent 60 minutes repenting Sun’s Java 1.0 early design mistakes, such as allowing primitives and static members into the…
about 1 year ago - No comments
While running product sizing tests, we’ve found that an over enthusiastic usage of ConcurrentHashMap (CHM) had evaporated a good ~170MB of much needed heap space (we ran with a 1.5GB heap). As it turns out, a empty CHM weighs around 1700B. Yes, I’m talking about a map with no entries at all, just the plumbing!…
about 1 year ago - No comments
I ran into a ConcurrentModificationException (CME) during stress testing. What does CME actually mean? It means that you’ve modified (add, remove, update) your Collection while you’ve been iterating over it (usually in a multi-threaded fashion, but it can occur in a single thread that modifies while iterating). A few more things to note about CME:…
about 2 years ago - 7 comments
Java is becoming quite old (version 1.0 came out in 1996 if I’m not mistaken). When something turns old, legends, myths, and other perceived truths are quick to form around it (just imagine an old Gothic mansion with its stack of scare tales). Most of the accumulated knowledge is beneficial and helpful, but some of…
about 2 years ago - No comments
Here’s a post I wrote (in the Hebrew language) which tells the story of the log summarizer utility that I’ve wrote. This story is the first in a line of “utilities stories” I’m planning on writing. My apologies for those of you whom won’t be able to read it. Posts in this site do appear…
about 2 years ago - 2 comments
Avi Ribchinsky, a friend and a college of mien, is transitioning from C++ to the Java world. He had been playing with Thread.sleep(), when he noticed that the sleep method might oversleep more than ordered, and moreover, it could also under sleep (see Fig 1). Coming from the C++ world, that surely caught him surprised…
about 2 years ago - 4 comments
Getting it right the first time What happens when customers are experiencing problems with you application in production? The customer would send you the various logs artifacts and, ideally, you should be able to diagnose the problem and provide a resolution. If you find yourself sending the customer back and forth in an effort to…
about 2 years ago - 6 comments
Disclaimer: Now I know that this is an old idiom, I’m just presenting my own real life incident taken straight away from the bloody Java trenches. Exceptions can be threads assassins when running on top of Websphere thread pool, any Runtime exception that isn’t caught by the applicative code, will bubble up in the stack,…
about 3 years ago - No comments
Say you wanna keep in memory a list of martial arts experts and their respective shoe size. One way to implement it would be to populate a Map structure with the following sets of key and value: Map map = … map.put(“Jean-Claude Van Damme”, new Byte(45)); map.put(“Jet Li”, new Byte(45)); map.put(“Chuck Norris”, new Byte(112)); ……