Skip to content

Commit e0b3f62

Browse files
committed
PR updates
1 parent cc15905 commit e0b3f62

File tree

7 files changed

+42
-28
lines changed

7 files changed

+42
-28
lines changed

driver-core/src/main/com/mongodb/internal/operation/ReadOperationCursor.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,11 @@
1717
package com.mongodb.internal.operation;
1818

1919
import com.mongodb.internal.async.AsyncBatchCursor;
20-
import com.mongodb.internal.async.SingleResultCallback;
21-
import com.mongodb.internal.binding.AsyncReadBinding;
22-
import com.mongodb.internal.binding.ReadBinding;
2320

2421
/**
2522
* An operation that reads from a MongoDB server and returns a cursor.
2623
*
2724
* <p>This class is not part of the public API and may be removed or changed at any time</p>
2825
*/
2926
public interface ReadOperationCursor<T> extends ReadOperation<BatchCursor<T>, AsyncBatchCursor<T>> {
30-
31-
/**
32-
* General execute which can return anything of type T
33-
*
34-
* @param binding the binding to execute in the context of
35-
* @return T, the result of the execution
36-
*/
37-
default BatchCursor<T> execute(ReadBinding binding) {
38-
throw new UnsupportedOperationException("Not implemented");
39-
}
40-
41-
/**
42-
* General execute which can return anything of type R
43-
*
44-
* @param binding the binding to execute in the context of
45-
* @param callback the callback to be called when the operation has been executed
46-
*/
47-
default void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback) {
48-
throw new UnsupportedOperationException("Not implemented");
49-
}
5027
}

driver-legacy/src/main/com/mongodb/LegacyMixedBulkWriteOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public WriteConcernResult execute(final WriteBinding binding) {
113113

114114
@Override
115115
public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<WriteConcernResult> callback) {
116-
throw new UnsupportedOperationException();
116+
throw new UnsupportedOperationException("This operation is sync only");
117117
}
118118

119119
private MongoException convertBulkWriteException(final MongoBulkWriteException e) {

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/MapReducePublisherImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private ReadOperationCursor<T> createFindOperation(final int initialBatchSize) {
224224
}
225225

226226
// this could be inlined, but giving it a name so that it's unit-testable
227-
static class WrappedMapReduceReadOperation<T> implements ReadOperationCursor<T> {
227+
static class WrappedMapReduceReadOperation<T> implements ReadOperationCursorAsyncOnly<T> {
228228
private final ReadOperation<MapReduceBatchCursor<T>, MapReduceAsyncBatchCursor<T>> operation;
229229

230230
WrappedMapReduceReadOperation(final ReadOperation<MapReduceBatchCursor<T>, MapReduceAsyncBatchCursor<T>> operation) {
@@ -259,7 +259,7 @@ WriteOperation<MapReduceStatistics> getOperation() {
259259

260260
@Override
261261
public String getCommandName() {
262-
return "mapReduce";
262+
return operation.getCommandName();
263263
}
264264

265265
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2008-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.mongodb.reactivestreams.client.internal;
18+
19+
import com.mongodb.internal.binding.ReadBinding;
20+
import com.mongodb.internal.operation.BatchCursor;
21+
import com.mongodb.internal.operation.ReadOperationCursor;
22+
23+
public interface ReadOperationCursorAsyncOnly<T> extends ReadOperationCursor<T> {
24+
25+
default BatchCursor<T> execute(final ReadBinding binding) {
26+
throw new UnsupportedOperationException("This operation is async only");
27+
}
28+
29+
}

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/VoidReadOperationThenCursorReadOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.mongodb.internal.operation.ReadOperationCursor;
2323
import com.mongodb.internal.operation.ReadOperationSimple;
2424

25-
class VoidReadOperationThenCursorReadOperation<T> implements ReadOperationCursor<T> {
25+
class VoidReadOperationThenCursorReadOperation<T> implements ReadOperationCursorAsyncOnly<T> {
2626
private final ReadOperationSimple<Void> readOperation;
2727
private final ReadOperationCursor<T> cursorReadOperation;
2828

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/VoidWriteOperationThenCursorReadOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.mongodb.internal.operation.ReadOperationCursor;
2424
import com.mongodb.internal.operation.WriteOperation;
2525

26-
class VoidWriteOperationThenCursorReadOperation<T> implements ReadOperationCursor<T> {
26+
class VoidWriteOperationThenCursorReadOperation<T> implements ReadOperationCursorAsyncOnly<T> {
2727
private final WriteOperation<Void> writeOperation;
2828
private final ReadOperationCursor<T> cursorReadOperation;
2929

driver-sync/src/main/com/mongodb/client/internal/MapReduceIterableImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
import com.mongodb.client.cursor.TimeoutMode;
2525
import com.mongodb.client.model.Collation;
2626
import com.mongodb.internal.TimeoutSettings;
27+
import com.mongodb.internal.async.AsyncBatchCursor;
28+
import com.mongodb.internal.async.SingleResultCallback;
29+
import com.mongodb.internal.binding.AsyncReadBinding;
2730
import com.mongodb.internal.binding.ReadBinding;
2831
import com.mongodb.internal.client.model.FindOptions;
2932
import com.mongodb.internal.operation.BatchCursor;
@@ -241,5 +244,10 @@ public String getCommandName() {
241244
public BatchCursor<TResult> execute(final ReadBinding binding) {
242245
return operation.execute(binding);
243246
}
247+
248+
@Override
249+
public void executeAsync(final AsyncReadBinding binding, final SingleResultCallback<AsyncBatchCursor<TResult>> callback) {
250+
throw new UnsupportedOperationException("This operation is sync only");
251+
}
244252
}
245253
}

0 commit comments

Comments
 (0)