test_class.file: rxjava/src/test/java/io/reactivex/internal/operators/flowable/FlowablePublishTest.java
test_class.identifier: FlowablePublishTest
test_case.body: @Test
      public void noErrorLoss() {
          List<Throwable> errors = TestHelper.trackPluginErrors();
          try {
              ConnectableFlowable<Object> cf = Flowable.error(new TestException()).publish();
  
              cf.connect();
  
              TestHelper.assertUndeliverable(errors, 0, TestException.class);
          } finally {
              RxJavaPlugins.reset();
          }
      }
test_case.class_method_signature: FlowablePublishTest.noErrorLoss()
test_case.full_signature: @Test public void noErrorLoss()
test_case.identifier: noErrorLoss
test_case.invocations: trackPluginErrors publish error connect assertUndeliverable reset
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void noErrorLoss()
focal_class.declarator: CANCELLED = Long.MIN_VALUE
focal_class.modifier: static final
focal_class.original_string: static final long CANCELLED = Long.MIN_VALUE;
focal_class.type: long
focal_class.var_name: CANCELLED
focal_class.declarator: source
focal_class.modifier: final
focal_class.original_string: final Flowable<T> source;
focal_class.type: Flowable<T>
focal_class.var_name: source
focal_class.declarator: current
focal_class.modifier: final
focal_class.original_string: final AtomicReference<PublishSubscriber<T>> current;
focal_class.type: AtomicReference<PublishSubscriber<T>>
focal_class.var_name: current
focal_class.declarator: bufferSize
focal_class.modifier: final
focal_class.original_string: final int bufferSize;
focal_class.type: int
focal_class.var_name: bufferSize
focal_class.declarator: onSubscribe
focal_class.modifier: final
focal_class.original_string: final Publisher<T> onSubscribe;
focal_class.type: Publisher<T>
focal_class.var_name: onSubscribe
focal_class.file: rxjava/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublish.java
focal_class.identifier: FlowablePublish
focal_class.interfaces: implements HasUpstreamPublisher<T>
focal_class.class_method_signature: FlowablePublish.create(Flowable<T> source, final int bufferSize)
focal_class.full_signature: public static ConnectableFlowable<T> create(Flowable<T> source, final int bufferSize)
focal_class.identifier: create
focal_class.modifiers: public static
focal_class.parameters: (Flowable<T> source, final int bufferSize)
focal_class.return: ConnectableFlowable<T>
focal_class.signature: ConnectableFlowable<T> create(Flowable<T> source, final int bufferSize)
focal_class.class_method_signature: FlowablePublish.FlowablePublish(Publisher<T> onSubscribe, Flowable<T> source,
              final AtomicReference<PublishSubscriber<T>> current, int bufferSize)
focal_class.full_signature: private  FlowablePublish(Publisher<T> onSubscribe, Flowable<T> source,
              final AtomicReference<PublishSubscriber<T>> current, int bufferSize)
focal_class.identifier: FlowablePublish
focal_class.modifiers: private
focal_class.parameters: (Publisher<T> onSubscribe, Flowable<T> source,
              final AtomicReference<PublishSubscriber<T>> current, int bufferSize)
focal_class.signature:  FlowablePublish(Publisher<T> onSubscribe, Flowable<T> source,
              final AtomicReference<PublishSubscriber<T>> current, int bufferSize)
focal_class.class_method_signature: FlowablePublish.source()
focal_class.full_signature: @Override public Publisher<T> source()
focal_class.identifier: source
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Publisher<T>
focal_class.signature: Publisher<T> source()
focal_class.class_method_signature: FlowablePublish.subscribeActual(Subscriber<? super T> s)
focal_class.full_signature: @Override protected void subscribeActual(Subscriber<? super T> s)
focal_class.identifier: subscribeActual
focal_class.modifiers: @Override protected
focal_class.parameters: (Subscriber<? super T> s)
focal_class.return: void
focal_class.signature: void subscribeActual(Subscriber<? super T> s)
focal_class.class_method_signature: FlowablePublish.connect(Consumer<? super Disposable> connection)
focal_class.full_signature: @Override public void connect(Consumer<? super Disposable> connection)
focal_class.identifier: connect
focal_class.modifiers: @Override public
focal_class.parameters: (Consumer<? super Disposable> connection)
focal_class.return: void
focal_class.signature: void connect(Consumer<? super Disposable> connection)
focal_class.superclass: extends ConnectableFlowable<T>
focal_method.body: @Override
      public void connect(Consumer<? super Disposable> connection) {
          boolean doConnect;
          PublishSubscriber<T> ps;
          // we loop because concurrent connect/disconnect and termination may change the state
          for (;;) {
              // retrieve the current subscriber-to-source instance
              ps = current.get();
              // if there is none yet or the current has been disposed
              if (ps == null || ps.isDisposed()) {
                  // create a new subscriber-to-source
                  PublishSubscriber<T> u = new PublishSubscriber<T>(current, bufferSize);
                  // try setting it as the current subscriber-to-source
                  if (!current.compareAndSet(ps, u)) {
                      // did not work, perhaps a new subscriber arrived
                      // and created a new subscriber-to-source as well, retry
                      continue;
                  }
                  ps = u;
              }
              // if connect() was called concurrently, only one of them should actually
              // connect to the source
              doConnect = !ps.shouldConnect.get() && ps.shouldConnect.compareAndSet(false, true);
              break; // NOPMD
          }
          /*
           * Notify the callback that we have a (new) connection which it can dispose
           * but since ps is unique to a connection, multiple calls to connect() will return the
           * same Subscription and even if there was a connect-disconnect-connect pair, the older
           * references won't disconnect the newer connection.
           * Synchronous source consumers have the opportunity to disconnect via dispose on the
           * Disposable as subscribe() may never return on its own.
           *
           * Note however, that asynchronously disconnecting a running source might leave
           * child subscribers without any terminal event; PublishProcessor does not have this
           * issue because the cancellation was always triggered by the child subscribers
           * themselves.
           */
          try {
              connection.accept(ps);
          } catch (Throwable ex) {
              Exceptions.throwIfFatal(ex);
              throw ExceptionHelper.wrapOrThrow(ex);
          }
          if (doConnect) {
              source.subscribe(ps);
          }
      }
focal_method.class_method_signature: FlowablePublish.connect(Consumer<? super Disposable> connection)
focal_method.full_signature: @Override public void connect(Consumer<? super Disposable> connection)
focal_method.identifier: connect
focal_method.invocations: get isDisposed compareAndSet get compareAndSet accept throwIfFatal wrapOrThrow subscribe
focal_method.modifiers: @Override public
focal_method.parameters: (Consumer<? super Disposable> connection)
focal_method.return: void
focal_method.signature: void connect(Consumer<? super Disposable> connection)