Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-1463

Implement built-in builder class for the Session/SessionPool class

    XMLWordPrintableJSON

Details

    Description

      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 .

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

      `

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tanxinyu Xinyu Tan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: