Meituan-Dianping / Meituan-Dianping/Zebra

web端保存数据到zookeeper有问题,一直卡在那里

Open
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.8k
Forks
705
PR merge metrics
No merged PRs in 30d

Description

public class ZooKeeperConnection {

private Logger logger = LoggerFactory.getLogger(this.getClass().getName());

private ZooKeeper zooKeeper;

private int sessionTimeout = 50000;

private final CountDownLatch connectedSignal = new CountDownLatch(1);

**public ZooKeeper connect(String host) throws IOException, InterruptedException {
    **zooKeeper = new ZooKeeper(host, sessionTimeout, new Watcher() {
        @Override
        public void process(WatchedEvent watchedEvent) {
           if(watchedEvent.getState() == Event.KeeperState.SyncConnected) {
               connectedSignal.countDown();
           }
        }
    });
    connectedSignal.await();
    return zooKeeper;**
}**

public void close() {
    try {
        zooKeeper.close();
    } catch (InterruptedException e) {
        logger.error("zookeeper connection close fail!", e);
    }
}

}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ZooKeeperConnection.connect entry point shown in the issue, especially the connectedSignal.await() call and the SyncConnected watcher. Reproduce the web save hang and determine why connection establishment does not complete; the issue does not specify a test, file path, or expected fix, so completion criteria are not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.