[
https://issues.apache.org/jira/browse/BOOKKEEPER-782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14134867#comment-14134867
]
Sijie Guo commented on BOOKKEEPER-782:
--------------------------------------
regarding following comments, the patch looks good.
- it is strange to have both setInstanceId in both Cookie and Builder. as I
commented before, we shouldn't have setInstanceId in Cookie, as Cookie is an
immutable object.
- it is not good to have cookie constructor with builder. as builder is used to
build cookie.
I would suggest as follow:
{code}
// cookie construct
private Cookie(int layoutVersion, String bookieHost, String journalDir, String
ledgerDirs, int znodeVersion, String instanceId)
// build construct
private Builder(); // build from scratch
private Builder(Cookie cookie); // build from existing cookie
newBuilder();
newBuilder(Cookie cookie);
// build function
Cookie build() {
return new Cookie(...);
}
{code}
> Use builder pattern for Cookie
> ------------------------------
>
> Key: BOOKKEEPER-782
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-782
> Project: Bookkeeper
> Issue Type: Sub-task
> Components: bookkeeper-server
> Reporter: Rakesh R
> Assignee: Rakesh R
> Fix For: 4.3.0
>
> Attachments: BOOKKEEPER-782.patch, BOOKKEEPER-782.patch,
> BOOKKEEPER-782.patch, BOOKKEEPER-782.patch
>
>
> It would be good to use builder pattern for Cookie, rather than modifying the
> fields in place.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)