src/main/java/io/mantisrx/api/services/JobDiscoveryService.java
public Observable<JobSchedulingInfo> jobDiscoveryInfoStream() {
            init();
            return discoveryInfoBehaviorSubject
                    .doOnSubscribe(() -> {
                        if (log.isDebugEnabled()) { log.debug("Subscribed"); }
                        subscriberCount.incrementAndGet();
                        subscriberCountGauge.set(subscriberCount.get());
                        if (log.isDebugEnabled()) { log.debug("Subscriber count " + subscriberCount.get()); }
                    })
                    .doOnUnsubscribe(() -> {
                        if (log.isDebugEnabled()) {log.debug("UnSubscribed"); }
                        int subscriberCnt = subscriberCount.decrementAndGet();
                        subscriberCountGauge.set(subscriberCount.get());
                        if (log.isDebugEnabled()) { log.debug("Subscriber count " + subscriberCnt); }
                        if (0 == subscriberCount.get()) {
                            if (log.isDebugEnabled()) { log.debug("Shutting down"); }
                            close();

                        }
                    })
                    .doOnError((t) -> close())
                    ;
        }
/**
         * If a subject holding schedulingInfo for the job exists return it as an Observable
         * if not then invoke mantisClient to get an Observable of scheduling changes, write them to a Subject
         * and return it as an observable
         * Also keep track of subscription Count, When the subscription count falls to 0 unsubscribe from schedulingInfo Observable
         *
         * @return Observable of scheduling changes
         */
If a subject holding schedulingInfo for the job exists return it as an Observable
if not then invoke mantisClient to get an Observable of scheduling changes, write them to a Subject
and return it as an observable
Also keep track of subscription Count, When the subscription count falls to 0 unsubscribe from schedulingInfo Observable

@return Observable of scheduling changes
If a subject holding schedulingInfo for the job exists return it as an Observable if not then invoke mantisClient to get an Observable of scheduling changes write them to a Subject and return it as an observable Also keep track of subscription Count When the subscription count falls to 0 unsubscribe from schedulingInfo Observable @return Observable of scheduling changes
public Observable<JobSchedulingInfo> jobDiscoveryInfoStream() {
            init();
            return discoveryInfoBehaviorSubject
                    .doOnSubscribe(() -> {
                        if (log.isDebugEnabled()) { log.debug("Subscribed"); }
                        subscriberCount.incrementAndGet();
                        subscriberCountGauge.set(subscriberCount.get());
                        if (log.isDebugEnabled()) { log.debug("Subscriber count " + subscriberCount.get()); }
                    })
                    .doOnUnsubscribe(() -> {
                        if (log.isDebugEnabled()) {log.debug("UnSubscribed"); }
                        int subscriberCnt = subscriberCount.decrementAndGet();
                        subscriberCountGauge.set(subscriberCount.get());
                        if (log.isDebugEnabled()) { log.debug("Subscriber count " + subscriberCnt); }
                        if (0 == subscriberCount.get()) {
                            if (log.isDebugEnabled()) { log.debug("Shutting down"); }
                            close();
                        }
                    })
                    .doOnError((t) -> close())
                    ;
        }
public Observable < JobSchedulingInfo > jobDiscoveryInfoStream ( ) { init ( ) ; return discoveryInfoBehaviorSubject . doOnSubscribe ( ( ) -> { if ( log . isDebugEnabled ( ) ) { log . debug ( "Subscribed" ) ; } subscriberCount . incrementAndGet ( ) ; subscriberCountGauge . set ( subscriberCount . get ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Subscriber count " + subscriberCount . get ( ) ) ; } } ) . doOnUnsubscribe ( ( ) -> { if ( log . isDebugEnabled ( ) ) { log . debug ( "UnSubscribed" ) ; } int subscriberCnt = subscriberCount . decrementAndGet ( ) ; subscriberCountGauge . set ( subscriberCount . get ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Subscriber count " + subscriberCnt ) ; } if ( 0 == subscriberCount . get ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Shutting down" ) ; } close ( ) ; } } ) . doOnError ( ( t ) -> close ( ) ) ; }
If a subject holding schedulingInfo for the job exists return it as an Observable
 if not then invoke mantisClient to get an Observable of scheduling changes, write them to a Subject
 and return it as an observable
 Also keep track of subscription Count, When the subscription count falls to 0 unsubscribe from schedulingInfo Observable
If a subject holding schedulingInfo for the job exists return it as an Observable if not then invoke mantisClient to get an Observable of scheduling changes write them to a Subject and return it as an observable Also keep track of subscription Count When the subscription count falls to 0 unsubscribe from schedulingInfo Observable