use of org.apache.james.mailbox.store.mail.AbstractLockingModSeqProvider in project i2p.i2p-bote by i2p.
the class MapperFactory method createModSeqProvider.
private ModSeqProvider createModSeqProvider() {
MailboxPathLocker modSeqLocker = new AbstractMailboxPathLocker() {
@Override
protected void lock(MailboxSession session, MailboxPath path, boolean writeLock) throws MailboxException {
BoteMailbox mailbox = getMailboxes().get(path.getName().toLowerCase());
mailbox.lockNextModSeq(writeLock);
}
@Override
protected void unlock(MailboxSession session, MailboxPath path, boolean writeLock) throws MailboxException {
BoteMailbox mailbox = getMailboxes().get(path.getName().toLowerCase());
mailbox.unlockNextModSeq(writeLock);
}
};
return new AbstractLockingModSeqProvider(modSeqLocker) {
@Override
protected long lockedNextModSeq(MailboxSession session, Mailbox mailbox) throws MailboxException {
BoteMailbox boteMailbox = (BoteMailbox) mailbox;
return boteMailbox.lockedNextModSeq();
}
@Override
public long highestModSeq(MailboxSession session, Mailbox mailbox) throws MailboxException {
BoteMailbox boteMailbox = (BoteMailbox) mailbox;
return boteMailbox.highestModSeq();
}
@Override
public long highestModSeq(MailboxSession session, MailboxId mailboxId) throws MailboxException {
return highestModSeq(session, getMailboxes().get(mailboxId.serialize().toLowerCase()));
}
};
}
Aggregations