public void run() {

        while (!stop) {
            long t0 = System.currentTimeMillis();

            try {
                EventConsumer.subscribeIfNotDone();
                resubscribe_if_needed();
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            catch (Error err) {
                err.printStackTrace();
            }

            long msToSleep = EVENT_HEARTBEAT_PERIOD - (System.currentTimeMillis() - t0);
            if (msToSleep<5)
                msToSleep = 5;
            waitNextLoop(msToSleep);
        }
    }
public void run ( ) { while ( ! stop ) { long t0 = System . currentTimeMillis ( ) ; try { EventConsumer . subscribeIfNotDone ( ) ; resubscribe_if_needed ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } catch ( Error err ) { err . printStackTrace ( ) ; } long msToSleep = EVENT_HEARTBEAT_PERIOD - ( System . currentTimeMillis ( ) - t0 ) ; if ( msToSleep < 5 ) msToSleep = 5 ; waitNextLoop ( msToSleep ) ; } }
===============================================================