문제

According to documentation

CuratorFramework instances are fully thread-safe. You should share one CuratorFramework per ZooKeeper cluster in your application.

It also states that the method start should be called before any other operations can be performed. Should this method be called before every operation or calling it once after initialization is enough?

도움이 되었습니까?

해결책

Call start once after creating the CuratorFramework instance. So, the startup is:

  • Create the CuratorFramework via one of the factory methods
  • Call start() on the instance
  • Run your application using the single CuratorFramework instance as needed
  • At the end of your application, call close() on the instance

NOTE: I'm the main author of Curator

다른 팁

The initial tests showed, that start should be called only once per created client. Calling it multiple times caused IllegalStateException.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top