weixin_39875503 2020-11-30 01:22
浏览 0

GEODE-6558: Add InternalDistributedSystem.Builder

  • Remove all but one constructor.
  • Replace newInstance methods with InternalDistributedSystem.Builder.
  • Replace newInstanceForTesting methods with InternalDistributedSystem.BuilderForTesting.
  • Replace public static boolean var ALLOW_MULTIPLE_SYSTEMS with usage of Boolean.getBoolean(ALLOW_MULTIPLE_SYSTEMS_PROPERTY) in connectInternal.

Most code paths are using DistributedSystem.connect or InternalDistributedSystem.connectInternal to construct a system. connectInternal now uses InternalDistributedSystem.Builder.

Several tests are using InternalDistributedSystem.BuilderForTesting.

NOTES FOR REVIEWERS (PLEASE READ):

NOTE: this is NOT the final refactoring/change to InternalDistributedSystem involving the Builder. We need to make some changes to reconnect for Micrometer. We will also be injecting a Micrometer MeterRegistry into InternalDistributedSystem. And finally, I think we'll be looking into making connectInternal private and changing internal code paths to use the Builder instead of connectInternal. Then there would be two code paths to create a InternalDistributedSystem: 1) DistributedSystem.connect which would delegate to InternalDistributedSystem.Builder 2) InternalDistributedSystem.Builder which would be used from internal code paths such as InternalCacheBuilder and reconnect

ALSO: I'd love to delete BuilderForTesting and replace it with mocking in every test where that's possible.

Please review: -pivotal

该提问来源于开源项目:apache/geode

  • 写回答

7条回答 默认 最新

  • weixin_39875503 2020-11-30 01:22
    关注

    We could probably merge the two Builders if we add setInitialize(boolean) which defaults to true. The tests that use BuilderForTesting are basically constructing an instance of InternalDistributedSystem which NEVER gets initialized.

    评论

报告相同问题?