001/* 002 * Copyright 2012-2017 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot; 018 019import org.springframework.context.ApplicationEvent; 020 021/** 022 * Event fired when an application exit code has been determined from an 023 * {@link ExitCodeGenerator}. 024 * 025 * @author Phillip Webb 026 * @since 1.3.2 027 */ 028public class ExitCodeEvent extends ApplicationEvent { 029 030 private final int exitCode; 031 032 /** 033 * Create a new {@link ExitCodeEvent} instance. 034 * @param source the source of the event 035 * @param exitCode the exit code 036 */ 037 public ExitCodeEvent(Object source, int exitCode) { 038 super(source); 039 this.exitCode = exitCode; 040 } 041 042 /** 043 * Return the exit code that will be used to exit the JVM. 044 * @return the exit code 045 */ 046 public int getExitCode() { 047 return this.exitCode; 048 } 049 050}