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

How to use
ExceptionHandler
in
com.obsidiandynamics.func

Best Java code snippets using com.obsidiandynamics.func.ExceptionHandler (Showing top 8 results out of 315)

origin: com.obsidiandynamics.fulcrum/fulcrum-func

/**
 *  Curries a {@link ExceptionHandler} with a specific error {@code summary}, so that it can be used
 *  as a simpler {@link Throwable} {@link Consumer}.
 *  
 *  @param summary The error summary to feed to the {@code exceptionHandler}.
 *  @param exceptionHandler Handles errors.
 *  @return A curried {@link Throwable} {@link Consumer}.
 */
public static Consumer<Throwable> withSummary(String summary, ExceptionHandler exceptionHandler) {
 return cause -> exceptionHandler.onException(summary, cause);
}

origin: com.obsidiandynamics.meteor/meteor-core

@Override
public Joinable terminate() {
 if (leaseCandidate != null) {
  deactivate(ExceptionHandler.nop());
 }
 
 Terminator.blank()
 .add(Optional.ofNullable(receiver))
 .add(Optional.ofNullable(keeperThread))
 .add(Optional.ofNullable(election))
 .terminate();
 return this;
}
origin: com.obsidiandynamics.jackdaw/jackdaw-core

private void sendNow(ProducerRecord<K, V> record, Callback callback) {
 try {
  producer.send(record, callback);
 } catch (Throwable e) {
  if (! producerDisposed) {
   exceptionHandler.onException(String.format("Error sending %s", record), e);
  }
 }
}

origin: com.obsidiandynamics.meteor/meteor-core

private static void doWithExceptionHandler(CheckedRunnable<?> r, ExceptionHandler errorHandler, String message) {
 try {
  r.run();
 } catch (Throwable e) {
  errorHandler.onException(message, e);
 }
}

origin: com.obsidiandynamics.jackdaw/jackdaw-core

private void cycle(WorkerThread thread) throws InterruptedException {
 try {
  final ConsumerRecords<K, V> records = consumer.poll(Duration.ofMillis(pollTimeoutMillis));
  recordHandler.onReceive(records);
 } catch (InterruptedException e) {
  throw e;
 } catch (org.apache.kafka.common.errors.InterruptException e) {
  throw new InterruptedException("Converted from " + org.apache.kafka.common.errors.InterruptException.class.getName());
 } catch (Throwable e) {
  exceptionHandlerHandler.onException("Unexpected error", e);
  return;
 }
}

origin: com.obsidiandynamics.fulcrum/fulcrum-retry

 public <T, X extends Throwable> T run(CheckedSupplier<? extends T, X> operation) throws X {
  for (int attempt = 0;; attempt++) {
   try {
    return operation.get();
   } catch (Throwable e) {
    if (exceptionMatcher.test(e)) {
     if (attempt == attempts - 1) {
      final String faultMessage = String.format("Fault (attempt #%,d of %,d): aborting", attempt + 1, attempts);
      errorHandler.onException(faultMessage, e);
      throw e;
     } else {
      final String retryMessage = String.format("Fault (attempt #%,d of %,d): retrying in %,d ms", 
                           attempt + 1, attempts, backoffMillis);
      faultHandler.onException(retryMessage, e);
      if (! Threads.sleep(backoffMillis)) {
       final String interruptMessage = String.format("Fault (attempt #%,d of %,d): aborting due to interrupt", 
                              attempt + 1, attempts);
       errorHandler.onException(interruptMessage, e);
       throw e;
      }
     }
    } else {
     throw e;
    }
   }
  }
 }
}
origin: com.obsidiandynamics.meteor/meteor-core

private void putOffset(long offset) {
 if (isCurrentTenant()) {
  doWithExceptionHandler(() -> offsets.put(config.getGroup(), offset), 
            config.getExceptionHandler(), 
            "Failed to update offset");
 } else {
  final String m = String.format("Failed confirming offset %s for stream %s: %s is not the current tenant for group %s",
                  offset, config.getStreamConfig().getName(), leaseCandidate, config.getGroup());
  config.getExceptionHandler().onException(m, null);
 }
}

origin: com.obsidiandynamics.meteor/meteor-core

final String m = String.format("Error reading at offset %,d from stream %s [%s]",
                nextReadOffset, config.getStreamConfig().getName(), serviceInfo);
config.getExceptionHandler().onException(m, e.getCause());
f.cancel(true);
Thread.sleep(waitMillis);
com.obsidiandynamics.funcExceptionHandler

Most used methods

  • onException
  • nop

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Runner (org.openjdk.jmh.runner)
  • CodeWhisperer alternatives
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