Tabnine Logo
BKException
Code IndexAdd Tabnine to your IDE (free)

How to use
BKException
in
org.apache.bookkeeper.client.api

Best Java code snippets using org.apache.bookkeeper.client.api.BKException (Showing top 10 results out of 315)

origin: apache/pulsar

public static ManagedLedgerException createManagedLedgerException(Throwable t) {
  if (t instanceof org.apache.bookkeeper.client.api.BKException) {
    return createManagedLedgerException(((org.apache.bookkeeper.client.api.BKException) t).getCode());
  } else {
    return new ManagedLedgerException("Unknown exception");
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

/**
 * Create a new exception.
 *
 * @param code the error code
 *
 * @see Code
 */
public BKException(int code) {
  super(getMessage(code));
  this.code = code;
}
origin: org.apache.bookkeeper/bookkeeper-server

/**
 * Log the fence ledger entry in Journal so that we can rebuild the state.
 * @param journal log the fence entry in the Journal
 * @return A future which will be satisfied when add entry to journal complete
 */
private SettableFuture<Boolean> logFenceEntryInJournal(Journal journal) {
  SettableFuture<Boolean> result;
  synchronized (this) {
    result = logFenceResult = SettableFuture.create();
  }
  ByteBuf entry = createLedgerFenceEntry(ledgerId);
  try {
    journal.logAddEntry(entry, false /* ackBeforeSync */, (rc, ledgerId, entryId, addr, ctx) -> {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Record fenced state for ledger {} in journal with rc {}",
            ledgerId, BKException.codeLogger(rc));
      }
      if (rc == 0) {
        fenceEntryPersisted.compareAndSet(false, true);
        result.set(true);
      } else {
        result.set(false);
      }
    }, null);
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    result.setException(e);
  }
  return result;
}
origin: org.apache.bookkeeper/bookkeeper-server

/**
 * Create a new exception with the <tt>cause</tt>.
 *
 * @param code exception code
 * @param cause the exception cause
 */
public BKException(int code, Throwable cause) {
  super(getMessage(code), cause);
  this.code = code;
}
origin: org.apache.pulsar/pulsar-broker

  public static Exception bkException(String operation, int rc, long ledgerId, long entryId) {
    String message = org.apache.bookkeeper.client.api.BKException.getMessage(rc) + " -  ledger=" + ledgerId;

    if (entryId != -1) {
      message += " - entry=" + entryId;
    }
    return new IOException(message);
  }
}
origin: apache/pulsar

if (exception != null) {
  if (exception instanceof BKException
    && ((BKException)exception).getCode() == BKException.Code.TooManyRequestsException) {
    callback.readEntriesFailed(createManagedLedgerException(exception), ctx);
  } else {
origin: org.apache.bookkeeper/bookkeeper-server

  @Override
  public String toString() {
    return String.format("%d: %s", code, getMessage(code));
  }
}
origin: org.apache.pulsar/managed-ledger-original

public static ManagedLedgerException createManagedLedgerException(Throwable t) {
  if (t instanceof org.apache.bookkeeper.client.api.BKException) {
    return createManagedLedgerException(((org.apache.bookkeeper.client.api.BKException)t).getCode());
  } else {
    return new ManagedLedgerException("Unknown exception");
  }
}
origin: org.apache.bookkeeper/bookkeeper-server

private void initPoolMessages(Field[] fields) {
  for (Field field : fields) {
    int code = getFieldInt(field);
    int index = poolIndex(code);
    if (index >= 0) {
      pool[index] = String.format("%s: %s", field.getName(), getMessage(code));
    }
  }
}
origin: org.apache.pulsar/managed-ledger-original

if (exception != null) {
  if (exception instanceof BKException
    && ((BKException)exception).getCode() == BKException.Code.TooManyRequestsException) {
    callback.readEntriesFailed(createManagedLedgerException(exception), ctx);
  } else {
org.apache.bookkeeper.client.apiBKException

Javadoc

Super class for all errors which occur using BookKeeper client.

Most used methods

  • getMessage
    Describe an error code.
  • codeLogger
    Returns a lazy error code formatter suitable to pass to log functions.
  • getCode
    Get the return code for the exception.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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