• Bug
  • Status: Closed
  • 1 Critical
  • Resolution: Fixed
  • ehcache-core
  • hsingh
  • Reporter: amiller
  • October 26, 2009
  • 0
  • Watchers: 0
  • January 17, 2013
  • November 03, 2009

Description

Many fields in core classes are read and written by multiple threads but don’t properly use either synchronized or volatile. These fields are subject to visibility issues due to the Java Memory Model and should be made volatile or read/written under synchronization.

Cache

  • disabled - both read and written by multiple threads without synchronization. make volatile.
  • useClassicLru - should be final (need to adjust initializer to set it always)
  • diskStore - created under synchronization in initialise() but read w/o synch afterwards. should be volatile to guarantee visibility
  • diskStorePath - read and written w/o synchronization. make volatile.
  • status - read and written w/o synchronization. make volatile.
  • configuration - created in constructor, read w/o synch. only written in clone() - could possibly restructure that to allow this to be final?
  • memoryStore - written only in initialise() under synchronization, read w/o synch. make volatile.
  • registeredEventListeners - restructure to make final (clone) or make volatile.
  • registeredCacheExtensions - restructure to make final (clone) or make volatile.
  • guid - restructure to make final (clone) or make volatile.
  • cacheManager - read/written w/o synchronization. make volatile.
  • bootstrapCacheLoader - restructure to make final (clone) or make volatile.
  • cacheExceptionHandler - restructure to make final (clone) or make volatile.
  • registeredCacheLoaders - restructure to make final (clone) or make volatile.

Comments