GlassFish, Open MQ, and the Ear-Eye Problem
Yesterday I’ve been updating code examples for the messaging chapter for
the 2nd edition of my Java book. While doing this, I ran into an issue, then
fixed it, but the cause and the solution illustrate the situation that we
call “Ear-Eye”, which comes from and old joke popular in the USSR, where
TV propaganda was stating that everything is great while people had hard time
finding food in store. Here’s the joke:
An old lady comes to a medical center saying that she needs to see an Ear-Eye
specialist. The receptionist replied, “There is no such specialization in
medicine. Why would you need such a doctor?” The old lady answered, “What
I hear on the radio, I don’t see in the real life.”
In programming, we have similar situations quite often – you look at the
code everything looks perfect, but it doesn’t work no matter how long... (more)
Here’s is a quote from the About page of the Web site ehow.com: “eHow
is your one-stop online resource for life’s challenges.
Professionals in every field come together to offer expert advice, backed by
the additional support of a can-do eHow community.“
Experts are also human beings and sometimes they make mistakes too. But when
I’ve read the following article I was stunned:
Guys and girls, I’m not an eHow-grade expert, but I’ve been doing both
Java and JavaScript for while. Trust me, the above description is absolutely
wrong! Please ignore. Also, if you know any of the 35 peop... (more)
Probably the most popular question during Java technical interviews is
“What’s the difference between abstract classes and interfaces”. In
my own three year old book I’ve offered the following answer:
“An abstract class may contain code in method bodies, which is not allowed
in an interface.With abstract classes you have to inherit your class from the
abstract one because Java does not allow multiple inheritance. On the other
hand, you can implement multiple interfaces in your class.”
But starting from Java 8 this answer is wrong. This is how I’d answered it
now:
“Both abstract... (more)
Some time ago I blogged that Java Swing should be deprecated and replaced
with JavaFX. In this blog I’ll show a piece of JavaFX namely event handlers
and binding. I’ve created a simple Sign In window with a GridPane layout
(it’s JavaFX equivalent of Swing’s GridBagLayout). I’m not going to
spend much time on the GridPane itself, but will show you a basic event
handling and a binding.
In JavaFX an event object is represented by the instance of the class
javafx.event.Event. There are different ways of handling events. Depending on
how you structured your application you can handle... (more)
While working on the second edition for my Java 24-hour Trainer book I’m
re-writing some of the code samples to use lambda expressions. Today I was
re-writing an example for wait/notify for the chapter on multi-threading.
Beside illustrating the wait/notify, I used a closure in this example. Since
Java closures are not well presented in the blogosphere, I decided to write a
quick blog on the subject.
My goal was to write a program that starts a thread and waits for the
notification from that thread until its execution is completed. When the main
thread receives the notification ... (more)