com.atlassian.jira.propertyset
Class CachingOfBizPropertyEntryStore

java.lang.Object
  extended by com.atlassian.jira.propertyset.CachingOfBizPropertyEntryStore
All Implemented Interfaces:
OfBizPropertyEntryStore

public class CachingOfBizPropertyEntryStore
extends Object
implements OfBizPropertyEntryStore

Since:
v6.2

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.propertyset.OfBizPropertyEntryStore
OfBizPropertyEntryStore.PropertyEntry
 
Constructor Summary
CachingOfBizPropertyEntryStore(org.ofbiz.core.entity.DelegatorInterface genericDelegator, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 OfBizPropertyEntryStore.PropertyEntry getEntry(String entityName, long entityId, String propertyKey)
          Retrieve the type and value of the specified property.
 Collection<String> getKeys(String entityName, long entityId)
          Retrieve all keys that are stored in the given property set.
 Collection<String> getKeys(String entityName, long entityId, int type)
          Retrieve all keys that are stored in the given property set and have the specified value type.
 void onClearCache(ClearCacheEvent event)
           
 void removeEntry(String entityName, long entityId, String propertyKey)
          Remove a specific property from a property set.
 void removePropertySet(String entityName, long entityId)
          Removes an entire property set.
 void setEntry(String entityName, long entityId, String propertyKey, int type, Object value)
          Stores a new value for the specified property.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingOfBizPropertyEntryStore

public CachingOfBizPropertyEntryStore(org.ofbiz.core.entity.DelegatorInterface genericDelegator,
                                      com.atlassian.cache.CacheManager cacheManager)
Method Detail

getKeys

public Collection<String> getKeys(String entityName,
                                  long entityId)
Description copied from interface: OfBizPropertyEntryStore
Retrieve all keys that are stored in the given property set.

Specified by:
getKeys in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner
Returns:
all of the keys that are stored for this property set, in no particular order

getKeys

public Collection<String> getKeys(String entityName,
                                  long entityId,
                                  int type)
Description copied from interface: OfBizPropertyEntryStore
Retrieve all keys that are stored in the given property set and have the specified value type.

Specified by:
getKeys in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner
type - the value type, as defined by the value constants in the PropertySet interface, that the keys must have to be returned
Returns:
all of the keys that are stored for this property set and have the given type, in no particular order

getEntry

public OfBizPropertyEntryStore.PropertyEntry getEntry(String entityName,
                                                      long entityId,
                                                      String propertyKey)
Description copied from interface: OfBizPropertyEntryStore
Retrieve the type and value of the specified property.

Specified by:
getEntry in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner
propertyKey - the name of the property to load
Returns:
the property entry, or null if the property does not exist. Note that even if it does "exist", the value can itself be null.

setEntry

public void setEntry(String entityName,
                     long entityId,
                     String propertyKey,
                     int type,
                     Object value)
Description copied from interface: OfBizPropertyEntryStore
Stores a new value for the specified property.

Specified by:
setEntry in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner
propertyKey - the name of the property to store
type - the value type that is to be stored, as defined by the value constants in the PropertySet interface.
value - the value to be stored

removeEntry

public void removeEntry(String entityName,
                        long entityId,
                        String propertyKey)
Description copied from interface: OfBizPropertyEntryStore
Remove a specific property from a property set.

Specified by:
removeEntry in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner
propertyKey - the name of the property to remove

removePropertySet

public void removePropertySet(String entityName,
                              long entityId)
Removes an entire property set.

Implementation note: This is a "hard" operation to optimize due to the way the tables are structured, OfBiz's poor support for joins and sub-selects, the cache's inability to replicate the invalidation of a group of keys, and the probable performance cost of flushing the entire entry cache. We will make these assumptions:

  1. It is rare to delete an entire property set that is also large, so going row-at-a-time is acceptable.
  2. Another cluster node that explicitly removes a row from the property set will itself be responsible for invalidating that row's entry.
  3. Exhaustively searching for matching keys is both expensive and unreliable (if we can have stale rows, then so can other nodes have different stale rows that we don't even know to invalidate for them).
  4. The only real alternative would be to flush the entire cache.

Based on those assumptions, the decision is to invalidate only those keys for which we actually find and remove an entry, exactly as if they have been removed individually.

Specified by:
removePropertySet in interface OfBizPropertyEntryStore
Parameters:
entityName - the entity name of the property set's owner
entityId - the entity ID of the property set's owner

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2014 Atlassian. All Rights Reserved.