lock.lock();
try {
final ReferenceRecord record = new ReferenceRecord(messageId.toString(), data);
final int subscriberCount = subscriberMessages.size();
if (subscriberCount > 0 && !isDuplicate(messageId)) {
final StoreEntry messageEntry = messageContainer.place(messageId, record);
addInterest(record);
uniqueReferenceAdded = true;
final TopicSubAck tsa = new TopicSubAck();
tsa.setCount(subscriberCount);
tsa.setMessageEntry(messageEntry);
final StoreEntry ackEntry = ackContainer.placeLast(tsa);
for (final Iterator<TopicSubContainer> i = subscriberMessages.values().iterator(); i.hasNext();) {
final TopicSubContainer container = i.next();
final ConsumerMessageRef ref = new ConsumerMessageRef();
ref.setAckEntry(ackEntry);
ref.setMessageEntry(messageEntry);