org.springframework.boot.SpringApplication.exit()

Here are the examples of the java api org.springframework.boot.SpringApplication.exit() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

68 Examples 7

19 View Source File : SampleBatchApplicationTests.java
License : Apache License 2.0
Project Creator : yuanmabiji

@Test
public void testDefaultSettings() {
    replacedertThat(SpringApplication.exit(SpringApplication.run(SampleBatchApplication.clreplaced))).isEqualTo(0);
    String output = this.outputCapture.toString();
    replacedertThat(output).contains("completed with the following parameters");
}

19 View Source File : SampleBatchApplication.java
License : Apache License 2.0
Project Creator : yuanmabiji

public static void main(String[] args) {
    // System.exit is common for Batch applications since the exit code can be used to
    // drive a workflow
    System.exit(SpringApplication.exit(SpringApplication.run(SampleBatchApplication.clreplaced, args)));
}

19 View Source File : ExitCodeApplication.java
License : Apache License 2.0
Project Creator : yuanmabiji

public static void main(String[] args) {
    System.exit(SpringApplication.exit(SpringApplication.run(ExitCodeApplication.clreplaced, args)));
}

public static void main(String[] args) {
    log.info("Program arguments: " + Arrays.toString(args));
    System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
    ConfigurableApplicationContext ctx = SpringApplication.run(HesperidesSpringApplication.clreplaced, args);
    if (System.getenv("EXIT_AFTER_INIT") != null) {
        log.info("Immediately stopping the app:");
        System.exit(SpringApplication.exit(ctx, () -> 0));
    }
}

19 View Source File : GenericSpringBootSaturnApplication.java
License : Apache License 2.0
Project Creator : vipshop

@Override
public void destroy() {
    if (applicationContext != null) {
        SpringApplication.exit(applicationContext);
        applicationContext = null;
    }
}

19 View Source File : SaturnConsoleApp.java
License : Apache License 2.0
Project Creator : vipshop

public static void stop(ApplicationContext applicationContext) {
    SpringApplication.exit(applicationContext);
}

19 View Source File : App.java
License : Apache License 2.0
Project Creator : VertaAI

/**
 * Shut down the spring boot server
 *
 * @param returnCode : for system exit - 0
 */
public static void initiateShutdown(int returnCode) {
    App app = App.getInstance();
    SpringApplication.exit(app.applicationContext, () -> returnCode);
}

private static void closeApplicationContext() {
    SpringApplication.exit(applicationContext);
}

19 View Source File : TasksToRunFactory.java
License : Apache License 2.0
Project Creator : spring-cloud

TasksToRun taskFromOption(List<ReleaserTask> tasks) {
    String input = chosenOption();
    if ("q".equals(input.toLowerCase())) {
        SpringApplication.exit(this.context, () -> 0);
        System.exit(0);
        return null;
    }
    if (input.contains("-")) {
        return rangeInteractive(tasks, input);
    } else if (input.contains(",")) {
        return tasksInteractive(tasks, input);
    } else {
        return singleTask(tasks, input);
    }
}

19 View Source File : SpringBatchFlowRunner.java
License : Apache License 2.0
Project Creator : spring-cloud

public boolean skipStep() {
    String input = chosenOption();
    switch(input.toLowerCase()) {
        case "s":
            return true;
        case "q":
            reportHandler.reportBuildSummary();
            System.exit(SpringApplication.exit(this.context, () -> 0));
            return true;
        default:
            return false;
    }
}

19 View Source File : SpringBatchExecutionResultHandler.java
License : Apache License 2.0
Project Creator : spring-cloud

void exitWithException() {
    System.exit(SpringApplication.exit(this.context, () -> 1));
}

19 View Source File : SpringBatchExecutionResultHandler.java
License : Apache License 2.0
Project Creator : spring-cloud

void exitSuccessfully() {
    System.exit(SpringApplication.exit(this.context, () -> 0));
}

19 View Source File : LocalDataflowResource.java
License : Apache License 2.0
Project Creator : spring-cloud

@Override
protected void after() {
    SpringApplication.exit(configurableApplicationContext);
    if (originalConfigLocation != null) {
        System.setProperty("spring.config.location", originalConfigLocation);
    } else {
        System.clearProperty("spring.config.location");
    }
}

19 View Source File : AbstractShellIntegrationTest.java
License : Apache License 2.0
Project Creator : spring-cloud

@AfterClreplaced
public static void shutdown() {
    if (shutdownAfterRun) {
        logger.info("Stopping Data Flow Shell");
        if (dataFlowShell != null) {
            dataFlowShell.stop();
        }
        if (applicationContext != null) {
            logger.info("Stopping Data Flow Server");
            SpringApplication.exit(applicationContext);
            applicationContext = null;
        }
    }
}

19 View Source File : ShellCommandLineRunner.java
License : Apache License 2.0
Project Creator : spring-cloud

@Override
public void run(String... args) throws Exception {
    SpringApplication.exit(this.applicationContext, new ShellExitCodeGenerator(this.doRun()));
}

19 View Source File : MySpringApp.java
License : Apache License 2.0
Project Creator : remkop

public static void main(String[] args) {
    System.exit(SpringApplication.exit(SpringApplication.run(MySpringApp.clreplaced, args)));
}

19 View Source File : ElasticsearchAvailabilityChecker.java
License : Apache License 2.0
Project Creator : planetlabs

private void shutdown() {
    log.error("Elasticsearch is not available. Max retry attempts (" + configProps.getMaxReconnectionAttempts() + ") has been reached. Shutting down...");
    SpringApplication.exit(appContext, () -> 1);
    System.exit(1);
}

19 View Source File : DemoApplication.java
License : MIT License
Project Creator : Paleozoic

public static void main(String[] args) throws InvalidTopologyException, AuthorizationException, AlreadyAliveException, InterruptedException {
    ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.clreplaced, args);
    AppMain appMain = context.getBean(AppMain.clreplaced);
    appMain.Laugher();
    SpringApplication.exit(context);
}

19 View Source File : BackstopperSpringboot2WebMvcComponentTest.java
License : Apache License 2.0
Project Creator : Nike-Inc

@AfterClreplaced
public static void afterClreplaced() {
    SpringApplication.exit(clreplacedpathScanServerAppContext);
    SpringApplication.exit(directImportServerAppContext);
}

19 View Source File : VerifyExpectedErrorsAreReturnedComponentTest.java
License : Apache License 2.0
Project Creator : Nike-Inc

@AfterClreplaced
public static void afterClreplaced() {
    SpringApplication.exit(serverAppContext);
}

19 View Source File : NaverSpringBatchExtensionSampleApplication.java
License : Apache License 2.0
Project Creator : naver

public static void main(String[] args) {
    System.exit(SpringApplication.exit(SpringApplication.run(NaverSpringBatchExtensionSampleApplication.clreplaced, args)));
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : miyabayt

public static void main(String[] args) throws Exception {
    try {
        val application = new SpringApplication(Application.clreplaced);
        application.setWebApplicationType(WebApplicationType.NONE);
        val context = application.run(args);
        val exitCode = SpringApplication.exit(context);
        System.exit(exitCode);
    } catch (Throwable t) {
        log.error("failed to run. ", t);
        System.exit(1);
    }
}

19 View Source File : ExitCodeEventOnExitBootstrap.java
License : Apache License 2.0
Project Creator : mercyblitz

public static void main(String[] args) {
    System.exit(SpringApplication.exit(new SpringApplicationBuilder(ExitCodeEventOnExitBootstrap.clreplaced).listeners((ApplicationListener<ExitCodeEvent>) event -> System.out.println("监听到退出码:" + event.getExitCode())).web(// 非 Web 应用
    false).run(// 运行 SpringBoot 应用
    args)));
}

19 View Source File : ClientComponent.java
License : Apache License 2.0
Project Creator : luis-moral

@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
    ClientLogic clientLogic = new ClientLogic();
    Disposable logicOne = clientLogic.start(webSocketClient, getURI(), new ClientWebSocketHandler());
    Disposable logicTwo = clientLogic.start(webSocketClient, getURI(), new ClientWebSocketHandler());
    Mono.delay(Duration.ofSeconds(10)).doOnEach(value -> logicOne.dispose()).doOnEach(value -> logicTwo.dispose()).map(value -> SpringApplication.exit(applicationContext, () -> 0)).subscribe(exitValue -> System.exit(exitValue));
}

19 View Source File : StupidHttpServer.java
License : The Unlicense
Project Creator : libetl

public static void stop() {
    SpringApplication.exit(StupidHttpServer.context, new JobExecutionExitCodeGenerator());
}

19 View Source File : RequestMonitor.java
License : The Unlicense
Project Creator : libetl

public static void stop() {
    SpringApplication.exit(RequestMonitor.context, new JobExecutionExitCodeGenerator());
}

19 View Source File : InversionMain.java
License : Apache License 2.0
Project Creator : inversion-api

public static void exit() {
    if (context != null)
        SpringApplication.exit(context);
    context = null;
}

19 View Source File : TestService.java
License : MIT License
Project Creator : intuit

public static void stop(ConfigurableApplicationContext context) {
    SpringApplication.exit(context, () -> 0);
}

19 View Source File : Application.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : IG-Group

@Override
public void run(String... args) throws Exception {
    if (args.length < 3) {
        LOG.error("Usage:- Application identifier preplacedword apikey [epic]");
        System.exit(-1);
    }
    String identifier = args[0];
    String preplacedword = args[1];
    String apiKey = args[2];
    String epic = args.length > 3 ? args[3] : null;
    ApplicationContext applicationContext = new ClreplacedPathXmlApplicationContext("/application-spring-context.xml");
    Application app = (Application) applicationContext.getBean("application");
    System.exit(SpringApplication.exit(applicationContext, () -> app.run(identifier, preplacedword, apiKey, epic) ? 0 : 1));
}

19 View Source File : Application.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : IG-Group

@Override
public void run(String... args) throws Exception {
    if (args.length < 2) {
        LOG.error("Usage:- Application identifier preplacedword apikey");
        System.exit(-1);
    }
    String identifier = args[0];
    String preplacedword = args[1];
    String apiKey = args[2];
    ApplicationContext applicationContext = new ClreplacedPathXmlApplicationContext("/application-spring-context.xml");
    Application app = (Application) applicationContext.getBean("application");
    System.exit(SpringApplication.exit(applicationContext, () -> app.run(identifier, preplacedword, apiKey) ? 0 : 1));
}

19 View Source File : FilterTool.java
License : Apache License 2.0
Project Creator : HotelsDotCom

public static void main(String[] args) throws Exception {
    // below is output *before* logging is configured so will appear on console
    logVersionInfo();
    try {
        SpringApplication.exit(new SpringApplicationBuilder(FilterTool.clreplaced).properties("spring.config.location:${config:null}").properties("spring.profiles.active:" + Modules.REPLICATION).properties("instance.home:${user.home}").properties("instance.name:${source-catalog.name}_${replica-catalog.name}").bannerMode(Mode.OFF).registerShutdownHook(true).build().run(args));
    } catch (BeanCreationException e) {
        Throwable mostSpecificCause = e.getMostSpecificCause();
        if (mostSpecificCause instanceof BindException) {
            printFilterToolHelp(((BindException) mostSpecificCause).getAllErrors());
        }
        throw e;
    }
}

19 View Source File : ComparisonTool.java
License : Apache License 2.0
Project Creator : HotelsDotCom

public static void main(String[] args) throws Exception {
    // below is output *before* logging is configured so will appear on console
    logVersionInfo();
    try {
        SpringApplication.exit(new SpringApplicationBuilder(ComparisonTool.clreplaced).properties("spring.config.location:${config:null}").properties("spring.profiles.active:" + Modules.REPLICATION).properties("instance.home:${user.home}").properties("instance.name:${source-catalog.name}_${replica-catalog.name}").bannerMode(Mode.OFF).registerShutdownHook(true).build().run(args));
    } catch (BeanCreationException e) {
        Throwable mostSpecificCause = e.getMostSpecificCause();
        if (mostSpecificCause instanceof BindException) {
            printComparisonToolHelp(((BindException) mostSpecificCause).getAllErrors());
            throw e;
        }
        if (e.getMostSpecificCause() instanceof IllegalArgumentException) {
            LOG.error(e.getMessage(), e);
            printComparisonToolHelp(Collections.<ObjectError>emptyList());
        }
    }
}

19 View Source File : GalapagosApplication.java
License : GNU Affero General Public License v3.0
Project Creator : HermesGermany

@Override
public void run(ApplicationArguments args) throws Exception {
    boolean exit = false;
    for (String optionName : args.getOptionNames()) {
        if (optionName.startsWith(ADMIN_JOB_OPTION_PREFIX)) {
            String jobName = optionName.substring(ADMIN_JOB_OPTION_PREFIX.length());
            AdminJob job = adminJobs.stream().filter(j -> jobName.equals(j.getJobName())).findFirst().orElseThrow(() -> new IllegalArgumentException("Unknown Galapagos Admin job type: " + optionName));
            try {
                job.run(args);
                exit = true;
            } catch (Throwable t) {
                t.printStackTrace();
                SpringApplication.exit(applicationContext, () -> 1);
            }
        }
    }
    if (exit) {
        SpringApplication.exit(applicationContext, () -> 0);
    }
}

19 View Source File : DataExtractionTest.java
License : GNU Affero General Public License v3.0
Project Creator : GIScience

/**
 * Stops this application context.
 */
@AfterClreplaced
public static void applicationMainShutdown() {
    if (null != Application.getApplicationContext()) {
        SpringApplication.exit(Application.getApplicationContext(), () -> 0);
    }
}

19 View Source File : GazePlayLauncher.java
License : GNU General Public License v3.0
Project Creator : GazePlay

public static void main(String[] args) {
    Thread.currentThread().setName(GazePlayLauncher.clreplaced.getSimpleName() + "-main");
    Thread.currentThread().setUncaughtExceptionHandler(new LoggingUncaughtExceptionHandler());
    Runnable rootTask = () -> {
        SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
        printStartupInfo();
        // fixDefaultCharset();
        initGazePlayDirectory();
        System.exit(SpringApplication.exit(SpringApplication.run(GazePlayLauncher.clreplaced, args)));
    };
    ThreadFactory threadFactory = new CustomThreadFactory("application-bootsrap", new GroupingThreadFactory("application-bootsrap-group"));
    Thread bootstrapThread = threadFactory.newThread(rootTask);
    bootstrapThread.start();
}

19 View Source File : ContextUtil.java
License : Apache License 2.0
Project Creator : Frodez

/**
 * 关闭spring应用
 * @param exitCode 返回码
 * @author Frodez
 * @date 2019-06-04
 */
public static void exit(int exitCode) {
    SpringApplication.exit(context, () -> exitCode);
}

19 View Source File : CatsMain.java
License : Apache License 2.0
Project Creator : Endava

public static void main(String... args) {
    System.exit(SpringApplication.exit(new SpringApplicationBuilder(CatsMain.clreplaced).bannerMode(Banner.Mode.CONSOLE).logStartupInfo(false).build().run(args)));
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : edgexfoundry

public static void exit(int rc) {
    if (ctx != null) {
        SpringApplication.exit(ctx, () -> rc);
    } else {
        System.exit(rc);
    }
}

19 View Source File : SpringBootBatchCommandLine.java
License : Apache License 2.0
Project Creator : devonfw

private void stopBatch(ConfigurableApplicationContext ctx, String jobName) throws Exception {
    int returnCode = 0;
    try {
        Set<Long> runningJobExecutionIDs = this.operator.getRunningExecutions(jobName);
        if (runningJobExecutionIDs.isEmpty()) {
            throw new JobExecutionNotRunningException("Batch job " + jobName + " is currently not being executed.");
        }
        LOG.debug("Found {} executions to be stopped (potentially" + " already in state stopping).", runningJobExecutionIDs.size());
        int stoppedCount = 0;
        for (Long id : runningJobExecutionIDs) {
            try {
                this.operator.stop(id);
                stoppedCount++;
            } catch (JobExecutionNotRunningException e) {
            // might have finished at this point
            // or was in state stopping already
            }
        }
        LOG.info("Actually stopped {} batch executions.", stoppedCount);
    } catch (Exception e) {
        returnCode = 1;
        throw e;
    } finally {
        final int returnCodeResult = returnCode;
        SpringApplication.exit(ctx, new ExitCodeGenerator() {

            @Override
            public int getExitCode() {
                return returnCodeResult;
            }
        });
    }
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : covid-be-app

/**
 * Terminates this application with exit code 1 (general error).
 */
public static void killApplication(ApplicationContext appContext) {
    SpringApplication.exit(appContext);
    logger.error("Federation Upload Service terminated abnormally.");
    System.exit(1);
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : covid-be-app

/**
 * Terminates this application with exit code 1 (general error).
 */
public static void killApplication(ApplicationContext appContext) {
    SpringApplication.exit(appContext);
    logger.error("Federation Download Service terminated abnormally.");
    System.exit(1);
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : covid-be-app

/**
 * Terminates this application with exit code 1 (general error).
 */
public static void killApplication(ApplicationContext appContext) {
    SpringApplication.exit(appContext);
    logger.error("Application terminated abnormally.");
    System.exit(1);
}

19 View Source File : InitializationService.java
License : GNU General Public License v3.0
Project Creator : coti-io

@PostConstruct
@Override
public void init() {
    try {
        super.init();
        super.initDB();
        super.createNetworkNodeData();
        super.getNetwork();
        publisherNodeTypeToMessageTypesMap.put(NodeType.FinancialServer, Collections.singletonList(TransactionData.clreplaced));
        communicationService.initSubscriber(NodeType.ZeroSpendServer, publisherNodeTypeToMessageTypesMap);
        HashMap<String, Consumer<IPropagatable>> clreplacedNameToReceiverHandlerMapping = new HashMap<>();
        clreplacedNameToReceiverHandlerMapping.put(TransactionDspVote.clreplaced.getName(), data -> dspVoteService.receiveDspVote((TransactionDspVote) data));
        communicationService.initReceiver(receivingPort, clreplacedNameToReceiverHandlerMapping);
        communicationService.initPublisher(propagationPort, NodeType.ZeroSpendServer);
        networkService.addListToSubscription(networkService.getMapFromFactory(NodeType.DspNode).values());
        if (networkService.getSingleNodeData(NodeType.FinancialServer) != null) {
            networkService.addListToSubscription(new ArrayList<>(Collections.singletonList(networkService.getSingleNodeData(NodeType.FinancialServer))));
        }
        if (!recoveryServerAddress.isEmpty()) {
            networkService.setRecoveryServerAddress(recoveryServerAddress);
        }
        super.initServices();
        messageReceiver.initReceiverHandler();
        if (transactions.isEmpty()) {
            transactionCreationService.createGenesisTransactions();
        }
    } catch (CotiRunTimeException e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        e.logMessage();
        System.exit(SpringApplication.exit(applicationContext));
    } catch (Exception e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        log.error("{}: {}", e.getClreplaced().getName(), e.getMessage());
        System.exit(SpringApplication.exit(applicationContext));
    }
}

19 View Source File : InitializationService.java
License : GNU General Public License v3.0
Project Creator : coti-io

@PostConstruct
@Override
public void init() {
    try {
        super.init();
        super.initDB();
        super.createNetworkNodeData();
        super.getNetwork();
        publisherNodeTypeToMessageTypesMap.put(NodeType.ZeroSpendServer, Arrays.asList(TransactionData.clreplaced, DspConsensusResult.clreplaced));
        publisherNodeTypeToMessageTypesMap.put(NodeType.FinancialServer, Collections.singletonList(TransactionData.clreplaced));
        communicationService.initSubscriber(NodeType.TrustScoreNode, publisherNodeTypeToMessageTypesMap);
        NetworkNodeData zerospendNetworkNodeData = networkService.getSingleNodeData(NodeType.ZeroSpendServer);
        if (zerospendNetworkNodeData == null) {
            log.error("No zerospend server exists in the network got from the node manager. Exiting from the application");
            System.exit(SpringApplication.exit(applicationContext));
        }
        networkService.setRecoveryServerAddress(zerospendNetworkNodeData.getHttpFullAddress());
        communicationService.addSubscription(zerospendNetworkNodeData.getPropagationFullAddress(), NodeType.ZeroSpendServer);
        networkService.addListToSubscription(networkService.getMapFromFactory(NodeType.DspNode).values());
        if (networkService.getSingleNodeData(NodeType.FinancialServer) != null) {
            networkService.addListToSubscription(new ArrayList<>(Collections.singletonList(networkService.getSingleNodeData(NodeType.FinancialServer))));
        }
        super.initServices();
    } catch (CotiRunTimeException e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        e.logMessage();
        System.exit(SpringApplication.exit(applicationContext));
    } catch (Exception e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        log.error("{}: {}", e.getClreplaced().getName(), e.getMessage());
        System.exit(SpringApplication.exit(applicationContext));
    }
}

19 View Source File : InitializationService.java
License : GNU General Public License v3.0
Project Creator : coti-io

@PostConstruct
@Override
public void init() {
    try {
        super.init();
        super.initDB();
        super.createNetworkNodeData();
        super.getNetwork();
        publisherNodeTypeToMessageTypesMap.put(NodeType.ZeroSpendServer, Arrays.asList(TransactionData.clreplaced, DspConsensusResult.clreplaced));
        publisherNodeTypeToMessageTypesMap.put(NodeType.FinancialServer, Collections.singletonList(TransactionData.clreplaced));
        communicationService.initSubscriber(NodeType.HistoryNode, publisherNodeTypeToMessageTypesMap);
        NetworkNodeData zerospendNetworkNodeData = networkService.getSingleNodeData(NodeType.ZeroSpendServer);
        if (zerospendNetworkNodeData == null) {
            log.error("No zerospend server exists in the network got from the node manager, about to exit application");
            System.exit(SpringApplication.exit(applicationContext));
        }
        networkService.setRecoveryServerAddress(zerospendNetworkNodeData.getHttpFullAddress());
        communicationService.addSubscription(zerospendNetworkNodeData.getPropagationFullAddress(), NodeType.ZeroSpendServer);
        networkService.addListToSubscription(networkService.getMapFromFactory(NodeType.DspNode).values());
        if (networkService.getSingleNodeData(NodeType.FinancialServer) != null) {
            networkService.addListToSubscription(new ArrayList<>(Collections.singletonList(networkService.getSingleNodeData(NodeType.FinancialServer))));
        }
        super.initServices();
    } catch (CotiRunTimeException e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        e.logMessage();
        System.exit(SpringApplication.exit(applicationContext));
    } catch (Exception e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        log.error("{}: {}", e.getClreplaced().getName(), e.getMessage());
        System.exit(SpringApplication.exit(applicationContext));
    }
}

19 View Source File : InitializationService.java
License : GNU General Public License v3.0
Project Creator : coti-io

protected NetworkNodeData createNodeProperties() {
    FeeData feeData = new FeeData(nodeFee, minimumFee, maximumFee);
    if (networkService.validateFeeData(feeData)) {
        NetworkNodeData networkNodeData = new NetworkNodeData(NodeType.FullNode, version, nodeIp, serverPort, NodeCryptoHelper.getNodeHash(), networkType);
        networkNodeData.setFeeData(feeData);
        networkNodeData.setWebServerUrl(webServerUrl);
        return networkNodeData;
    }
    log.error("Fee Data is invalid, please fix fee properties by following coti instructions. Shutting down the server!");
    System.exit(SpringApplication.exit(applicationContext));
    return null;
}

19 View Source File : InitializationService.java
License : GNU General Public License v3.0
Project Creator : coti-io

@PostConstruct
@Override
public void init() {
    try {
        super.init();
        super.initDB();
        super.createNetworkNodeData();
        super.getNetwork();
        publisherNodeTypeToMessageTypesMap.put(NodeType.ZeroSpendServer, Arrays.asList(TransactionData.clreplaced, DspConsensusResult.clreplaced));
        publisherNodeTypeToMessageTypesMap.put(NodeType.FinancialServer, Collections.singletonList(TransactionData.clreplaced));
        communicationService.initSubscriber(NodeType.DspNode, publisherNodeTypeToMessageTypesMap);
        NetworkNodeData zerospendNetworkNodeData = networkService.getSingleNodeData(NodeType.ZeroSpendServer);
        if (zerospendNetworkNodeData == null) {
            log.error("No zerospend server exists in the network got from the node manager, about to exit application");
            System.exit(SpringApplication.exit(applicationContext));
        }
        networkService.setRecoveryServerAddress(zerospendNetworkNodeData.getHttpFullAddress());
        communicationService.initPublisher(propagationPort, NodeType.DspNode);
        HashMap<String, Consumer<IPropagatable>> clreplacedNameToReceiverHandlerMapping = new HashMap<>();
        clreplacedNameToReceiverHandlerMapping.put(TransactionData.clreplaced.getName(), data -> transactionService.handleNewTransactionFromFullNode((TransactionData) data));
        clreplacedNameToReceiverHandlerMapping.put(AddressData.clreplaced.getName(), data -> addressService.handleNewAddressFromFullNode((AddressData) data));
        communicationService.initReceiver(receivingPort, clreplacedNameToReceiverHandlerMapping);
        communicationService.addSender(zerospendNetworkNodeData.getReceivingFullAddress(), NodeType.ZeroSpendServer);
        communicationService.addSubscription(zerospendNetworkNodeData.getPropagationFullAddress(), NodeType.ZeroSpendServer);
        List<NetworkNodeData> dspNetworkNodeDataList = networkService.getMapFromFactory(NodeType.DspNode).values().stream().filter(dspNode -> !dspNode.equals(networkService.getNetworkNodeData())).collect(Collectors.toList());
        networkService.addListToSubscription(dspNetworkNodeDataList);
        if (networkService.getSingleNodeData(NodeType.FinancialServer) != null) {
            networkService.addListToSubscription(new ArrayList<>(Collections.singletonList(networkService.getSingleNodeData(NodeType.FinancialServer))));
        }
        super.initServices();
        messageReceiver.initReceiverHandler();
    } catch (CotiRunTimeException e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        e.logMessage();
        System.exit(SpringApplication.exit(applicationContext));
    } catch (Exception e) {
        log.error("Errors at {}", this.getClreplaced().getSimpleName());
        log.error("{}: {}", e.getClreplaced().getName(), e.getMessage());
        System.exit(SpringApplication.exit(applicationContext));
    }
}

19 View Source File : FlinkExecutor.java
License : MIT License
Project Creator : btleedev

private void conditionallyExitSpringApp(int exitCode) {
    if (flinkProperties.isTerminate()) {
        log.info("Terminating flink spring application with application code " + exitCode);
        System.exit(SpringApplication.exit(appCtx, (ExitCodeGenerator) () -> exitCode));
    }
}

19 View Source File : ServerTcpHandler.java
License : MIT License
Project Creator : bitkylin

/**
 * Netty 服务器优雅关闭
 */
public void shutdown() {
    for (int i = 1; i <= DeviceSetting.MAX_GROUP_ID; ++i) {
        this.tcpPresenter.removeChannel(i);
    }
    System.exit(SpringApplication.exit(appContext));
}

19 View Source File : DemoApplication.java
License : Apache License 2.0
Project Creator : arangodb

public static void main(final String... args) {
    final Clreplaced<?>[] runner = new Clreplaced<?>[] { CrudRunner.clreplaced, ByExampleRunner.clreplaced, DerivedQueryRunner.clreplaced, RelationsRunner.clreplaced, AQLRunner.clreplaced, GeospatialRunner.clreplaced };
    System.exit(SpringApplication.exit(SpringApplication.run(runner, args)));
}

See More Examples