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

GEODE_6883: Creating membership api classes #3985

Conversation

upthewaterspout
Copy link
Contributor

@upthewaterspout upthewaterspout commented Aug 28, 2019

Creating a new membership API package. Starting that package out with
these classes:

  • MembershipBuilder - created by moving NetMember and NetLocator factory stuff
    out of MembershipFactory and renaming MembershipFactory to MembershipBuilder

  • Membership - Extracted an interface from MembershipManager

  • Authenticator - Moved Authenticator to the API package

  • MembershipStatistics - Extracted interface from DMStats

  • MembershipListener and MessageListener - Creating these new membership
    specific interfaces by splitting up DistributedMembershipListener into two
    separate interfaces.

  • MembershipConfig - Extracted interface from ServiceConfig

  • Adding an archunit test for the membership API. Ensure that the API only
    depends on other API classes.

  • Removing GMSMemberFactory and MemberServices
    These classes were adding another layer to creating a MembershipManager,
    but they didn't actually allow swapping in a different implementation.
    Inlining these methods into the respective NetLocatorFactory,
    NetMemberFactory, and MembershipManagerFactory.

  • Removing getDM from DirectChannelListener - We want to get rid of this
    interface in favor of other membership
    specific interfaces that don't depend on core.

@mcmellawatt mcmellawatt force-pushed the feature/create-membership-api-GEODE-6883-2 branch from cd2462d to 872bd11 Compare August 30, 2019 23:52
@echobravopapa echobravopapa force-pushed the feature/create-membership-api-GEODE-6883-2 branch from a3eebcb to 51c1e52 Compare September 6, 2019 17:59
@upthewaterspout upthewaterspout changed the title DRAFT for precheckin - Creating membership api classes GEODE_6883: Creating membership api classes Sep 6, 2019
@upthewaterspout upthewaterspout marked this pull request as ready for review September 6, 2019 23:24
Copy link
Contributor

@Bill Bill left a comment

Choose a reason for hiding this comment

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

a couple ideas below…

MembershipManager create();


static MembershipBuilder newMembershipBuilder(ClusterDistributionManager dm) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's generally poor design to have an interface depend on an implementation of the interface.

If MembershipBuilderImpl is indeed the only implementation we envision, then I recommend we sort of reverse the relationship in the following way:

  1. rename MembershipBuilder to something like MembershipBuilderInterface
  2. rename MembershipBuilderImpl to MembershipBuilder
  3. move this method newMembershipBuilder() down to what is now called the MembershipBuilder class

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree having newMembershipBuilder() as part of the interface is somewhat odd. Why not just remove it all together and construct a MembershipBuilderImpl directly where needed? BTW, I think the current naming convention matches what we have for other interfaces/classes, so I'm not sure that needs to change (Cache/CacheImpl, Acceptor/AcceptorImpl, etc).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on these suggestions, how about we just get rid of the MembershipBuilder interface entirely and rename the concrete MembershipBuilderImpl class to MembershipBuilder?

Creating a new membership API package. Starting that package out with
these classes:
* MembershipBuilder - created by moving NetMember and NetLocator factory stuff
  out of MembershipFactory and renaming MembershipFactory to MembershipBuilder
* Membership - Extracted an interface from MembershipManager
* Authenticator - Moved Authenticator to the API package
* MembershipStatistics - Extracted interface from DMStats
* MembershipListener and MessageListener - Creating these new membership
  specific interfaces by splitting up DistributedMembershipListener into two
  separate interfaces.
* MembershipConfig - Extracted interface from ServiceConfig

* Adding an archunit test for the membership API. Ensure that the API only
  depends on other API classes.

* Removing GMSMemberFactory and MemberServices
  These classes were adding another layer to creating a MembershipManager,
  but they didn't actually allow swapping in a different implementation.
  Inlining these methods into the respective NetLocatorFactory,
  NetMemberFactory, and MembershipManagerFactory.

* Removing getDM from DirectChannelListener - We want to get rid of this
  interface in favor of other membership
  specific interfaces that don't depend on core.
@upthewaterspout upthewaterspout force-pushed the feature/create-membership-api-GEODE-6883-2 branch from 44ae648 to 27b213e Compare September 9, 2019 21:37
Copy link
Contributor

@bschuchardt bschuchardt left a comment

Choose a reason for hiding this comment

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

nice - I especially like the separation of membership-listener and message-listener

@upthewaterspout upthewaterspout merged commit 4c6dcf9 into apache:develop Sep 10, 2019
@upthewaterspout upthewaterspout deleted the feature/create-membership-api-GEODE-6883-2 branch September 10, 2019 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants