com.atlassian.jira.project.version
Class CachingVersionStore

java.lang.Object
  extended by com.atlassian.jira.project.version.CachingVersionStore
All Implemented Interfaces:
VersionStore

public class CachingVersionStore
extends Object
implements VersionStore

A caching implementation of the VersionStore that relies on a delegate to do the DB operations.

This class needs some thread synchronisation for thread safety, to avoid loading a stale copy of the Versions into the cache. However, it is optimised such that readers will never be blocked by writers, and writers only block each other for the minimum necessary time. Because pre-loading the cache would add overhead to JIRA's startup, the cache is lazily initialised, and so the first call will load the cache for the first time. This is the only time that readers may block, waiting for the cache to be initialised.


Constructor Summary
CachingVersionStore(VersionStore delegate)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue createVersion(Map versionParams)
           
 void deleteVersion(org.ofbiz.core.entity.GenericValue versionGV)
           
 List getAllVersions()
          Returns a list of GenericValues representing all Versions in JIRA, ordered by sequence.
 org.ofbiz.core.entity.GenericValue getVersion(Long id)
           
 void storeVersion(Version version)
          Stores an individual Version in the DB.
 void storeVersions(Collection versions)
          Stores a collection of Version objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingVersionStore

public CachingVersionStore(VersionStore delegate)
Method Detail

getAllVersions

public List getAllVersions()
Description copied from interface: VersionStore
Returns a list of GenericValues representing all Versions in JIRA, ordered by sequence.

Specified by:
getAllVersions in interface VersionStore
Returns:
a list of GenericValues representing all Versions in JIRA, ordered by sequence.

getVersion

public org.ofbiz.core.entity.GenericValue getVersion(Long id)
Specified by:
getVersion in interface VersionStore

createVersion

public org.ofbiz.core.entity.GenericValue createVersion(Map versionParams)
Specified by:
createVersion in interface VersionStore

storeVersion

public void storeVersion(Version version)
Description copied from interface: VersionStore
Stores an individual Version in the DB. If you want to store a collection of Versions, consider using VersionStore.storeVersions(java.util.Collection), it can be more efficient.

Specified by:
storeVersion in interface VersionStore
Parameters:
version - The Version to store.
See Also:
VersionStore.storeVersions(java.util.Collection)

storeVersions

public void storeVersions(Collection versions)
Description copied from interface: VersionStore
Stores a collection of Version objects. This method can have performance benefits over calling storeVersion() multiple times. eg the CachingVersionStore will reload the cache from DB with every call to storeVersion().

Specified by:
storeVersions in interface VersionStore
Parameters:
versions - Collection of Version objects.
See Also:
VersionStore.storeVersion(Version)

deleteVersion

public void deleteVersion(org.ofbiz.core.entity.GenericValue versionGV)
Specified by:
deleteVersion in interface VersionStore


Copyright © 2002-2009 Atlassian. All Rights Reserved.