Code example for ConcurrentLinkedQueue

0
import javax.jms.JMSException; 
import javax.jms.Session; 
import javax.jms.TextMessage; 
 
public class MultithreadedDuplicationAndLossTest extends MultiThreadedTest { 
    final ConcurrentLinkedQueue<Long> sentMessages = new ConcurrentLinkedQueue<Long>();
    final ConcurrentLinkedQueue<Long> receivedMessage = new ConcurrentLinkedQueue<Long>();
 
    @Override 
    protected TextMessage createMessage(int threadIndex, int i, Session session, int globalMsgIndex)
            throws JMSException { 
        sentMessages.add((long) globalMsgIndex);
        return session.createTextMessage(String.valueOf(globalMsgIndex));
    } 
 
    @Override 
    protected void postProcessesReceivedMessage(int threadIndex, int i, TextMessage message, int globalMsgReceivedIndex) {
        try { 
            receivedMessage.add(Long.valueOf(message.getText()));
        } catch (Exception e) {
            e.printStackTrace();