Description
Replace this line https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/hl7/HL7InQueueProcessor.java#L102
with: synchronized (lock) {
where lock is declared at the class level as:
private static final Object lock = new Object();
Background Information:
Objects which are pooled and potentially reused should not be used for synchronization. If they are, it can cause unrelated threads to deadlock with unhelpful stacktraces. Specifically, String literals, and boxed primitives such as Integers should not be used as lock objects because they are pooled and reused. The story is even worse for Boolean objects, because there are only two instances of Boolean, Boolean.TRUE and Boolean.FALSE and every class that uses a Boolean will be referring to one of the two.