Dispatcher subscribeImpl(String subject, String queueName) {
        if (!this.running.get()) {
            throw new IllegalStateException("Dispatcher is closed");
        }
        
        if (this.isDraining()) {
            throw new IllegalStateException("Dispatcher is draining");
        }

        NatsSubscription sub = subscriptions.get(subject);

        if (sub == null) {
            sub = connection.createSubscription(subject, queueName, this);
            NatsSubscription actual = subscriptions.putIfAbsent(subject, sub);
            if (actual != null) {
                this.connection.unsubscribe(sub, -1); // Could happen on very bad timing
            }
        }

        return this;
    }
Dispatcher subscribeImpl ( String subject , String queueName ) { if ( ! this . running . get ( ) ) { throw new IllegalStateException ( "Dispatcher is closed" ) ; } if ( this . isDraining ( ) ) { throw new IllegalStateException ( "Dispatcher is draining" ) ; } NatsSubscription sub = subscriptions . get ( subject ) ; if ( sub == null ) { sub = connection . createSubscription ( subject , queueName , this ) ; NatsSubscription actual = subscriptions . putIfAbsent ( subject , sub ) ; if ( actual != null ) { this . connection . unsubscribe ( sub , - 1 ) ; } } return this ; }
Assumes the subj/queuename checks are done, does check for closed status