Search in sources :

Example 1 with OSignalHandler

use of com.orientechnologies.orient.core.OSignalHandler in project orientdb by orientechnologies.

the class OConsoleDatabaseApp method main.

public static void main(final String[] args) {
    int result = 0;
    try {
        boolean tty = false;
        try {
            if (setTerminalToCBreak())
                tty = true;
            Runtime.getRuntime().addShutdownHook(new Thread() {

                @Override
                public void run() {
                    restoreTerminal();
                }
            });
        } catch (Exception ignored) {
        }
        new OSignalHandler().installDefaultSignals(new SignalHandler() {

            public void handle(Signal signal) {
                restoreTerminal();
            }
        });
        final OConsoleDatabaseApp console = new OConsoleDatabaseApp(args);
        if (tty)
            console.setReader(new TTYConsoleReader());
        result = console.run();
    } finally {
        restoreTerminal();
    }
    Orient.instance().shutdown();
    System.exit(result);
}
Also used : Signal(sun.misc.Signal) TTYConsoleReader(com.orientechnologies.common.console.TTYConsoleReader) OSignalHandler(com.orientechnologies.orient.core.OSignalHandler) SignalHandler(sun.misc.SignalHandler) OSystemException(com.orientechnologies.common.exception.OSystemException) OConfigurationException(com.orientechnologies.orient.core.exception.OConfigurationException) ORetryQueryException(com.orientechnologies.orient.core.exception.ORetryQueryException) OIOException(com.orientechnologies.common.io.OIOException) ODatabaseException(com.orientechnologies.orient.core.exception.ODatabaseException) OSignalHandler(com.orientechnologies.orient.core.OSignalHandler)

Aggregations

TTYConsoleReader (com.orientechnologies.common.console.TTYConsoleReader)1 OSystemException (com.orientechnologies.common.exception.OSystemException)1 OIOException (com.orientechnologies.common.io.OIOException)1 OSignalHandler (com.orientechnologies.orient.core.OSignalHandler)1 OConfigurationException (com.orientechnologies.orient.core.exception.OConfigurationException)1 ODatabaseException (com.orientechnologies.orient.core.exception.ODatabaseException)1 ORetryQueryException (com.orientechnologies.orient.core.exception.ORetryQueryException)1 Signal (sun.misc.Signal)1 SignalHandler (sun.misc.SignalHandler)1