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

Scope of the client is not Atomic compatible #13

Open
dcalap opened this issue Feb 17, 2020 · 2 comments
Open

Scope of the client is not Atomic compatible #13

dcalap opened this issue Feb 17, 2020 · 2 comments

Comments

@dcalap
Copy link

dcalap commented Feb 17, 2020

Hi,

I have a problem using AtomicBoolean or AtomicReference inside a client rx query, it looks like updates the Atomic value inside the query scope but you lose it outside this scope.

Is there any way to store some value inside the rxclient query and use it outside? Something like the next:

AtomicBoolean success = new AtomicBoolean(true);
Single<PgRowSet> pgRowSetSingle = cbaClient.rxPreparedQuery(query, tuple);
pgRowSetSingle.subscribe(result -> {
    }, err -> {
         success.set(false); // Is passing through this code
         log.error("Failure: {}", err.getMessage());
    });

log.info("Success value {}", success.get()); // Here the value is 'true' when should be 'false'
@BillyYccc
Copy link
Contributor

Hi, the code in your subscribtion block is called only when the asynchronous result is completed but the method is quickly returned so your logging does not make sense here.

@dcalap
Copy link
Author

dcalap commented Feb 25, 2020

Understood. Thanks for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants