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

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

-1 on generateCookie on a cookie instance, we should keep cookie instance 
methods behave as immutable object.

what you suggested before should be ok. why you don't use it?

{code}
String instanceId = getInstanceId(zk);
            Cookie masterCookie = Cookie.generateCookie(conf);
            if (null != instanceId) {
                Cookie.Builder builder = Cookie.newBuilder(masterCookie);
                builder.setInstanceId(instanceId);
                masterCookie = builder.build();
            }
{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, 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