DSpace/DSpace — pull request #114 by richardrodgers (2012-10-25 20:25:36+00:00)
Title: Adds support for read-only contexts that bypass internal DSO cache

As requested, this pull contains an API improvement to address the issue in DS-1205 - Context caches that can exhaust JVM memory. It introduces a new Context option - READ_ONLY - which is created with a new constructor invocation:

Context c = new Context(Context.READ_ONLY);

Read-only contexts will not populate the internal object's cache, so will have a constant zero-memory footprint over the life of the context object. Run-time exceptions will be thrown when a read-only context is used to update DSpaceObjects. Read-only contexts may prove to have broad applicability beyond the specific use-case of DS-1205.

Contexts created without the option should behave as before. Note that this code has not been tested.