final Message<Id> message = createMessage(internalDate, size, bodyStartOctet, contentIn, flags, propertyBuilder);
return locker.executeWithLock(mailboxSession, new StoreMailboxPath<Id>(getMailboxEntity()), new MailboxPathLocker.LockAwareExecution<Long>() {
@Override
public Long execute() throws MailboxException {
MessageMetaData data = appendMessageToStore(message, mailboxSession);
SortedMap<Long, MessageMetaData> uids = new TreeMap<Long, MessageMetaData>();
uids.put(data.getUid(), data);
dispatcher.added(mailboxSession, uids, getMailboxEntity());
return data.getUid();
}
}, true);
} catch (IOException e) {
throw new MailboxException("Unable to parse message", e);