cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelsembwever <...@git.apache.org>
Subject [GitHub] cassandra pull request #:
Date Thu, 08 Mar 2018 23:37:22 GMT
Github user michaelsembwever commented on the pull request:

    https://github.com/apache/cassandra/commit/ba09523de7cad3b3732c0e7e60b072f84e809e21#commitcomment-28005488
  
    In src/java/org/apache/cassandra/dht/BootstrapEvent.java:
    In src/java/org/apache/cassandra/dht/BootstrapEvent.java on line 62:
    out of curiosity:
    
     could we go one step further to avoid the static methods in the event classes as well?
    
    For example putting `DiagnosticEventService.instance()` into a member field in an "events"
class which holds the existing static util methods, and in the peer classes that use the events
class instantiate and keep an instance. 
    
    Something like:
    ```
    public class BootstrapEvents // this could also be named "BootstrapEventUtil"
    {
        private final DiagnosticEventService service;
    
        BootstrapEvent()
        {
            this.service = DiagnosticEventService.instance();
        }
    
        @VisibleForTesting
        BootstrapEvent(DiagnosticEventService service)
        {
            this.service = service;
        }
        …
        private static class BootstrapEvent extends DiagnosticEvent
        {
    
            private final BootstrapEventType type;
            private final TokenMetadata tokenMetadata;
            private final InetAddressAndPort address;
            private final String allocationKeyspace;
            private final Integer numTokens;
            private final Collection<Token> tokens;
    
            private BootstrapEvent(BootstrapEventType type, InetAddressAndPort address, TokenMetadata
tokenMetadata,
                                   String allocationKeyspace, int numTokens, ImmutableCollection<Token>
tokens)
            {
            …
        }
    }
    ```
    and
    ```
    
    public class BootStrapper extends ProgressEventNotifierSupport
    {
        …
        private final BoostrapEvents bootstrapEvents = BootstrapEvents();
    …
                bootstrapEvents.useSpecifiedTokens(…);
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message