You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Suresh Srinivas (JIRA)" <ji...@apache.org> on 2012/08/28 18:58:07 UTC
[jira] [Comment Edited] (HADOOP-8736) Create a Builder to make an
RPC server
[ https://issues.apache.org/jira/browse/HADOOP-8736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13443244#comment-13443244 ]
Suresh Srinivas edited comment on HADOOP-8736 at 8/29/12 3:56 AM:
------------------------------------------------------------------
bq. but I think it should be "setPort".
Correct.
bq. Or perhaps those required fields should be set as part of the Builder constructor, while the other fields are set via the builder set*() methods?
Actually I prefer set* methods instead of Builder constructor. That way adding another constructor for another required field is not required.
Thinking more about this, I think the way code is done is probably fine. For required fields, setting to null that results in NullPointerException to indicate programming error is fine. Not sure if there are any other fields which will not cause runtime exception where the default value cannot be valid.
was (Author: sureshms):
bq. but I think it should be "setPort".
Correct.
bq. Or perhaps those required fields should be set as part of the Builder constructor, while the other fields are set via the builder set*() methods?
Actually I prefer set* methods instead of Builder constructor. That way adding another constructor for another required field is not required.
Thinking more about this, I think the way code is done is probably fine. For required fields, setting to null that results in NullPointerException to indicate programming error is fine. Not sure if there are any other fields which will not cause runtime exception and some invalid default is considered.
> Create a Builder to make an RPC server
> --------------------------------------
>
> Key: HADOOP-8736
> URL: https://issues.apache.org/jira/browse/HADOOP-8736
> Project: Hadoop Common
> Issue Type: Improvement
> Components: ipc
> Affects Versions: 3.0.0
> Reporter: Brandon Li
> Assignee: Brandon Li
> Attachments: HADOOP-8736.patch, HADOOP-8736.patch
>
>
> There are quite a few variants of getServer() method to create an RPC server. Create a builder class to abstract the building steps and avoid more getServer() variants in the future.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira