Issue 118

Goal: exposing statistics result

Method: the gathering process is adapted from Ehcache 2 code base. It's simplified to expose just what JSR107 needed.

Concerns:
  1. Clearing stats: needs to find a way to clear all the stats

  2. Average time spent in gets/puts: was told by Chris it's doable with mean latency from stats module but I have found no example of how to wire it up

  3. Old CacheManager will provide a shared instance of ScheduledExecutorService to every cache for stats gathering. This model isn't the same in Ehcache3 since we have EhcacheManager and StandaloneCacheBuilder both creating an Ehcache instance. I've ended up creating the executor in both of these places for now. Also, to avoid an NPE from initiating a statistics gateway in other tests in which Ehcache instance is created from constructor, a default executor is being used (see Ehcache.java line 103). This is just a hack to get the tests running. It's definitely needed revised.

  4. Testing: testing statistics required a real Ehcache usage with OnheapStore backing. It doesn't seem it could be done inside "core" module since it's missing OnheapStore from the "impl" module. I had to place my statistics test in "impl" as a result. The test is still in progress.


There's an extra method in CacheStatistics vs the mbean interface. I'm not sure how else would you register the mbean without using the StatisticsMBeanRegister? Are you planning on rewriting it in the 107 wrapper?