Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added @experimental annotations
  • Loading branch information
akarnokd committed Jun 1, 2016
commit 1c1f37d85ea6983688929d79d171219b6d007694
6 changes: 5 additions & 1 deletion src/main/java/rx/observers/SafeCompletableSubscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
package rx.observers;

import rx.Completable.CompletableSubscriber;
import rx.exceptions.*;
import rx.Subscription;
import rx.annotations.Experimental;
import rx.exceptions.*;
import rx.internal.util.RxJavaPluginUtils;

/**
* Wraps another CompletableSubscriber and handles exceptions thrown
* from onError and onCompleted.
*
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public final class SafeCompletableSubscriber implements CompletableSubscriber, Subscription {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Experimental

final CompletableSubscriber actual;

Expand Down
26 changes: 15 additions & 11 deletions src/main/java/rx/plugins/RxJavaCompletableExecutionHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package rx.plugins;

import rx.*;
import rx.annotations.Experimental;
import rx.functions.Func1;

/**
Expand All @@ -34,7 +35,9 @@
* should be fast. If anything time-consuming is to be done it should be spawned asynchronously onto separate
* worker threads.
*
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public abstract class RxJavaCompletableExecutionHook {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Experimental

/**
* Invoked during the construction by {@link Completable#create(Completable.CompletableOnSubscribe)}
Expand All @@ -43,11 +46,11 @@ public abstract class RxJavaCompletableExecutionHook {
* logging, metrics and other such things and pass through the function.
*
* @param f
* original {@link Completable.CompletableOnSubscribe}<{@code T}> to be executed
* @return {@link Completable.CompletableOnSubscribe} function that can be modified, decorated, replaced or just
* original {@link rx.Completable.CompletableOnSubscribe}<{@code T}> to be executed
* @return {@link rx.Completable.CompletableOnSubscribe} function that can be modified, decorated, replaced or just
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

* returned as a pass through
*/
public <T> Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubscribe f) {
public Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubscribe f) {
return f;
}

Expand All @@ -57,12 +60,13 @@ public <T> Completable.CompletableOnSubscribe onCreate(Completable.CompletableOn
* This can be used to decorate or replace the <code>onSubscribe</code> function or just perform extra
* logging, metrics and other such things and pass through the function.
*
* @param completableInstance the target completable instance
* @param onSubscribe
* original {@link Completable.CompletableOnSubscribe}<{@code T}> to be executed
* @return {@link Completable.CompletableOnSubscribe}<{@code T}> function that can be modified, decorated, replaced or just
* original {@link rx.Completable.CompletableOnSubscribe}<{@code T}> to be executed
* @return {@link rx.Completable.CompletableOnSubscribe}<{@code T}> function that can be modified, decorated, replaced or just
* returned as a pass through
*/
public <T> Completable.CompletableOnSubscribe onSubscribeStart(Completable completableInstance, final Completable.CompletableOnSubscribe onSubscribe) {
public Completable.CompletableOnSubscribe onSubscribeStart(Completable completableInstance, final Completable.CompletableOnSubscribe onSubscribe) {
// pass through by default
return onSubscribe;
}
Expand All @@ -77,7 +81,7 @@ public <T> Completable.CompletableOnSubscribe onSubscribeStart(Completable compl
* Throwable thrown by {@link Completable#subscribe(Subscriber)}
* @return Throwable that can be decorated, replaced or just returned as a pass through
*/
public <T> Throwable onSubscribeError(Throwable e) {
public Throwable onSubscribeError(Throwable e) {
// pass through by default
return e;
}
Expand All @@ -86,15 +90,15 @@ public <T> Throwable onSubscribeError(Throwable e) {
* Invoked just as the operator functions is called to bind two operations together into a new
* {@link Completable} and the return value is used as the lifted function
* <p>
* This can be used to decorate or replace the {@link Completable.CompletableOperator} instance or just perform extra
* This can be used to decorate or replace the {@link rx.Completable.CompletableOperator} instance or just perform extra
* logging, metrics and other such things and pass through the onSubscribe.
*
* @param lift
* original {@link Completable.CompletableOperator}{@code <R, T>}
* @return {@link Completable.CompletableOperator}{@code <R, T>} function that can be modified, decorated, replaced or just
* original {@link rx.Completable.CompletableOperator}{@code <R, T>}
* @return {@link rx.Completable.CompletableOperator}{@code <R, T>} function that can be modified, decorated, replaced or just
* returned as a pass through
*/
public <T, R> Completable.CompletableOperator onLift(final Completable.CompletableOperator lift) {
public Completable.CompletableOperator onLift(final Completable.CompletableOperator lift) {
return lift;
}
}
4 changes: 4 additions & 0 deletions src/main/java/rx/plugins/RxJavaPlugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public void registerSingleExecutionHook(RxJavaSingleExecutionHook impl) {
* full classname to load.
*
* @return {@link RxJavaCompletableExecutionHook} implementation to use
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public RxJavaCompletableExecutionHook getCompletableExecutionHook() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Experimental

if (completableExecutionHook.get() == null) {
// check for an implementation from System.getProperty first
Expand All @@ -247,7 +249,9 @@ public RxJavaCompletableExecutionHook getCompletableExecutionHook() {
* @throws IllegalStateException
* if called more than once or after the default was initialized (if usage occurs before trying
* to register)
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public void registerCompletableExecutionHook(RxJavaCompletableExecutionHook impl) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Experimental

if (!completableExecutionHook.compareAndSet(null, impl)) {
throw new IllegalStateException("Another strategy was already registered: " + singleExecutionHook.get());
Expand Down