@Test public void subscribeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final UnicastSubject<Integer> us = UnicastSubject.create(); final TestObserver<Integer> to1 = new TestObserver<Integer>(); final TestObserver<Integer> to2 = new TestObserver<Integer>(); Runnable r1 = new Runnable() { @Override public void run() { us.subscribe(to1); } }; Runnable r2 = new Runnable() { @Override public void run() { us.subscribe(to2); } }; TestHelper.race(r1, r2); if (to1.errorCount() == 0) { to2.assertFailure(IllegalStateException.class); } else if (to2.errorCount() == 0) { to1.assertFailure(IllegalStateException.class); } else { fail("Neither TestObserver failed"); } } }
@CheckReturnValue @NonNull public static <T> UnicastSubject<T> create() { return new UnicastSubject<T>(bufferSize(), true); }
UnicastSubject extends Subject<T> { @CheckReturnValue @NonNull public static <T> UnicastSubject<T> create() { return new UnicastSubject<T>(bufferSize(), true); } }
UnicastSubject extends Subject<T> { @CheckReturnValue @NonNull public static <T> UnicastSubject<T> create() { return new UnicastSubject<T>(bufferSize(), true); } UnicastSubject(int capacityHint, boolean delayError);   UnicastSubject(int capacityHint, Runnable onTerminate);   UnicastSubject(int capacityHint, Runnable onTerminate, boolean delayError); }
UnicastSubject extends Subject<T> { @CheckReturnValue @NonNull public static <T> UnicastSubject<T> create() { return new UnicastSubject<T>(bufferSize(), true); } UnicastSubject(int capacityHint, boolean delayError);   UnicastSubject(int capacityHint, Runnable onTerminate);   UnicastSubject(int capacityHint, Runnable onTerminate, boolean delayError); @CheckReturnValue @NonNull static UnicastSubject<T> create(); @CheckReturnValue @NonNull static UnicastSubject<T> create(int capacityHint); @CheckReturnValue @NonNull static UnicastSubject<T> create(int capacityHint, Runnable onTerminate); @CheckReturnValue @Experimental @NonNull static UnicastSubject<T> create(int capacityHint, Runnable onTerminate, boolean delayError); @CheckReturnValue @Experimental @NonNull static UnicastSubject<T> create(boolean delayError); @Override void onSubscribe(Disposable s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override boolean hasObservers(); @Override @Nullable Throwable getThrowable(); @Override boolean hasThrowable(); @Override boolean hasComplete(); }
UnicastSubject extends Subject<T> { @CheckReturnValue @NonNull public static <T> UnicastSubject<T> create() { return new UnicastSubject<T>(bufferSize(), true); } UnicastSubject(int capacityHint, boolean delayError);   UnicastSubject(int capacityHint, Runnable onTerminate);   UnicastSubject(int capacityHint, Runnable onTerminate, boolean delayError); @CheckReturnValue @NonNull static UnicastSubject<T> create(); @CheckReturnValue @NonNull static UnicastSubject<T> create(int capacityHint); @CheckReturnValue @NonNull static UnicastSubject<T> create(int capacityHint, Runnable onTerminate); @CheckReturnValue @Experimental @NonNull static UnicastSubject<T> create(int capacityHint, Runnable onTerminate, boolean delayError); @CheckReturnValue @Experimental @NonNull static UnicastSubject<T> create(boolean delayError); @Override void onSubscribe(Disposable s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override boolean hasObservers(); @Override @Nullable Throwable getThrowable(); @Override boolean hasThrowable(); @Override boolean hasComplete();  }