use of org.apache.james.mailbox.store.mail.AbstractLockingUidProvider in project i2p.i2p-bote by i2p.
the class MapperFactory method createUidProvider.
private UidProvider createUidProvider() {
MailboxPathLocker uidLocker = new AbstractMailboxPathLocker() {
@Override
protected void lock(MailboxSession session, MailboxPath path, boolean writeLock) throws MailboxException {
BoteMailbox mailbox = getMailboxes().get(path.getName().toLowerCase());
mailbox.lockNextUid(writeLock);
}
@Override
protected void unlock(MailboxSession session, MailboxPath path, boolean writeLock) throws MailboxException {
BoteMailbox mailbox = getMailboxes().get(path.getName().toLowerCase());
mailbox.unlockNextUid(writeLock);
}
};
return new AbstractLockingUidProvider(uidLocker) {
@Override
protected MessageUid lockedNextUid(MailboxSession session, Mailbox mailbox) throws MailboxException {
BoteMailbox boteMailbox = (BoteMailbox) mailbox;
return boteMailbox.lockedNextUid();
}
@Override
public Optional<MessageUid> lastUid(MailboxSession session, Mailbox mailbox) throws MailboxException {
BoteMailbox boteMailbox = (BoteMailbox) mailbox;
return boteMailbox.lastUid();
}
};
}
Aggregations