本文整理汇总了Java中io.reactivex.CompletableEmitter.isDisposed方法的典型用法代码示例。如果您正苦于以下问题:Java CompletableEmitter.isDisposed方法的具体用法?Java CompletableEmitter.isDisposed怎么用?Java CompletableEmitter.isDisposed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.CompletableEmitter
的用法示例。
在下文中一共展示了CompletableEmitter.isDisposed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<T> listener = new OnCompleteListener<T>() {
@Override
public void onComplete(@NonNull Task<T> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
database.runTransaction(transaction).addOnCompleteListener(listener);
}
示例2: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
batch.commit().addOnCompleteListener(listener);
}
示例3: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
reference.set(value).addOnCompleteListener(listener);
}
示例4: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
reference.delete().addOnCompleteListener(listener);
}
示例5: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<DocumentReference> listener =
new OnCompleteListener<DocumentReference>() {
@Override
public void onComplete(@NonNull Task<DocumentReference> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
reference.add(value).addOnCompleteListener(listener);
}
示例6: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
reference.update(updates).addOnCompleteListener(listener);
}
示例7: listener
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
/**
* @param emit
* @param <R>
* @return
*/
@NonNull
@CheckReturnValue
public static <R> OnCompleteListener<R> listener(@NonNull final CompletableEmitter emit) {
return new OnCompleteListener<R>() {
@Override
public void onComplete(@NonNull final Task<R> task) {
if (!emit.isDisposed()) {
if (task.isSuccessful()) {
emit.onComplete();
} else {
Exception e = task.getException();
emit.onError(e != null ? e : new RuntimeException());
}
}
}
};
}
示例8: listener
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
public static OnCompleteListener<Void> listener(@NonNull final CompletableEmitter emitter) {
return new OnCompleteListener<Void>() {
@Override public void onComplete(@NonNull Task<Void> task) {
if (!task.isSuccessful()) {
if (!emitter.isDisposed()) {
emitter.onError(task.getException());
}
return;
}
if (!emitter.isDisposed()) {
emitter.onComplete();
}
}
};
}
示例9: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override public void subscribe(final CompletableEmitter emitter) {
final Transaction.Handler handler = new Transaction.Handler() {
@Override public Transaction.Result doTransaction(MutableData mutableData) {
try {
return task.apply(mutableData);
} catch (Exception e) {
//TODO: Is this enough?
throw new RuntimeException(e);
}
}
@Override public void onComplete(DatabaseError databaseError, boolean committed,
DataSnapshot dataSnapshot) {
if (!emitter.isDisposed()) {
if (null == databaseError) {
emitter.onComplete();
} else {
emitter.onError(databaseError.toException());
}
}
}
};
ref.runTransaction(handler, fireLocalEvents);
}
示例10: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(CompletableEmitter emitter) {
if (!emitter.isDisposed()) {
instance.signOut();
emitter.onComplete();
}
}
示例11: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
/**
* Delete all documents in a collection. Uses an Executor to perform work on a background
* thread. This does *not* automatically discover and delete subcollections.
*/
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (!emitter.isDisposed()) {
if (!task.isSuccessful()) {
emitter.onError(task.getException());
} else {
emitter.onComplete();
}
}
}
};
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws Exception {
// Get the first batch of documents in the collection
Query query = collectionReference.orderBy(FieldPath.documentId()).limit(batchSize);
// Get a list of deleted documents
List<DocumentSnapshot> deleted = deleteQueryBatch(query);
// While the deleted documents in the last batch indicate that there
// may still be more documents in the collection, page down to the
// next batch and delete again
while (deleted.size() >= batchSize) {
// Move the query cursor to start after the last doc in the batch
DocumentSnapshot last = deleted.get(deleted.size() - 1);
query = collectionReference.orderBy(FieldPath.documentId())
.startAfter(last.getId())
.limit(batchSize);
deleted = deleteQueryBatch(query);
}
return null;
}
};
Tasks.call(executor, callable).addOnCompleteListener(listener);
}
示例12: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override public void subscribe(CompletableEmitter emitter) {
if (!emitter.isDisposed()) {
instance.applyActionCode(code).addOnCompleteListener(GmsTaskListeners.listener(emitter));
}
}
示例13: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override public void subscribe(CompletableEmitter emitter) {
if (!emitter.isDisposed()) {
instance.confirmPasswordReset(code, newPassword)
.addOnCompleteListener(GmsTaskListeners.listener(emitter));
}
}
示例14: subscribe
import io.reactivex.CompletableEmitter; //导入方法依赖的package包/类
@Override public void subscribe(CompletableEmitter emitter) {
if (!emitter.isDisposed()) {
instance.signOut();
emitter.onComplete();
}
}