eclipse/vert.x — pull request #926 by tcollinsworth (2014-10-01 19:31:37+00:00)
Title: Enhanced RouteMatcher so routes can be updated and removed while in use

The preexisting API is unchanged. Two new public methods setUpdatable(boolean) and removePattern(pattern, method) were added. Before updating or removing routes, the setUpdatable(true) should be called and a brief delay should occur to allow any in progress route matching to complete. The setUpdatable method adds try/finally and ReenetrantReadWrite.ReadLock lock/unlock overhead to all route
matching until setUpdatable(false) is called. If the setUpdatable(true) is not called RouteMatcher updates and remove will operate, however, NullPointerExceptions or ConcurrentModificationException will occur if existing routes are being iterated. Comprehensive tests including concurrency tests were added to validate the issue before the changes and validate proper operation after the changes.

If you deem these enhancements too substantial, I recommend adding an interface and changing the name of this class to UpdatableRouteMatcher so that both RouteMatcher features are available for users needs. Searching the Google vertx group revealed at least three separate inquires about route updates or removals from in use RouteMatchers.

Signed-off-by: tcollinsworth