• Bug
  • Status: Closed
  • 1 Critical
  • Resolution: Fixed
  • ehcache-core
  • amiller
  • Reporter: amiller
  • October 28, 2009
  • 0
  • Watchers: 0
  • November 19, 2009
  • October 28, 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.

MemoryStore fields:

  • cache - could be final except for dispose() that cuts references, but ok for now
  • useKeySample - should be final
  • map - could be final except for dispose() that cuts references, but ok for now
  • diskStore - final, ok
  • maximumSize - should be final
  • status - read/written w/o synchronization. make volatile.
  • policy - read/written w/o synchronization. make volatile.
  • keyArray - could be final except for dispose() that cuts references, but ok for now
  • keySamplePointer - could be final except for dispose() that cuts references, but ok for now

Comments

Alex Miller 2009-10-28

Made:

  • maximumSize final
  • useKeySample final
  • status volatile
  • policy volatile