Codota Logo
ExitCodeGenerator.getExitCode
Code IndexAdd Codota to your IDE (free)

How to use
getExitCode
method
in
org.springframework.boot.ExitCodeGenerator

Best Java code snippets using org.springframework.boot.ExitCodeGenerator.getExitCode (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.springframework.boot/spring-boot

/**
 * Get the final exit code that should be returned based on all contained generators.
 * @return the final exit code.
 */
public int getExitCode() {
  int exitCode = 0;
  for (ExitCodeGenerator generator : this.generators) {
    try {
      int value = generator.getExitCode();
      if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
        exitCode = value;
      }
    }
    catch (Exception ex) {
      exitCode = (exitCode != 0) ? exitCode : 1;
      ex.printStackTrace();
    }
  }
  return exitCode;
}
origin: org.springframework.boot/spring-boot

private int getExitCodeFromExitCodeGeneratorException(Throwable exception) {
  if (exception == null) {
    return 0;
  }
  if (exception instanceof ExitCodeGenerator) {
    return ((ExitCodeGenerator) exception).getExitCode();
  }
  return getExitCodeFromExitCodeGeneratorException(exception.getCause());
}
origin: stackoverflow.com

 public static void main(String[] args) throws Exception {
 // spring boot application startup
 SpringApplication springApp = new SpringApplication(.. your context ..);

 // calling the run method returns the context
 // pass your program arguments
 ConfigurableApplicationContext context = springApp.run(args);

 // spring boot uses exitCode Generators to calculate the exit status
 // there should be one implementation of the ExitCodeGenerator interface
 // in your context. Per default SpringBoot uses the JobExecutionExitCodeGenerator
 ExitCodeGenerator exitCodeGen = context.getBean(ExitCodeGenerator.class);

 int code = exitCodeGen.getExitCode();
 context.close();
 System.exit(code);
}
origin: spring-cloud/spring-cloud-task

private int calcExitStatus() {
  int exitCode = 0;
  if (this.exitCodeEvent != null) {
    exitCode = this.exitCodeEvent.getExitCode();
  }
  else if (this.listenerFailed || this.applicationFailedException != null) {
    Throwable exception = this.listenerException;
    if (exception instanceof TaskExecutionException) {
      TaskExecutionException taskExecutionException = (TaskExecutionException) exception;
      if (taskExecutionException.getCause() instanceof InvocationTargetException) {
        InvocationTargetException invocationTargetException = (InvocationTargetException) taskExecutionException
            .getCause();
        if(invocationTargetException != null && invocationTargetException.getTargetException() != null) {
          exception = invocationTargetException.getTargetException();
        }
      }
    }
    if (exception instanceof ExitCodeGenerator) {
      exitCode = ((ExitCodeGenerator) exception).getExitCode();
    }
    else {
      exitCode = 1;
    }
  }
  return exitCode;
}
origin: org.springframework.cloud/spring-cloud-task-core

private int calcExitStatus() {
  int exitCode = 0;
  if (this.exitCodeEvent != null) {
    exitCode = this.exitCodeEvent.getExitCode();
  }
  else if (this.listenerFailed || this.applicationFailedException != null) {
    Throwable exception = this.listenerException;
    if (exception instanceof TaskExecutionException) {
      TaskExecutionException taskExecutionException = (TaskExecutionException) exception;
      if (taskExecutionException.getCause() instanceof InvocationTargetException) {
        InvocationTargetException invocationTargetException = (InvocationTargetException) taskExecutionException
            .getCause();
        if(invocationTargetException != null && invocationTargetException.getTargetException() != null) {
          exception = invocationTargetException.getTargetException();
        }
      }
    }
    if (exception instanceof ExitCodeGenerator) {
      exitCode = ((ExitCodeGenerator) exception).getExitCode();
    }
    else {
      exitCode = 1;
    }
  }
  return exitCode;
}
org.springframework.bootExitCodeGeneratorgetExitCode

Javadoc

Returns the exit code that should be returned from the application.

Popular methods of ExitCodeGenerator

    Popular in Java

    • Parsing JSON documents to java classes using gson
    • compareTo (BigDecimal)
    • notifyDataSetChanged (ArrayAdapter)
    • startActivity (Activity)
    • BufferedWriter (java.io)
      Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
    • HttpURLConnection (java.net)
      An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
    • InetAddress (java.net)
      This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
    • Locale (java.util)
      A Locale object represents a specific geographical, political, or cultural region. An operation that
    • Queue (java.util)
      A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
    • LoggerFactory (org.slf4j)
      The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now