Beispiel #1
0
 public long readLastAddConfirmed(long ledgerId) throws IOException {
   long requestNanos = MathUtils.nowInNano();
   boolean success = false;
   try {
     LedgerDescriptor handle = handles.getReadOnlyHandle(ledgerId);
     long lac = handle.getLastAddConfirmed();
     success = true;
     return lac;
   } finally {
     long elapsedMicros = MathUtils.elapsedMicroSec(requestNanos);
     if (success) {
       readLastConfirmedStats.registerSuccessfulEvent(elapsedMicros);
     } else {
       readLastConfirmedStats.registerFailedEvent(elapsedMicros);
     }
   }
 }
Beispiel #2
0
 public ByteBuffer readEntry(long ledgerId, long entryId) throws IOException, NoLedgerException {
   long requestNanos = MathUtils.nowInNano();
   boolean success = false;
   try {
     LedgerDescriptor handle = handles.getReadOnlyHandle(ledgerId);
     LOG.trace("Reading {}@{}", entryId, ledgerId);
     ByteBuffer data = handle.readEntry(entryId);
     success = true;
     return data;
   } finally {
     long elapsedMicros = MathUtils.elapsedMicroSec(requestNanos);
     if (success) {
       readEntryStats.registerSuccessfulEvent(elapsedMicros);
     } else {
       readEntryStats.registerFailedEvent(elapsedMicros);
     }
   }
 }
Beispiel #3
0
 public Observable waitForLastAddConfirmedUpdate(
     long ledgerId, long previoisLAC, Observer observer) throws IOException {
   LedgerDescriptor handle = handles.getReadOnlyHandle(ledgerId);
   return handle.waitForLastAddConfirmedUpdate(previoisLAC, observer);
 }