zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zili Chen <wander4...@gmail.com>
Subject Re: Replace ZooKeeperThread with ThreadFactory
Date Tue, 24 Sep 2019 14:20:31 GMT
Even without port ZooKeeperThread to Runnable & ThreadFactory we can
cycle dependency by pass zookeeper via ClientCnxn#start(extend this with a
parameter). But exclude exposing `this` in ZooKeeper constructor is always
a breaking
change that requires existing codes call ZooKeeper#start or sth. like this.


Zili Chen <wander4096@gmail.com> 于2019年9月24日周二 下午10:06写道:

> One breaks is that we change SendThread's name when #startConnect.
> However, we can always use
> name xxx-SendThread and log host&port on #startConnect. Reflecting the
> host&port by thread name
> is one approach to show which host&port this client connect to, not the
> only approach.
> Zili Chen <wander4096@gmail.com> 于2019年9月24日周二 下午9:05写道:
>> Hi ZooKeepers,
>> Back to ZOOKEEPER-837[1] we want to eliminate cycle dependency between
>> ZooKeeper and
>> ClientCnxn. Now the last usage of ZooKeeper in ClientCnxn is for
>> retrieving watches.
>> Couple with the advantage start a task using Runnable and ThreadFactory,
>> we can make this
>> last effort by re-implementing SendThread using Runnable and
>> ThreadFactory, passing
>> ZooKeeper instance on bootstrap method so that we eliminate cycle
>> dependency.
>> Furthermore, deep dive into Runnable overwhelms Thread argument, it could
>> make sense that
>> we replace ZooKeeperThread with ThreadFactory strategy. Generally we port
>> subclasses of
>> ZooKeeperThread to Runnable and at the place where we start the thread
>> previously, we
>> submit the Runnable to ExecutorServices built from ThreadFactory.
>> Implementation plan would be creating an umbrella JIRA to track all these
>> efforts, breaking down
>> by subclass and a dedicated subtask for introducing the framework using
>> ThreadFactory.
>> What do you think?
>> Best,
>> tison.
>> [1] https://issues.apache.org/jira/browse/ZOOKEEPER-837

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message