[ 
https://issues.apache.org/jira/browse/RATIS-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255875#comment-16255875
 ] 

Tsz Wo Nicholas Sze commented on RATIS-95:
------------------------------------------

Tried a little more of the patch.  It works well in general.  Some comments:
- expressionPattern seems not working for "a+b"
- Use new RaftProperties() instead of new RaftProperties(true);
- Drop "--port" from Server, get the peer from the peer list and then use the 
port.  We may add a getPeer in RaftGroup
{code}
//RaftGroup
  /** @return the peer with the given id if it is in this group; otherwise, 
return null. */
  public RaftPeer getPeer(RaftPeerId id) {
    Objects.requireNonNull(id, "id == null");
    for(RaftPeer p : getPeers()) {
      if (id.equals(p.getId())) {
        return p;
      }
    }
    return null;
  }
{code}
Then, Server.run() becomes
{code}
    final RaftPeer p = raftGroup.getPeer(peerId);
    if (p == null) {
      throw new IllegalArgumentException("Peer " + id + " not found in " + 
peers);
    }
    final int port = NetUtils.createSocketAddr(p.getAddress()).getPort();
    GrpcConfigKeys.Server.setPort(properties, port);
{code}


> Executable Jar for the ratis examples
> -------------------------------------
>
>                 Key: RATIS-95
>                 URL: https://issues.apache.org/jira/browse/RATIS-95
>             Project: Ratis
>          Issue Type: Improvement
>            Reporter: Elek, Marton
>            Assignee: Elek, Marton
>         Attachments: RATIS-95.wip.patch
>
>
> The current example project shows an example implementation of the base 
> interfaces. I suggest to create simple CLI application for the test (just an 
> additional class with main and argument parsing) to make it easier to 
> demonstrate how a ratis cluster could be run.
> For example:
> {code}
> java -jar ratis-examples-uber.jar --port 2323 --id node2 --peers 
> node3:localhost:4566,node1:localhost:3456  
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to