Tabnine Logo
LambdaUtils.tryTo
Code IndexAdd Tabnine to your IDE (free)

How to use
tryTo
method
in
no.mnemonic.commons.utilities.lambda.LambdaUtils

Best Java code snippets using no.mnemonic.commons.utilities.lambda.LambdaUtils.tryTo (Showing top 3 results out of 315)

origin: mnemonic-no/act-platform

@Override
public void stopComponent() {
 // Stop server to free up any resources.
 LambdaUtils.tryTo(server::stop, ex -> logger.error(ex, "Failed to cleanly shutdown REST API."));
}
origin: mnemonic-no/act-platform

@Override
public void startComponent() {
 // Initialize servlet using RESTEasy and it's Guice bridge.
 // The listener must be injected by the same Guice module which also binds the REST endpoints.
 ServletContextHandler servletHandler = new ServletContextHandler();
 servletHandler.addEventListener(listener);
 servletHandler.addServlet(HttpServletDispatcher.class, "/*");
 // Configure Jetty: Remove 'server' header from response and set listen port.
 HttpConfiguration httpConfig = new HttpConfiguration();
 httpConfig.setSendServerVersion(false);
 ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
 connector.setPort(port);
 // Starting up Jetty to serve the REST API.
 server.addConnector(connector);
 server.setHandler(servletHandler);
 if (!LambdaUtils.tryTo(server::start, ex -> logger.error(ex, "Failed to start REST API."))) {
  throw new IllegalStateException("Failed to start REST API.");
 }
}
origin: mnemonic-no/act-platform

@Override
public void stopComponent() {
 // Release any connection to ElasticSearch.
 if (lowLevelClient != null) {
  LambdaUtils.tryTo(() -> lowLevelClient.close(), ex -> LOGGER.warning(ex, "Error while closing connections to ElasticSearch."));
 }
}
no.mnemonic.commons.utilities.lambdaLambdaUtilstryTo

Popular methods of LambdaUtils

  • forEachTry

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getSystemService (Context)
  • getApplicationContext (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
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