My reference book on Java concurrency is Doug Lea's Concurrent Programming in Java: Design Principles and Patterns. He is one of the authors of this new book, Java Concurrency In Practice. There is also Joshua Bloch, author of Effective Java, that many people love (but I am less a fan of it, even if I would recommend it to Java newbies), and author of Java Puzzlers, that I found more fun.
With such authors, I had relatively high expectations. I was surprised that there is not much material in common between Doug Lea's book and this one, which is a good thing. It's a different presentation, that focuses on different problems.
There is some very interesting material, I especially enjoyed chapter 16 on the Java Memory Model. There are not many books with information on it. I did not know that initializing a final member in the constructor was providing thread safety for the accessor method of the corresponding field if there is no other modifying method, no synchronization needed. And not having the member declared as final was breaking the safety.
I also had not heard of Amdahl's law before. It seems quite intuitive, but then the example in the book about processing parallel tasks using a synchronized LinkedList (improvement up to 3 threads, no more later due to time spent on synchronization) shows that the reality is not that intuitive.
I enjoyed how the book is written, and how information is presented. There is for example their concept of publication and escape (in chapter 3) which tells you important things, like not starting a Thread in a constructor (and if you still want to do it they present a nice way to do it).
I think this book is a simpler read that Doug Lea original book, and probably a better introduction (that still goes very deep) to Java concurrency programming.
Wednesday, February 14, 2007
Wednesday, February 07, 2007
I am currently quite busy learning about Websphere Commerce. I was surprised to notice that they still use Entity EJBs 1.1. My experience was that many companies turned away from Entity EJBs, sometimes from the beginning, preferring TopLink or Hibernate (later).
I know that Entity EJBs are more heavy to use than Hibernate, but with the proper tooling support, it's not really a big issue. Are there more fundamental reasons? There are probably some mapping limitations, but IBM implementation is apparently quite good in term of features.
I will write a complete post about my own analysis of EJB 1.1 vs IBM EJB 1.1 vs EJB 3.0 vs Hibernate, but I was wondering first what was your feedback on EJB 1.1.