Win a copy of Rust Web Development this week in the Other Languages forum!

Marco Antonio

Ranch Hand
+ Follow
since Apr 23, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marco Antonio


I'm going to start to prepare the 1Z0-813 exam (from SCJP5) and I don't know if it is a worthwhile effort use a guide for the OCPJP 8 Exam II for this goal. What do you thing about it?

Related with what Henry has just mention, I have carried out more than 250 tests (sending/receiving pair of messages) with the explained situation and I have always obtained a successful result. This behaviour is only happening in the client environment

Actually it is an assumption because the bean is instanced by Spring, and it is configured by default in this sense. Anyway, I'm going to test that both threads are running in the same instance logging both the bean and the thread identity hashes.
Thanks Henry for your answer.

No, I cannot confirm that the lock in both threads is the same. I assume that the lock is the same because it is defined in a singleton (instanced by Spring), but I haven't checked if it really is. I'm going to carry out what you have suggest to me, but I'm going to spend some time, because the described behaviour is taking place in the client environment, and I need to generate the patch and send it to be deployed. As soon as I'm informed the result of that test, I'll share it here.

By the way, why are you considering that the lock couldn't be the same? What can be provoking that behaviour?

Thank you so much!!!
First of all, thank you for your answer.

The issue is that the second message has a dependency from the first one, that is why we need process them in the correct order. As you can note, there is an ERROR entry in the log, provoked by the second message because it has been processed before the first one has been successfully finished. That is why I'm sure the log entries with the threads ids are correct. And, yes, we have just defined one lock, the one which is shown in the code in my previous post.

How is possible that the second thread acquires the lock when it is actually acquired? Could it be some WebLogic misunderstood behaviour with threads pool?

Hello, everybody.

Our application, running in a WebLogic 12c, is retrieving messages from a queuing system, where the queue we are retrieving messages from is configured as a FIFO. We are using Spring to configure the retrieval functionality and both the container (org.springframework.jms.listener.DefaultMessageListenerContainer) and the messages listener ( are singletons. Furthermore, that container has configured a WorkManager by default as task executor. To guarantee that the messages are processed in the expected order (the order how they are sent to the queue), we use a ReentrantLock in the listener, and we were expecting that messages were retrieved and processed one by one. The listener code is the following one:

Even though two messages are placed on the queue in the correct order, and they are consumed in that order (recall that the queue is a FIFO one), somehow the two message are processed in parallel by the application as it is shown in the following log chunk:

Lock has been acquired by thread: 28
Backout count: 1
Message 1 / 1 received from XXX
Message ID1 received.
Lock has been acquired by thread: 54
Backout count: 1
Message 1 / 1 received from XXX
Message ID2 received.
***** ERROR *****
Lock is going to be released by thread: 54
Lock is going to be released by thread: 28

Why are we obtaining this behaviour? Any idea?

Thank you so much in advanced.
Thank you so much both of you!

To Junilu: That's true! I always forget that there are available chapters in Amazon. Thank you for your friendly reminder.

To Chris: That sounds awesome! That is what I was worried about. I'm working with legacy code and I want to carry out my job not only applying the boy scout rule or making little refactorings, I want to do a better and deeper work and your book looks like a great approach to it.

Thank you again and regards.
Hi Chris and the rest of this community.

What can we expect in this book that are not covered in other ones like "Refactoring" by Martin Fowler and/or "Working effectively with legacy code" by Michael Feathers? Is it about going beyond refactoring? Is this the reason of the use of the term re-engineering?

Thank you so much in advance.
Thank you both!!!

Really interesting aproach. I'm going to try it.

Thank you again!
8 years ago
Hi everybody and specially to John.

My question is about how apply BDD when you are working with legacy code. Is it recommended? How should I apply BDD in this case?

Thank you so much!
8 years ago
Welcome John and thank you for sparing your time with us!
8 years ago
Welcome, Lasse, and thank you for sparing your time with us.
8 years ago
Thank you Chris.

I am going to follow all your pieces of advice.

8 years ago

First of all, thank you so much! That has been what people calls a complete answer ;-)

About the Coursera course Functional Programming Principles in Scala, I signed up for it several days ago and, in accord with what you say about the course, I took the correct decision. I think I'll spend my time learning Scala before deal with Clojure. The course will give me the necessary background to understand that language.

About Jython, I'm taking part in the A Gentle Introduction to Python course, and it would be a natural step for me. In this way, I could practice the acquired knowledge over the JVM.

Groovy is one item in my TO-DO list, but always I have found another thing that has caught my eye, but your recommendation for the The Well-Grounded Java Developer and what this book offers (as TDD), have convinced me to give a chance to it.

Thank you so much. It has been an absolutely pleasure to read you answer. You have shed light on my dudes.

8 years ago
Hi everybody!

I'm a Java developer and I want to start to learn another languages to the JVM. Why should I choose Scale instead of Groovy, Clojure or Jython? What can Scala provide me that other languages to the JVM cannot do? Is the Scala syntax difficult to learn? Is it very different from the Java one?

I know that they are a lot of questions but I want to use my little free time in something which can be useful for me.

Thank you so much in advance!
8 years ago