Xinyu Tan created IOTDB-1463:
--------------------------------
Summary: 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
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)