You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Liu Jiajun (Jira)" <ji...@apache.org> on 2021/07/04 10:07:00 UTC

[jira] [Commented] (IOTDB-1463) Implement built-in builder class for the Session/SessionPool class

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

Liu Jiajun commented on IOTDB-1463:
-----------------------------------

Hi all, I would like to take this issue:D

> Implement built-in builder class for the Session/SessionPool class
> ------------------------------------------------------------------
>
>                 Key: IOTDB-1463
>                 URL: https://issues.apache.org/jira/browse/IOTDB-1463
>             Project: Apache IoTDB
>          Issue Type: Improvement
>          Components: Client/Java
>            Reporter: Xinyu Tan
>            Priority: Major
>              Labels: easy-fix
>             Fix For: master branch
>
>
> Currently, the number of parameters that the Session/SessionPool class can be configured by the user is increasing, leading to an increasing number of confusing constructors. Therefore, we can consider introducing the builder class SessionBuilder/SessionPoolBuilder in the Session/SessionPool class, so that users can focus only on the parameters they need to focus on. For the builder design pattern, you can refer to [this .|https://zhuanlan.zhihu.com/p/58093669]
> {code:java}
> // default
> Session session = new SessionBuilder().build()
> SessionPool sessionpool = new SessionPoolBuilder().build()
> // set remote ip
> Session session = new SessionBuilder().setHost("localhost").build()
> SessionPool sessionpool = new SessionPoolBuilder().setHost("localhost").build()
> // set remote ip
> // close cache leader
> Session session = new SessionBuilder().setHost("localhost").setEnableCacheLeader(false).build()
> SessionPool sessionpool = new SessionPoolBuilder().setHost("localhost").setEnableCacheLeader(false).build()
> {code}
> `
> Of course, in order to ensure compatibility, the previous session construction interface can not be removed, we need to recommend that users gradually migrate to the builder creation method, so as to gain greater convenience



--
This message was sent by Atlassian Jira
(v8.3.4#803005)