/** * Abort the daemon */ public static void abortSystem() { DaemonStarter.abortSystem(null); }
public static void main(String[] args) { DaemonStarter.stopService(); } }
private static void notifyStopped() { DaemonStarter.currentPhase.set(LifecyclePhase.STOPPED); DaemonStarter.rlog.info("{} stopped!", DaemonStarter.daemonName); DaemonStarter.getLifecycleListener().stopped(); }
private static void notifyStarted() { DaemonStarter.currentPhase.set(LifecyclePhase.STARTED); DaemonStarter.rlog.info("{} started!", DaemonStarter.daemonName); DaemonStarter.getLifecycleListener().started(); }
private static void logStartupInfo() { if (DaemonStarter.isDevelopmentMode()) { DaemonStarter.rlog.info("Running in development mode"); } else { DaemonStarter.rlog.info("Running in production mode"); } DaemonStarter.rlog.info("Running with instance id: {}", DaemonStarter.instanceId); DaemonStarter.rlog.info("Running on host: {}", DaemonStarter.hostname); }
@Override public void exception(final LifecyclePhase phase, final Throwable exception) { // override in subclass when needed System.err.println("Exception in phase: " + phase.name()); exception.printStackTrace(); }
@Override public void handle(final Signal arg0) { System.out.println("SIG USR2"); DaemonStarter.getLifecycleListener().signalUSR2(); } });
/** * Starts the daemon and provides feedback through the life-cycle listener<br> * <br> * * @param _daemonName the name of this daemon * @param _lifecycleListener the {@link IDaemonLifecycleListener} to use for phase call-backs */ public static void startDaemon(final String _daemonName, final IDaemonLifecycleListener _lifecycleListener) { // Run de.taimos.daemon async Executors.newSingleThreadExecutor().execute(() -> DaemonStarter.doStartDaemon(_daemonName, _lifecycleListener)); }
public static void start(String serviceName, DvalinLifecycleAdapter lifecycleAdapter) { lifecycleAdapter.setupLogging(); DaemonStarter.startDaemon(serviceName, lifecycleAdapter); }
private static void notifyStopped() { DaemonStarter.currentPhase.set(LifecyclePhase.STOPPED); DaemonStarter.rlog.info(DaemonStarter.daemonName + " stopped!"); DaemonStarter.getLifecycleListener().stopped(); }
private static void notifyStarted() { DaemonStarter.currentPhase.set(LifecyclePhase.STARTED); DaemonStarter.rlog.info(DaemonStarter.daemonName + " started!"); DaemonStarter.getLifecycleListener().started(); }
public static void main(String[] args) { DaemonStarter.stopService(); } }
/** * Abort the daemon */ public static void abortSystem() { DaemonStarter.abortSystem(null); }
private static void logStartupInfo() { if (DaemonStarter.isDevelopmentMode()) { DaemonStarter.rlog.info("Running in development mode"); } else { DaemonStarter.rlog.info("Running in production mode: " + DaemonStarter.startupMode.get()); } DaemonStarter.rlog.info("Running with instance id: " + DaemonStarter.instanceId); DaemonStarter.rlog.info("Running on host: " + DaemonStarter.hostname); }
@Override public void exception(final LifecyclePhase phase, final Throwable exception) { // override in subclass when needed System.err.println("Exception in phase: " + phase.name()); exception.printStackTrace(); }
@Override public void handle(final Signal arg0) { System.out.println("SIG TERM"); DaemonStarter.stopService(); } });
@Override public void handle(final Signal arg0) { System.out.println("SIG INT"); DaemonStarter.stopService(); } });