[bisq-network/bisq] Fix singleton CoreContext usage (#5292)

Stan notifications at github.com
Wed Mar 10 12:33:17 CET 2021


After `GrpcServer` builds a gRPC server instance, it calls injected `CoreContext#setApiUser(true)`.  The same, singleton `CoreContext` instance is injected into CoreService constructors, which use the `coreContext#isApiUser` value (set true by the server builder) to set their own class level boolean `isApiUser` fields.

When `CoreContext` was added, I was fooled by the correct behavior I saw while stepping through the server debugger.  But now I see that the correct boolean value in `CoreContext` is only available after CoreService constructors have finished instantiating themselves -- not in time.

In this change, the `isApiUser` field is removed from CoreServices, and `CoreContext coreContext` becomes a class level final field in CoreServices, and the correct `coreContex.isApiUser` value is available in the CoreService methods.

This PR is the first in a new API PR chain.
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/5292

-- Commit Summary --

  * Fix singleton CoreContext usage

-- File Changes --

    M core/src/main/java/bisq/core/api/CoreOffersService.java (8)
    M core/src/main/java/bisq/core/api/CoreTradesService.java (7)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/5292.patch
https://github.com/bisq-network/bisq/pull/5292.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5292
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210310/7be15210/attachment.htm>


More information about the bisq-github mailing list