Skip to content

1.x: Remove 'Completable' prefix from nested interfaces, move its subscription to top-level. #4425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
284 changes: 204 additions & 80 deletions src/main/java/rx/Completable.java

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/main/java/rx/CompletableSubscriber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2016 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rx;

import rx.annotations.Experimental;

/**
* Represents the subscription API callbacks when subscribing to a Completable instance.
*/
@Experimental
public interface CompletableSubscriber {
/**
* Called once the deferred computation completes normally.
*/
void onCompleted();

/**
* Called once if the deferred computation 'throws' an exception.
* @param e the exception, not null.
*/
void onError(Throwable e);

/**
* Called once by the Completable to set a Subscription on this instance which
* then can be used to cancel the subscription at any time.
* @param d the Subscription instance to call dispose on for cancellation, not null
*/
void onSubscribe(Subscription d);
}
2 changes: 1 addition & 1 deletion src/main/java/rx/Single.java
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ public void onCompleted() {
}
};

final Completable.CompletableSubscriber so = new Completable.CompletableSubscriber() {
final CompletableSubscriber so = new CompletableSubscriber() {
@Override
public void onCompleted() {
onError(new CancellationException("Stream was canceled before emitting a terminal event."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
package rx.internal.operators;

import rx.Completable;
import rx.Completable.CompletableOnSubscribe;
import rx.Completable.CompletableSubscriber;
import rx.Completable.OnSubscribe;
import rx.CompletableSubscriber;
import rx.Single;
import rx.SingleSubscriber;
import rx.Subscription;
import rx.exceptions.Exceptions;
import rx.functions.Func1;

public final class CompletableFlatMapSingleToCompletable<T> implements CompletableOnSubscribe {
public final class CompletableFlatMapSingleToCompletable<T> implements OnSubscribe {

final Single<T> source;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import java.util.concurrent.atomic.*;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.exceptions.MissingBackpressureException;
import rx.internal.util.unsafe.SpscArrayQueue;
import rx.plugins.RxJavaHooks;
import rx.subscriptions.SerialSubscription;

public final class CompletableOnSubscribeConcat implements CompletableOnSubscribe {
public final class CompletableOnSubscribeConcat implements OnSubscribe {
final Observable<Completable> sources;
final int prefetch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.util.concurrent.atomic.AtomicInteger;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.subscriptions.SerialSubscription;

public final class CompletableOnSubscribeConcatArray implements CompletableOnSubscribe {
public final class CompletableOnSubscribeConcatArray implements OnSubscribe {
final Completable[] sources;

public CompletableOnSubscribeConcatArray(Completable[] sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import java.util.concurrent.atomic.AtomicInteger;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.subscriptions.*;

public final class CompletableOnSubscribeConcatIterable implements CompletableOnSubscribe {
public final class CompletableOnSubscribeConcatIterable implements OnSubscribe {
final Iterable<? extends Completable> sources;

public CompletableOnSubscribeConcatIterable(Iterable<? extends Completable> sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import java.util.concurrent.atomic.*;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.Observable;
import rx.exceptions.CompositeException;
import rx.plugins.RxJavaHooks;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeMerge implements CompletableOnSubscribe {
public final class CompletableOnSubscribeMerge implements OnSubscribe {
final Observable<Completable> source;
final int maxConcurrency;
final boolean delayErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import java.util.concurrent.atomic.*;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.plugins.RxJavaHooks;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeMergeArray implements CompletableOnSubscribe {
public final class CompletableOnSubscribeMergeArray implements OnSubscribe {
final Completable[] sources;

public CompletableOnSubscribeMergeArray(Completable[] sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import java.util.concurrent.atomic.AtomicInteger;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeMergeDelayErrorArray implements CompletableOnSubscribe {
public final class CompletableOnSubscribeMergeDelayErrorArray implements OnSubscribe {
final Completable[] sources;

public CompletableOnSubscribeMergeDelayErrorArray(Completable[] sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import java.util.concurrent.atomic.AtomicInteger;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.internal.util.unsafe.MpscLinkedQueue;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeMergeDelayErrorIterable implements CompletableOnSubscribe {
public final class CompletableOnSubscribeMergeDelayErrorIterable implements OnSubscribe {
final Iterable<? extends Completable> sources;

public CompletableOnSubscribeMergeDelayErrorIterable(Iterable<? extends Completable> sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import java.util.concurrent.atomic.*;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.plugins.RxJavaHooks;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeMergeIterable implements CompletableOnSubscribe {
public final class CompletableOnSubscribeMergeIterable implements OnSubscribe {
final Iterable<? extends Completable> sources;

public CompletableOnSubscribeMergeIterable(Iterable<? extends Completable> sources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.util.concurrent.atomic.AtomicBoolean;

import rx.*;
import rx.Completable.*;
import rx.Completable.OnSubscribe;
import rx.functions.Action0;
import rx.plugins.RxJavaHooks;
import rx.subscriptions.CompositeSubscription;

public final class CompletableOnSubscribeTimeout implements CompletableOnSubscribe {
public final class CompletableOnSubscribeTimeout implements OnSubscribe {

final Completable source;
final long timeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package rx.internal.operators;

import rx.*;
import rx.Completable.CompletableSubscriber;
import rx.CompletableSubscriber;
import rx.exceptions.AssemblyStackTraceException;

/**
Expand All @@ -26,9 +26,9 @@
*
* @param <T> the value type
*/
public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.CompletableOnSubscribe {
public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.OnSubscribe {

final Completable.CompletableOnSubscribe source;
final Completable.OnSubscribe source;

final String stacktrace;

Expand All @@ -38,13 +38,13 @@ public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.Co
*/
public static volatile boolean fullStackTrace;

public OnSubscribeOnAssemblyCompletable(Completable.CompletableOnSubscribe source) {
public OnSubscribeOnAssemblyCompletable(Completable.OnSubscribe source) {
this.source = source;
this.stacktrace = OnSubscribeOnAssembly.createStacktrace();
}

@Override
public void call(Completable.CompletableSubscriber t) {
public void call(CompletableSubscriber t) {
source.call(new OnAssemblyCompletableSubscriber(t, stacktrace));
}

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/rx/internal/schedulers/SchedulerWhen.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
import java.util.concurrent.atomic.AtomicReference;

import rx.Completable;
import rx.Completable.CompletableOnSubscribe;
import rx.Completable.CompletableSubscriber;
import rx.Scheduler.Worker;
import rx.Completable.OnSubscribe;
import rx.CompletableSubscriber;
import rx.Observable;
import rx.Observer;
import rx.Scheduler;
Expand Down Expand Up @@ -143,7 +142,7 @@ public Worker createWorker() {
Observable<Completable> actions = actionSubject.map(new Func1<ScheduledAction, Completable>() {
@Override
public Completable call(final ScheduledAction action) {
return Completable.create(new CompletableOnSubscribe() {
return Completable.create(new OnSubscribe() {
@Override
public void call(CompletableSubscriber actionCompletable) {
actionCompletable.onSubscribe(action);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rx/observers/AsyncCompletableSubscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.concurrent.atomic.AtomicReference;

import rx.Completable.CompletableSubscriber;
import rx.CompletableSubscriber;
import rx.Subscription;
import rx.annotations.Experimental;
import rx.plugins.RxJavaHooks;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rx/observers/SafeCompletableSubscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package rx.observers;

import rx.Completable.CompletableSubscriber;
import rx.CompletableSubscriber;
import rx.Subscription;
import rx.annotations.Experimental;
import rx.exceptions.*;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/rx/plugins/RxJavaCompletableExecutionHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
@Experimental
public abstract class RxJavaCompletableExecutionHook { // NOPMD
/**
* Invoked during the construction by {@link Completable#create(Completable.CompletableOnSubscribe)}
* Invoked during the construction by {@link Completable#create(Completable.OnSubscribe)}
* <p>
* 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 f
* original {@link rx.Completable.CompletableOnSubscribe}<{@code T}> to be executed
* @return {@link rx.Completable.CompletableOnSubscribe} function that can be modified, decorated, replaced or just
* original {@link Completable.OnSubscribe}<{@code T}> to be executed
* @return {@link Completable.OnSubscribe} function that can be modified, decorated, replaced or just
* returned as a pass through
*/
@Deprecated
public Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubscribe f) {
public Completable.OnSubscribe onCreate(Completable.OnSubscribe f) {
return f;
}

Expand All @@ -63,12 +63,12 @@ public Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubs
*
* @param completableInstance the target completable instance
* @param onSubscribe
* 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
* original {@link Completable.OnSubscribe}<{@code T}> to be executed
* @return {@link Completable.OnSubscribe}<{@code T}> function that can be modified, decorated, replaced or just
* returned as a pass through
*/
@Deprecated
public Completable.CompletableOnSubscribe onSubscribeStart(Completable completableInstance, final Completable.CompletableOnSubscribe onSubscribe) {
public Completable.OnSubscribe onSubscribeStart(Completable completableInstance, final Completable.OnSubscribe onSubscribe) {
// pass through by default
return onSubscribe;
}
Expand All @@ -93,16 +93,16 @@ public 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 rx.Completable.CompletableOperator} instance or just perform extra
* This can be used to decorate or replace the {@link Completable.Operator} instance or just perform extra
* logging, metrics and other such things and pass through the onSubscribe.
*
* @param lift
* 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
* original {@link Completable.Operator}{@code <R, T>}
* @return {@link Completable.Operator}{@code <R, T>} function that can be modified, decorated, replaced or just
* returned as a pass through
*/
@Deprecated
public Completable.CompletableOperator onLift(final Completable.CompletableOperator lift) {
public Completable.Operator onLift(final Completable.Operator lift) {
return lift;
}
}
Loading