OpenJPA
  1. OpenJPA
  2. OPENJPA-1801

CacheStatistics misses are improperly calculated.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.0
    • Fix Version/s: 2.1.0
    • Component/s: datacache
    • Labels:
      None

      Description

      In doing some testing I found that the DataCache statistics aren't calculated properly. In the case where there is a cache miss for a specific Type(Person.class), a miss (a read with no subsequent hit) is recorded for java.lang.Object.

        Activity

        Hide
        Rick Curtis added a comment -

        Committed changes to trunk. First off, this is a pretty major refactor and cache statistics collection isn't 100% yet. Unfortunately I don't have the time to test this as thoroughly as I would like. This is a step in the right direction and is more correct that the previous implementation, but it is still incomplete.

        Show
        Rick Curtis added a comment - Committed changes to trunk. First off, this is a pretty major refactor and cache statistics collection isn't 100% yet. Unfortunately I don't have the time to test this as thoroughly as I would like. This is a step in the right direction and is more correct that the previous implementation, but it is still incomplete.
        Hide
        Pinaki Poddar added a comment -

        from JavaDoc of CacheStatistics

        • All methods with Class as input argument treats null as
        • <code>java.lang.Object</code>. All per-class statistics depends on
        • determining the runtime type of the instance being cached. If it is not
        • possible to determine the runtime type from the given context, the statistics
        • is registered under generic <code>java.lang.Object</code>.
        • @since 1.3.0
        Show
        Pinaki Poddar added a comment - from JavaDoc of CacheStatistics All methods with Class as input argument treats null as <code>java.lang.Object</code>. All per-class statistics depends on determining the runtime type of the instance being cached. If it is not possible to determine the runtime type from the given context, the statistics is registered under generic <code>java.lang.Object</code>. @since 1.3.0
        Hide
        Rick Curtis added a comment -

        @Pinaki -

        I came across that javadoc after I opened this JIRA, but I think in the code that I replaced we could have determined done a better job at determining the runtime type that was being cached. Either way I think we're in a better place than what we were.

        I'm not sure if you looked at the changes I made, but from a high level I moved statistics calculation from the DataCache level up to the (DataCache)StoreManager level. I did this because only the StoreManager knows when a hit is really a hit.

        Show
        Rick Curtis added a comment - @Pinaki - I came across that javadoc after I opened this JIRA, but I think in the code that I replaced we could have determined done a better job at determining the runtime type that was being cached. Either way I think we're in a better place than what we were. I'm not sure if you looked at the changes I made, but from a high level I moved statistics calculation from the DataCache level up to the (DataCache)StoreManager level. I did this because only the StoreManager knows when a hit is really a hit.
        Hide
        Rick Curtis added a comment -

        The last commit for this JIRA(1028808) is actually for OPENJPA-1844.

        Show
        Rick Curtis added a comment - The last commit for this JIRA(1028808) is actually for OPENJPA-1844 .

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development