ModeShape/modeshape — pull request #228 by rhauch (2011-11-23 21:49:11+00:00)
Title: MODE-1289 Added more tests and improvements

Prior to this change (and in 2.x), the RepositoryNodeTypeManager used a read/write lock around the cache of node type information. This not only slowed things down, but having a shared cache allowed the state to change while in the middle of an operation.

This commit changes the RepositoryNodeTypeManager to keep an internal but immutable cache of the node type information. This cache is easily accessible to the rest of the package components, and because it's immutable there is no need for any internal locking within the cache. Every time node types are registered or unregistered, the cache is rebuilt in an atomic fashion (still within a write-lock within the RepositoryNodeTypeManager) and the old cache replaced.

Many of the Node and Property implementation methods that use the node type manager were changed to get the node type cache once and use it for the rest of the method.

The performance improvements might be minimal, but this should increase the consistency of various operations (e.g., Node.addMixin, Property.getPropertyDefinition(), etc.) even when the node types are being changed.

Added more tests for mixins and some JCR iterator implementations.

All tests pass with these changes.