com.mongodb.async.SingleResultCallback Java Examples
The following examples show how to use
com.mongodb.async.SingleResultCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #2
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public <TResult> Observable<TResult> runCommand(final Bson command, final Class<TResult> clazz) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<TResult>>() { @Override public void apply(final SingleResultCallback<TResult> callback) { wrapped.runCommand(command, clazz, callback); } }), observableAdapter); }
Example #3
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public <TResult> Observable<TResult> runCommand(final Bson command, final ReadPreference readPreference, final Class<TResult> clazz) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<TResult>>() { @Override public void apply(final SingleResultCallback<TResult> callback) { wrapped.runCommand(command, readPreference, clazz, callback); } }), observableAdapter); }
Example #4
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> drop() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.drop(voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #5
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> createCollection(final String collectionName, final CreateCollectionOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.createCollection(collectionName, options, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #6
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> createView(final String viewName, final String viewOn, final List<? extends Bson> pipeline) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.createView(viewName, viewOn, pipeline, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #7
Source File: MongoDatabaseImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> createView(final String viewName, final String viewOn, final List<? extends Bson> pipeline, final CreateViewOptions createViewOptions) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.createView(viewName, viewOn, pipeline, createViewOptions, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #8
Source File: GridFSDownloadStreamImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<GridFSFile> getGridFSFile() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<GridFSFile>>() { @Override public void apply(final SingleResultCallback<GridFSFile> callback) { wrapped.getGridFSFile(callback); } }), observableAdapter); }
Example #9
Source File: GridFSDownloadStreamImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Integer> read(final ByteBuffer dst) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Integer>>() { @Override public void apply(final SingleResultCallback<Integer> callback) { wrapped.read(dst, callback); } }), observableAdapter); }
Example #10
Source File: GridFSDownloadStreamImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> close() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.close(voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #11
Source File: AggregateObservableImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> toCollection() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.toCollection(voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #12
Source File: ObservableHelper.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
/** * Helper to trigger Boolean SingleResultCallbacks for Void operations * * @param callback the boolean single result callback. * @return the results callback for an operation that returns null to signal success. */ public static SingleResultCallback<Void> voidToSuccessCallback(final SingleResultCallback<Success> callback) { return new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { callback.onResult(Success.SUCCESS, t); } }; }
Example #13
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<ObjectId> uploadFromStream(final String filename, final AsyncInputStream source) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<ObjectId>>() { @Override public void apply(final SingleResultCallback<ObjectId> callback) { wrapped.uploadFromStream(filename, toCallbackAsyncInputStream(source), callback); } }), observableAdapter); }
Example #14
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<ObjectId> uploadFromStream(final String filename, final AsyncInputStream source, final GridFSUploadOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<ObjectId>>() { @Override public void apply(final SingleResultCallback<ObjectId> callback) { wrapped.uploadFromStream(filename, toCallbackAsyncInputStream(source), options, callback); } }), observableAdapter); }
Example #15
Source File: GridFSFindObservableImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<GridFSFile> first() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<GridFSFile>>(){ @Override public void apply(final SingleResultCallback<GridFSFile> callback) { wrapped.first(callback); } }), observableAdapter); }
Example #16
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source, final GridFSUploadOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), options, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #17
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Long> downloadToStream(final ObjectId id, final AsyncOutputStream destination) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Long>>() { @Override public void apply(final SingleResultCallback<Long> callback) { wrapped.downloadToStream(id, toCallbackAsyncOutputStream(destination), callback); } }), observableAdapter); }
Example #18
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Long> downloadToStream(final BsonValue id, final AsyncOutputStream destination) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Long>>() { @Override public void apply(final SingleResultCallback<Long> callback) { wrapped.downloadToStream(id, toCallbackAsyncOutputStream(destination), callback); } }), observableAdapter); }
Example #19
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Long> downloadToStream(final String filename, final AsyncOutputStream destination) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Long>>() { @Override public void apply(final SingleResultCallback<Long> callback) { wrapped.downloadToStream(filename, toCallbackAsyncOutputStream(destination), callback); } }), observableAdapter); }
Example #20
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Long> downloadToStream(final String filename, final AsyncOutputStream destination, final GridFSDownloadOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Long>>() { @Override public void apply(final SingleResultCallback<Long> callback) { wrapped.downloadToStream(filename, toCallbackAsyncOutputStream(destination), options, callback); } }), observableAdapter); }
Example #21
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> delete(final ObjectId id) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.delete(id, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #22
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> delete(final BsonValue id) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.delete(id, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #23
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> rename(final ObjectId id, final String newFilename) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.rename(id, newFilename, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #24
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> rename(final BsonValue id, final String newFilename) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.rename(id, newFilename, voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #25
Source File: GridFSBucketImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> drop() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.drop(voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #26
Source File: FindObservableImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<TResult> first() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<TResult>>() { @Override public void apply(final SingleResultCallback<TResult> callback) { wrapped.first(callback); } }), observableAdapter); }
Example #27
Source File: MapReduceObservableImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<Success> toCollection() { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() { @Override public void apply(final SingleResultCallback<Success> callback) { wrapped.toCollection(voidToSuccessCallback(callback)); } }), observableAdapter); }
Example #28
Source File: MongoCollectionImpl.java From mongo-java-driver-rx with Apache License 2.0 | 5 votes |
@Override public Observable<DeleteResult> deleteMany(final Bson filter, final DeleteOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteMany(filter, options, callback); } }), observableAdapter); }
Example #29
Source File: MongoClientAsyncInstrumentationIT.java From apm-agent-java with Apache License 2.0 | 5 votes |
private static <T> T executeAndGet(Consumer<SingleResultCallback<T>> execution) throws ExecutionException, TimeoutException, InterruptedException { CompletableFuture<T> future = new CompletableFuture<>(); SingleResultCallback<T> callback = getCallback(future); execution.accept(callback); int TIMEOUT_IN_MILLIS = 550; return future.get(TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS); }
Example #30
Source File: MongoClientAsyncInstrumentationIT.java From apm-agent-java with Apache License 2.0 | 5 votes |
private static <T> SingleResultCallback<T> getCallback(final CompletableFuture<T> future) { return new SingleResultCallback<>() { @Override public void onResult(final T result, final Throwable t) { if (t != null) { future.completeExceptionally(t); } else { future.complete(result); } } }; }