I have a Java application and I am using Spring Framework.
Using beans I define a queue with its size set to a maximum of 5 elements like below:
<bean id="Queue1" class="java.util.concurrent.PriorityBlockingQueue">
Then I pass it to the constructor in Java using injection and I initialize it within the constructor. In Java I have defined and done below:
private final BlockingQueue<OrdenTrabajo> queue;
this.queue = queue
Later, when I try to get queue size in code using:
it returns 0 instead of 5. Why?
Also, is there any possibility to obtain the number of elements that are currently in the queue?