Search in sources :

Example 1 with ExhibitorCreator

use of com.netflix.exhibitor.standalone.ExhibitorCreator in project exhibitor by soabase.

the class ExhibitorServletContextListener method contextInitialized.

@Override
public void contextInitialized(ServletContextEvent event) {
    Map<String, String> argsBuilder = makeArgsBuilder();
    try {
        exhibitorCreator = new ExhibitorCreator(toArgsArray(argsBuilder));
        exhibitor = new Exhibitor(exhibitorCreator.getConfigProvider(), null, exhibitorCreator.getBackupProvider(), exhibitorCreator.getBuilder().build());
        exhibitor.start();
        event.getServletContext().setAttribute(ExhibitorServletContextListener.class.getName(), exhibitor);
    } catch (MissingConfigurationTypeException exit) {
        log.error("Configuration type (" + OUR_PREFIX + ExhibitorCLI.CONFIG_TYPE + ") must be specified");
        exit.getCli().logHelp(OUR_PREFIX);
        throw new RuntimeException(exit);
    } catch (ExhibitorCreatorExit exit) {
        if (exit.getError() != null) {
            log.error(exit.getError());
        }
        exit.getCli().logHelp(OUR_PREFIX);
        throw new RuntimeException(exit);
    } catch (Exception e) {
        log.error("Trying to create Exhibitor", e);
        throw new RuntimeException(e);
    }
}
Also used : ExhibitorCreator(com.netflix.exhibitor.standalone.ExhibitorCreator) MissingConfigurationTypeException(com.netflix.exhibitor.standalone.MissingConfigurationTypeException) Exhibitor(com.netflix.exhibitor.core.Exhibitor) ExhibitorCreatorExit(com.netflix.exhibitor.standalone.ExhibitorCreatorExit) IOException(java.io.IOException) MissingConfigurationTypeException(com.netflix.exhibitor.standalone.MissingConfigurationTypeException)

Example 2 with ExhibitorCreator

use of com.netflix.exhibitor.standalone.ExhibitorCreator in project exhibitor by soabase.

the class ExhibitorMain method main.

public static void main(String[] args) throws Exception {
    ExhibitorCreator creator;
    try {
        creator = new ExhibitorCreator(args);
    } catch (ExhibitorCreatorExit exit) {
        if (exit.getError() != null) {
            System.err.println(exit.getError());
        }
        exit.getCli().printHelp();
        return;
    }
    SecurityArguments securityArguments = new SecurityArguments(creator.getSecurityFile(), creator.getRealmSpec(), creator.getRemoteAuthSpec());
    ExhibitorMain exhibitorMain = new ExhibitorMain(creator.getBackupProvider(), creator.getConfigProvider(), creator.getBuilder(), creator.getHttpPort(), creator.getSecurityHandler(), securityArguments);
    setShutdown(exhibitorMain);
    exhibitorMain.start();
    try {
        exhibitorMain.join();
    } finally {
        exhibitorMain.close();
        for (Closeable closeable : creator.getCloseables()) {
            CloseableUtils.closeQuietly(closeable);
        }
    }
}
Also used : ExhibitorCreator(com.netflix.exhibitor.standalone.ExhibitorCreator) SecurityArguments(com.netflix.exhibitor.standalone.SecurityArguments) Closeable(java.io.Closeable) ExhibitorCreatorExit(com.netflix.exhibitor.standalone.ExhibitorCreatorExit)

Aggregations

ExhibitorCreator (com.netflix.exhibitor.standalone.ExhibitorCreator)2 ExhibitorCreatorExit (com.netflix.exhibitor.standalone.ExhibitorCreatorExit)2 Exhibitor (com.netflix.exhibitor.core.Exhibitor)1 MissingConfigurationTypeException (com.netflix.exhibitor.standalone.MissingConfigurationTypeException)1 SecurityArguments (com.netflix.exhibitor.standalone.SecurityArguments)1 Closeable (java.io.Closeable)1 IOException (java.io.IOException)1