private void startMonitor() {

        final ScheduledExecutorService monitor = Executors.newScheduledThreadPool(2,
                new ThreadFactory() {
                    @Override
                    public Thread newThread(Runnable runnable) {
                        Thread thread = new Thread(runnable);
                        thread.setPriority(Thread.NORM_PRIORITY + 1);
                        return thread;
                    }
                }
        );


        monitorFuture = monitor.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                monitor();
            }
        }, MONITOR_INTERVAL_SECONDS, MONITOR_INTERVAL_SECONDS, TimeUnit.SECONDS);


        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
            @Override
            public void run() {
                System.err.println("shutting down....");
                monitor();
            }
        }));


    }
private void startMonitor() {

        final ScheduledExecutorService monitor = Executors.newScheduledThreadPool(2,
                new ThreadFactory() {
                    @Override
                    public Thread newThread(Runnable runnable) {
                        Thread thread = new Thread(runnable);
                        thread.setPriority(Thread.NORM_PRIORITY + 1);
                        return thread;
                    }
                }
        );


        monitorFuture = monitor.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                monitor();
            }
        }, MONITOR_INTERVAL_SECONDS, MONITOR_INTERVAL_SECONDS, TimeUnit.SECONDS);


        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
            @Override
            public void run() {
                System.err.println("shutting down....");
                monitor();
            }
        }));


    }
private void startMonitor ( ) { final ScheduledExecutorService monitor = Executors . newScheduledThreadPool ( 2 , new ThreadFactory ( ) { @ Override public Thread newThread ( Runnable runnable ) { Thread thread = new Thread ( runnable ) ; thread . setPriority ( Thread . NORM_PRIORITY + 1 ) ; return thread ; } } ) ; monitorFuture = monitor . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { monitor ( ) ; } } , MONITOR_INTERVAL_SECONDS , MONITOR_INTERVAL_SECONDS , TimeUnit . SECONDS ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( new Runnable ( ) { @ Override public void run ( ) { System . err . println ( "shutting down...." ) ; monitor ( ) ; } } ) ) ; }
Start up the health monitor.
Start up the health monitor .