Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-8055

Limit size of context cache in the TestContext framework

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 4.3 RC1
    • Component/s: Test
    • Labels:
    • Last commented by a User:
      true

      Description

      Overview

      The cache of application contexts becomes too big when running a complete suite of tests that each load a full ApplicationContext with a JPA EntityManagerFactory. There are situations where a tiny difference in the configuration forces us to load a different context.

      Since the context cache is only there for performance reasons, its maximum size should be configurable – a system property might be the best choice, while no property means unbounded size – so that the least recently used can be properly closed and evicted from the cache.

      Deliverables

      1. Introduce a mechanism for configuring the maximum number of contexts that should be cached at any given time.
        • Possible mechanisms include: simple system property or a system property supported via SpringProperties.
      2. Redesign DefaultContextCache to implement an LRU cache eviction algorithm.
        • Ensure that evicted contexts get properly closed.
        • Consider internally delegating to a third-party implementation such as a Guava cache.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sbrannen Sam Brannen
              Reporter:
              gpitteloud Gaetan Pitteloud
              Last updater:
              Spring Issues
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 1 week ago