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

Sijie Guo commented on BOOKKEEPER-782:
--------------------------------------

- since you already have builder, you shouldn't have setInstanceId on Cookie 
itself. the interface should be like below:

{code}

Cookie oldCookie;

CookieBuilder builder = Cookie.newBuilder(oldCookie);
builder.setInstanceId(...);
Cookie newCookie = builder.build();
{code}

- znode version isn't part of a cookie. so it would not be part of builder, 
which it would be a final. since it is kind of a state of a cookie object, each 
time we update or delete the cookie object, the state will be changed. we only 
use builder when we want to modify the fields of a cookie. hence, you don't 
need to change the sigature of writeCookie and deleteCookie.

> 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
>
>
> 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)

Reply via email to