- 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