DistributedAtomicLong uid = new DistributedAtomicLong(client, pathForMailbox(mailbox), retryPolicy);
AtomicValue<Long> value = null;
try {
value = uid.get();
} catch (Exception e) {
throw new MailboxException("Exception getting last UID for session " + session, e);
} finally {
if (value != null && value.succeeded()) {
return value.postValue();
} else {
throw new MailboxException("Failed getting last UID for " + session);
}
}
}
throw new MailboxException("Curator client is closed.");
}