Skip to content

Commit

Permalink
Refactor addlisten
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojinchao95 committed May 26, 2024
1 parent 507a60d commit 1dc33cc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

import static org.apache.curator.framework.recipes.cache.CuratorCacheListener.builder;

/**
* Registry repository of ZooKeeper.
*/
Expand Down Expand Up @@ -257,7 +259,7 @@ public void watch(final String key, final DataChangedEventListener listener) {
listener.onChange(new DataChangedEvent(path, null == data ? "" : new String(data, StandardCharsets.UTF_8), type));
};
// CHECKSTYLE:ON
cache.listenable().addListener(cacheListener);
cache.listenable().addListener(builder().forAll(cacheListener).afterInitialized().build());
cache.start();
}

Expand Down

0 comments on commit 1dc33cc

Please sign in to comment.