public class CachingOfBizPropertySet extends com.opensymphony.module.propertyset.AbstractPropertySet implements Serializable
OFBizPropertySet that caches property entries and values to provide
more efficient access.
Note that JiraCachingPropertySet is just a decorator around an arbitrary supplied
property set and thus has uncertain behaviour both in a clustered environment and when there
are multiple instances of the caching property set, as the individual caches have no way to
share state.
CachingOfBizPropertySet is different. It is a flyweight around the
OfBizPropertyEntryStore, which caches the operations that it can (such as the
existence, type, and value of an entry) and delegates those it can't cache to the database
directly. The implementation deviates from that of OFBizPropertySet only in ways
that make it more fault-tolerant, such as by not throwing an exception when removing a
nonexistent property and not throwing an exception when setting a property to a new type
without removing it first.
The only known disadvantage to using this class is that it will eagerly load the value on
a cache miss. This seems to be an acceptable loss, because the main reasons why code
would bother to call exists(String) or getType(String) seem to be
OFBizPropertySet throws if you attempt
to remove a property that does not exist of change the type of an existing property.
This implementation silently ignores a spurious remove and gracefully updates the type
if it is changed, so these guards are not necessary.boolean value, where the actual
stored value is a meaningless sentinel. This is a strange thing to do, and it makes
more sense to store an actual boolean value for the property, instead.
This class is thread-safe, in spite of the difficulties that the PropertySet
contract imposes upon it. Its only mutable state is the entity definition provided through
PropertySet.init(Map, Map). This is stored in an immutable holder class whose reference
is marked as volatile to ensure safe publishing.
Although OFBizPropertySet itself allows for multiple generic delegators to be used,
this implementation ignores this setting. JIRA always uses the "default" delegator.
| Constructor and Description |
|---|
CachingOfBizPropertySet() |
CachingOfBizPropertySet(OfBizPropertyEntryStore entryStore,
String entityName,
Long entityId) |
CachingOfBizPropertySet(String entityName,
Long entityId) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
boolean |
exists(String key) |
protected Object |
get(int type,
String key) |
List<String> |
getKeys() |
List<String> |
getKeys(int type) |
List<String> |
getKeys(String prefix) |
List<String> |
getKeys(String prefix,
int type) |
int |
getType(String key) |
int |
hashCode() |
void |
init(Map config,
Map args) |
void |
remove() |
void |
remove(String key)
Implementation note: Unlike
OFBizPropertySet, this implementation will not throw
an exception if the property does not exist. |
protected void |
setImpl(int type,
String key,
Object obj) |
boolean |
supportsType(int type) |
getAsActualType, getBoolean, getData, getDate, getDouble, getInt, getLong, getObject, getProperties, getSchema, getString, getText, getXML, isSettable, setAsActualType, setBoolean, setData, setDate, setDouble, setInt, setLong, setObject, setProperties, setSchema, setString, setText, setXML, supportsTypes, toString, type, typepublic CachingOfBizPropertySet()
public CachingOfBizPropertySet(OfBizPropertyEntryStore entryStore, String entityName, Long entityId)
public List<String> getKeys()
getKeys in interface com.opensymphony.module.propertyset.PropertySetgetKeys in class com.opensymphony.module.propertyset.AbstractPropertySetpublic List<String> getKeys(String prefix)
getKeys in interface com.opensymphony.module.propertyset.PropertySetgetKeys in class com.opensymphony.module.propertyset.AbstractPropertySetpublic List<String> getKeys(int type)
getKeys in interface com.opensymphony.module.propertyset.PropertySetgetKeys in class com.opensymphony.module.propertyset.AbstractPropertySetpublic List<String> getKeys(String prefix, int type)
getKeys in interface com.opensymphony.module.propertyset.PropertySetpublic int getType(String key) throws com.opensymphony.module.propertyset.PropertyException
getType in interface com.opensymphony.module.propertyset.PropertySetcom.opensymphony.module.propertyset.PropertyExceptionpublic boolean exists(String key) throws com.opensymphony.module.propertyset.PropertyException
exists in interface com.opensymphony.module.propertyset.PropertySetcom.opensymphony.module.propertyset.PropertyExceptionpublic void init(Map config, Map args)
init in interface com.opensymphony.module.propertyset.PropertySetinit in class com.opensymphony.module.propertyset.AbstractPropertySetpublic void remove()
throws com.opensymphony.module.propertyset.PropertyException
remove in interface com.opensymphony.module.propertyset.PropertySetcom.opensymphony.module.propertyset.PropertyExceptionpublic void remove(String key)
OFBizPropertySet, this implementation will not throw
an exception if the property does not exist.remove in interface com.opensymphony.module.propertyset.PropertySetkey - the key of the property to be removedcom.opensymphony.module.propertyset.PropertyException - if the attempt to remove an existing property fails at the persistence layerpublic boolean supportsType(int type)
supportsType in interface com.opensymphony.module.propertyset.PropertySetsupportsType in class com.opensymphony.module.propertyset.AbstractPropertySetprotected void setImpl(int type,
String key,
Object obj)
setImpl in class com.opensymphony.module.propertyset.AbstractPropertySet@Nullable protected Object get(int type, String key)
get in class com.opensymphony.module.propertyset.AbstractPropertySetCopyright © 2002-2018 Atlassian. All Rights Reserved.