Netflix/zuul — pull request #26 by trptcolin (2014-06-03 03:58:22+00:00)
Title: Ensure pollers end when requested

I haven't witnessed this causing any actual issues, and I'm not sure there's a good way to write a failing unit test for it, but Java Concurrency in Practice made me worry enough about these kinds of things that I thought I'd at least bring it up.

Using volatile makes sure the compiler won't optimize us into an infinite loop. There may be implementation details in this case that prevent this optimization from happening in practice, but it's probably safer and clearer to just use volatile.

See http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.3