curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McKenzie <mckenzie....@gmail.com>
Subject Curator in an appserver environment
Date Tue, 17 Dec 2013 21:21:51 GMT
I've been using Curator in a standard Java environment, and haven't had any
issues with it, but have just started using the same code in an appserver
environment and have come across an issue.

While, it's probably considered 'bad' to use Curator in this environment
because it uses its own thread management, it runs fine in the vast
majority of cases. The only time I have experience issues with it is when
trying to call close() on the CuratorFramework instance. Specifically,
calling close() when the app server is shutting down.

The problem occurs because Curator uses an Executor to send the 'shutting
down' events to listeners, and the appserver has shut down all its Executor
services because it's shutting itself down.

My work around is to catch any runtime execptions thrown by the
CuratorFramework close() method, and in this case grab the ZooKeeper
connection from Curator and closing this. It's a bit ugly though.

Any suggestions (other than not using an appserver, or not using Curator in
this environment)?

One fix would be to not use the Executor during shutdown to send the
events, and instead just do this in the thread doing the shutdown. I doubt
this would have great performance implications, given that you're unlikely
to have millions of listeners.

Thoughts?
cheers
Cam

Mime
View raw message