Skip to content
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

Add AsyncOperations to match SyncOperations #1027

Merged
merged 1 commit into from
Oct 28, 2022
Merged

Conversation

jyemin
Copy link
Contributor

@jyemin jyemin commented Oct 28, 2022

JAVA-4795

One more change to clean up use of internal operation package

The benefit is that, like with SyncOperation, AsyncOperations doesn't expose the concrete class of any operation, and just deals with the interfaces like AsyncReadOperation and AsyncWriteOperation.

This gets us closer to a state where we can make all concrete Operation classes package private. The main thing stopping us from doing it now is that driver-legacy was never refactored to use SyncOperations and still constructs each operation directly.

@jyemin jyemin self-assigned this Oct 28, 2022
/**
* <p>This class is not part of the public API and may be removed or changed at any time</p>
*/
public final class AsyncOperations<TDocument> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from SyncOperations and just changed the interface types to be the Async equivalents

@@ -74,7 +74,7 @@
import static java.util.Collections.singletonList;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

public final class Operations<TDocument> {
final class Operations<TDocument> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can now be package private

@@ -171,8 +170,6 @@ private static Object checkValueTypes(final Object instance) {
Object actual = instance instanceof Optional ? ((Optional<Object>) instance).orElse(instance) : instance;
if (actual instanceof AsyncReadOperation || actual instanceof AsyncWriteOperation) {
return getClassPrivateFieldValues(actual);
} else if (actual instanceof Operations) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put a break point here and the branch was never entered, so I just removed it

@jyemin jyemin requested a review from stIncMale October 28, 2022 02:29
@jyemin jyemin merged commit 86aa822 into mongodb:master Oct 28, 2022
@jyemin jyemin deleted the j4795 branch October 28, 2022 19:31
ispringer pushed a commit to evergage/mongo-java-driver that referenced this pull request May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants