congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
BookkeeperInternalCallbacks$GenericCallback.operationComplete
Code IndexAdd Tabnine to your IDE (free)

How to use
operationComplete
method
in
org.apache.bookkeeper.proto.BookkeeperInternalCallbacks$GenericCallback

Best Java code snippets using org.apache.bookkeeper.proto.BookkeeperInternalCallbacks$GenericCallback.operationComplete (Showing top 20 results out of 315)

origin: twitter/distributedlog

  @Override
  public void operationComplete(int rc, List<LogSegmentMetadata> result) {
    long elapsedMicros = stopwatch.stop().elapsed(TimeUnit.MICROSECONDS);
    if (KeeperException.Code.OK.intValue() != rc) {
      getListStat.registerFailedEvent(elapsedMicros);
    } else {
      if (LogSegmentFilter.DEFAULT_FILTER == segmentFilter) {
        isFullListFetched.set(true);
      }
      getListStat.registerSuccessfulEvent(elapsedMicros);
    }
    finalCallback.operationComplete(rc, result);
  }
};
origin: twitter/distributedlog

  @Override
  public void readComplete(int rc, LedgerHandle lh, Enumeration<LedgerEntry> entries, Object ctx) {
    if (BKException.Code.NoSuchEntryException == rc) {
      callback.operationComplete(BKException.Code.OK, resultList);
    } else if (BKException.Code.OK == rc) {
      while (entries.hasMoreElements()) {
        resultList.add(entries.nextElement());
      }
      long entryId = (Long) ctx;
      ++entryId;
      PendingReadOp readOp = new PendingReadOp(lh, lh.bk.scheduler, entryId, entryId, this, entryId);
      readOp.initiate();
    } else {
      callback.operationComplete(rc, resultList);
    }
  }
};
origin: twitter/distributedlog

  return;
callback.operationComplete(rc, null);
return;
  segmentList = getCachedLogSegments(comparator);
} catch (UnexpectedException e) {
  callback.operationComplete(KeeperException.Code.DATAINCONSISTENCY.intValue(), null);
  return;
callback.operationComplete(KeeperException.Code.OK.intValue(), segmentList);
notifyUpdatedLogSegments(segmentList);
if (!removedSegments.isEmpty()) {
origin: org.apache.bookkeeper/bookkeeper-server

/**
 * Errors out pending ops from per channel bookie client. As the channel
 * is being closed, all the operations waiting on the connection
 * will be sent to completion with error.
 */
void errorOutPendingOps(int rc) {
  Queue<GenericCallback<PerChannelBookieClient>> oldPendingOps;
  synchronized (this) {
    oldPendingOps = pendingOps;
    pendingOps = new ArrayDeque<>();
  }
  for (GenericCallback<PerChannelBookieClient> pendingOp : oldPendingOps) {
    pendingOp.operationComplete(rc, PerChannelBookieClient.this);
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

  private void failTLS(int rc) {
    LOG.error("TLS failure on: {}, rc: {}", channel, rc);
    Queue<GenericCallback<PerChannelBookieClient>> oldPendingOps;
    synchronized (this) {
      disconnect();
      oldPendingOps = pendingOps;
      pendingOps = new ArrayDeque<>();
    }
    for (GenericCallback<PerChannelBookieClient> pendingOp : oldPendingOps) {
      pendingOp.operationComplete(rc, null);
    }
    failedTlsHandshakeCounter.inc();
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

private void completeOperation(GenericCallback<PerChannelBookieClient> op, int rc) {
  //Thread.dumpStack();
  closeLock.readLock().lock();
  try {
    if (ConnectionState.CLOSED == state) {
      op.operationComplete(BKException.Code.ClientClosedException, this);
    } else {
      op.operationComplete(rc, this);
    }
  } finally {
    closeLock.readLock().unlock();
  }
}
origin: org.apache.distributedlog/distributedlog-core

  @Override
  public void onFailure(Throwable throwable) {
    if (throwable instanceof BKNoSuchEntryException) {
      callback.operationComplete(Code.OK, resultList);
    } else {
      int retCode;
      if (throwable instanceof BKException) {
        retCode = ((BKException) throwable).getCode();
      } else {
        retCode = Code.UnexpectedConditionException;
      }
      callback.operationComplete(retCode, resultList);
    }
  }
};
origin: org.apache.bookkeeper/bookkeeper-server

  @Override
  public void processResult(int rc, String path, Object ctx) {
    callback.operationComplete(rc, ledgers);
  }
}, null, BKException.Code.OK, BKException.Code.MetaStoreException);
origin: org.apache.bookkeeper/bookkeeper-server

  public void readEntryComplete(int rc, long ledgerId, long entryId,
                 ByteBuf buffer, Object ctx) {
    if (BKException.Code.NoSuchEntryException != rc && BKException.Code.NoSuchLedgerExistsException != rc) {
      entryMayExist.set(true);
    }
    if (numReads.decrementAndGet() == 0) {
      cb.operationComplete(rc, entryMayExist.get());
    }
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

  @Override
  public void operationComplete(int rc, Long result) {
    if (rc == BKException.Code.LedgerIdOverflowException) {
      // 31-bit IDs overflowed. Start using 63-bit ids.
      createLongLedgerIdPathAndGenerateLongLedgerId(cb, ledgerIdGenPath);
    } else {
      // 31-bit Generation worked OK, or had some other
      // error that we will pass on.
      cb.operationComplete(rc, result);
    }
  }
});
origin: org.apache.bookkeeper/bookkeeper-server

  public void process(WatchedEvent e) {
    if (e.getType() == Watcher.Event.EventType.NodeDataChanged) {
      cb.operationComplete(0, null);
    }
  }
};
origin: org.apache.bookkeeper/bookkeeper-server

  public void process(WatchedEvent e) {
    if (e.getType() == Watcher.Event.EventType.NodeDeleted) {
      LOG.info("LedgerReplication is enabled externally through Zookeeper, "
          + "since DISABLE_NODE ZNode is deleted");
      cb.operationComplete(0, null);
    }
  }
};
origin: org.apache.bookkeeper/bookkeeper-server

  public void operationComplete(int rc, LedgerFragment result) {
    if (rc == BKException.Code.ClientClosedException) {
      cb.operationComplete(BKException.Code.ClientClosedException, badFragments);
      return;
    } else if (rc != BKException.Code.OK) {
      badFragments.add(result);
    }
    if (numFragments.decrementAndGet() == 0) {
      cb.operationComplete(BKException.Code.OK, badFragments);
    }
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

  public void readEntryComplete(int rc, long ledgerId, long entryId,
      ByteBuf buffer, Object ctx) {
    if (rc == BKException.Code.OK) {
      if (numEntries.decrementAndGet() == 0
          && !completed.getAndSet(true)) {
        cb.operationComplete(rc, fragment);
      }
    } else if (!completed.getAndSet(true)) {
      cb.operationComplete(rc, fragment);
    }
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

  @Override
  public void operationComplete(int rc, T result) {
    if (successRc == rc) {
      statsLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS);
    } else {
      statsLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS);
    }
    cb.operationComplete(rc, result);
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

  @Override
  public void operationComplete(int rc, T result) {
    closeLock.readLock().lock();
    try {
      if (!closed && null != removeCallback(cb)) {
        cb.operationComplete(rc, result);
      }
    } finally {
      closeLock.readLock().unlock();
    }
  }
}
origin: twitter/distributedlog

} catch (ZooKeeperClient.ZooKeeperConnectionException e) {
  getListStat.registerFailedEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS));
  finalCallback.operationComplete(KeeperException.Code.CONNECTIONLOSS.intValue(), null);
} catch (InterruptedException e) {
  getListStat.registerFailedEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS));
  finalCallback.operationComplete(KeeperException.Code.CONNECTIONLOSS.intValue(), null);
origin: twitter/distributedlog

  @Override
  public void readLastConfirmedDataComplete(int rc, DigestManager.RecoveryData recoveryData) {
    if (BKException.Code.OK != rc) {
      callback.operationComplete(rc, resultList);
      return;
    }
    if (LedgerHandle.INVALID_ENTRY_ID >= recoveryData.lastAddConfirmed) {
      callback.operationComplete(BKException.Code.OK, resultList);
      return;
    }
    long entryId = recoveryData.lastAddConfirmed;
    PendingReadOp readOp = new PendingReadOp(lh, lh.bk.scheduler, entryId, entryId, readCallback, entryId);
    try {
      readOp.initiate();
    } catch (Throwable t) {
      logger.error("Failed to initialize pending read entry {} for ledger {} : ",
             new Object[] { entryId, lh.getLedgerMetadata(), t });
    }
  }
};
origin: twitter/distributedlog

  @Override
  public void readEntryComplete(int rc, long lid, long eid, ChannelBuffer buffer, Object ctx) {
    BookieSocketAddress bookieAddress = (BookieSocketAddress) ctx;
    ReadResult<InputStream> rr;
    if (BKException.Code.OK != rc) {
      rr = new ReadResult<InputStream>(eid, rc, null, bookieAddress.getSocketAddress());
    } else {
      try {
        ChannelBufferInputStream is = lh.macManager.verifyDigestAndReturnData(eid, buffer);
        rr = new ReadResult<InputStream>(eid, BKException.Code.OK, is, bookieAddress.getSocketAddress());
      } catch (BKException.BKDigestMatchException e) {
        rr = new ReadResult<InputStream>(eid, BKException.Code.DigestMatchException, null, bookieAddress.getSocketAddress());
      }
    }
    readResults.add(rr);
    if (numBookies.decrementAndGet() == 0) {
      callback.operationComplete(BKException.Code.OK, readResults);
    }
  }
};
origin: twitter/distributedlog

  @Override
  public void readEntryComplete(int rc, long lid, long eid, ChannelBuffer buffer, Object ctx) {
    InetSocketAddress bookieAddress = (InetSocketAddress) ctx;
    ReadResult<Long> rr;
    if (BKException.Code.OK != rc) {
      rr = new ReadResult<Long>(eid, rc, null, bookieAddress);
    } else {
      try {
        DigestManager.RecoveryData data = lh.macManager.verifyDigestAndReturnLastConfirmed(buffer);
        rr = new ReadResult<Long>(eid, BKException.Code.OK, data.lastAddConfirmed, bookieAddress);
      } catch (BKException.BKDigestMatchException e) {
        rr = new ReadResult<Long>(eid, BKException.Code.DigestMatchException, null, bookieAddress);
      }
    }
    readResults.add(rr);
    if (numBookies.decrementAndGet() == 0) {
      callback.operationComplete(BKException.Code.OK, readResults);
    }
  }
};
org.apache.bookkeeper.protoBookkeeperInternalCallbacks$GenericCallbackoperationComplete

Popular methods of BookkeeperInternalCallbacks$GenericCallback

    Popular in Java

    • Making http post requests using okhttp
    • setContentView (Activity)
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • putExtra (Intent)
    • Table (com.google.common.collect)
      A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
    • HttpServer (com.sun.net.httpserver)
      This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
    • FileReader (java.io)
      A specialized Reader that reads from a file in the file system. All read requests made by calling me
    • List (java.util)
      An ordered collection (also known as a sequence). The user of this interface has precise control ove
    • TreeSet (java.util)
      TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
    • JList (javax.swing)
    • Top 12 Jupyter Notebook Extensions
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now