It so happens that in a few of the apps I work on here in Netflix we use Jersey libraries inside a Tomcat container. As such I use the JSR annotations a lot safe in the knowledge that Jersey will take care of all the plumbing work and deal with routing and serialization/deserialization so I […]
Posts Tagged: multithreading
RxJava: Some Usage of Observable.zip
Here’s classic problem when dealing with a web app: you get a HTTP request to your app with a set of parameters. You need to hit a datastore to retrieve some record based on those parameters. You also need to create a (log?) entry somewhere about receiving this call — whether it’s for monitoring purposes […]
Do We Still Need the Singleton Pattern?
If you have been working in software engineering for a while chances are you have often come across (even if you didn’t know it!) design patterns. If you haven’t, as I said, chances are you just don’t realise you have used them — so I strongly suggest the “Gang of Four” book as a starting […]
Java 8 Accumulators and Adders
If you’ve been using Java for a while now, then like me, you must have saluted the move quite a while back in JDK 1.5 to introduce the atomic classes (AtomicLong, AtomicBoolean and so on). They were a big step forward, away from the clunkyness of having to create ridiculous bottlenecks in the code for […]
About the Play! Framework and Their Thread Pooling
This is a rather interesting find and I’m still looking into it — so hopefully will come back with more insights on it — but I thought I’d publish these things as I find them. So bear with me as I unravel this mistery — as of right now, unless I’m looking in the wrong […]
Playing Around with Buffers
I found myself recently using the Buffer class in the Apache Commons Collections framework — and realised that the Buffer-related classes don’t get enough coverage as they probably should, since they can actually provide out-of-the-box solutions to common development problems. So I started this little exercise partly to demonstrate some of the powerful Buffer-based classes […]
SimpleDateFormat and Multiple Threads
I felt like I had to write this to spread the word a bit more about this little-known danger of one of the JDK classes: SimpleDateFormat. Used quite widely from what I can tell — who hasn’t written something like this: SimpleDateFormat df = new SimpleDateFormat(); df.format( new Date() );SimpleDateFormat df = new SimpleDateFormat(); df.format( […]
Thread Pools in Java
On the subject of Java code optimisation: I’m sure we’re all familiar with the concept of thread pooling — typically used together with the Executor framework. Configuring your thread pools can be tricky: choose a small value and you’re not making usage of your server power, on the other hand, choose a value large enough […]