-
Notifications
You must be signed in to change notification settings - Fork 157
Adding cleanup() method to RiakCluster & RiakClient for container environments #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.travis.yml
Outdated
| script: | ||
| - if [ $RIAK_FLAVOR == "riak-kv" ]; then mvn -Pitest,default -Dcom.basho.riak.yokozuna=false | ||
| verify; else echo "Not riak-kv flavor"; fi | ||
| verify; for i in {1..10}; do mvn -Ptest-debug-logging surefire:test -Dtest=RiakClusterTest; done; else echo "Not riak-kv flavor"; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😭 ugh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, trying to track down a very slippery heisenbug.
| RiakCluster cluster = new RiakCluster.Builder(builder.build()).build(); | ||
| cluster.start(); | ||
| return new RiakClient(cluster); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here kid, have a newline.
| * Call this method when your application is being unloaded from the container, <b>after</b> | ||
| * all {@link RiakNode}, {@link RiakCluster}, and {@link com.basho.riak.client.api.RiakClient} | ||
| * objects are in the shutdown state. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this just be part of shutdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, b/c:
- If "the user" instantiated 2 RiakCluster or RiakClient objects for some reason, it could clear all the Netty threadlocals if one is still running.
- It would turn
shutdown()into a partially synchronous method, as we'd have to wait for the shutdown future to finish, then call cleanup. - This is only for environments that swap out classloaders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
|
|
Fixes #660 (CLIENTS-962), abstracts away the calls needed to cleanup Netty's thread local variables, so we don't leak classloaders into permgen memory upon container reload.
cc/ @monday0rsunday