src/main/java/org/funz/calculator/Calculator.java
boolean run() {
        if (NetworkListener.getState().equals(State.NEW)) {
            NetworkListener.start();
        }

        while (!askToStop) {
            // notify hosts
            checkAvailability();
            boolean restart = checkConf();
            if (restart) {
                log("(!) Ask for restart...");
                return true;
            }

            for (int i = 0; i < _hosts.length; i++) {
                Host h = _hosts[i];
                if (h != null && !h.connected) {
                    h.ping();
                }
            }
            try {
                Thread.sleep(PING_PERIOD); // Let time between ping
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }
        log("Quit run loop");
        return false;
    }
/**
     * main loop
     *
     * @return restart or not
     */
main loop
@return restart or not
main loop @return restart or not
boolean run() {
        if (NetworkListener.getState().equals(State.NEW)) {
            NetworkListener.start();
        }
        while (!askToStop) {
            checkAvailability();
            boolean restart = checkConf();
            if (restart) {
                log("(!) Ask for restart...");
                return true;
            }
            for (int i = 0; i < _hosts.length; i++) {
                Host h = _hosts[i];
                if (h != null && !h.connected) {
                    h.ping();
                }
            }
            try {
                Thread.sleep(PING_PERIOD); 
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }
        log("Quit run loop");
        return false;
    }
boolean run ( ) { if ( NetworkListener . getState ( ) . equals ( State . NEW ) ) { NetworkListener . start ( ) ; } while ( ! askToStop ) { checkAvailability ( ) ; boolean restart = checkConf ( ) ; if ( restart ) { log ( "(!) Ask for restart..." ) ; return true ; } for ( int i = 0 ; i < _hosts . length ; i ++ ) { Host h = _hosts [ i ] ; if ( h != null && ! h . connected ) { h . ping ( ) ; } } try { Thread . sleep ( PING_PERIOD ) ; } catch ( Exception ee ) { ee . printStackTrace ( ) ; } } log ( "Quit run loop" ) ; return false ; }
main loop
 @return restart or not
main loop @return restart or not
// notify hosts // Let time between ping