|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager org.apache.openjpa.datacache.AbstractDataCache org.apache.openjpa.datacache.ConcurrentDataCache org.apache.openjpa.datacache.PartitionedDataCache
public class PartitionedDataCache
A partitioned data cache maintains a set of partitions that are DataCache themselves.
Each of the partitioned DataCaches can be individually configured.
However, all partitions must be of the same type. By default, this cache uses
ConcurrentDataCache as its partitions.
This cache can be configured as a plug-in as follows:
<property name='openjpa.DataCache"
value="partitioned(name=X, PartitionType=concurrent,Partitions='(name=a,cacheSize=100),
(name=b,cacheSize=200)')
Notice that the individual partition properties are enclosed parentheses, separated by comma
and finally the whole property string is enclosed in single quote.
Each partition must have a non-empty name that are unique among the partitions.
The policy can return
the name of a partition to distribute the managed instances to be cached in respective partition.
The above configuration will configure a partitioned cache named X
with two partitions named
a
and b
with cache size 100
and 200
respectively.
Besides the two partitions, this cache instance itself can store data and referred by its own name
(X
in the above example).
Field Summary |
---|
Fields inherited from class org.apache.openjpa.datacache.AbstractDataCache |
---|
_excludedTypes, _includedTypes, conf, log, stats |
Fields inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager |
---|
_listeners |
Fields inherited from interface org.apache.openjpa.datacache.DataCache |
---|
NAME_DEFAULT |
Constructor Summary | |
---|---|
PartitionedDataCache()
|
Method Summary | |
---|---|
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
DataCache |
getPartition(String name,
boolean create)
Gets the named partition. |
Set<String> |
getPartitionNames()
Gets the name of the configured partitions. |
List<String> |
getPartitions()
Returns the individual partition configuration properties. |
boolean |
isPartitioned()
Always returns true. |
void |
setPartitions(String parts)
Set partitions from a String configuration. |
void |
setPartitionType(String type)
Sets the type of the partitions. |
Methods inherited from class org.apache.openjpa.datacache.ConcurrentDataCache |
---|
clearInternal, getCacheMap, getCacheSize, getInternal, getSoftReferenceSize, initialize, newCacheMap, pinInternal, putInternal, removeAllInternal, removeInternal, setCacheSize, setSoftReferenceSize, unpinAll, unpinInternal, writeLock, writeUnlock |
Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache |
---|
addExpirationListener, afterCommit, clear, close, close, commit, contains, containsAll, fireEvent, get, getAll, getEnableStatistics, getEvictionSchedule, getExcludedTypes, getName, getStatistics, getTypes, isClosed, keyRemoved, pin, pinAll, pinAll, put, putAllInternal, recacheUpdates, remove, removeAll, removeAll, removeAllInternal, removeAllTypeNamesInternal, removeExpirationListener, setConfiguration, setEnableStatistics, setEvictionSchedule, setExcludedTypes, setExcludedTypes, setName, setTypes, setTypes, startConfiguration, toString, unpin, unpinAll, update |
Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager |
---|
addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, newListenerCollection, removeListener, setFailFast |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.openjpa.event.RemoteCommitListener |
---|
afterCommit, close |
Constructor Detail |
---|
public PartitionedDataCache()
Method Detail |
---|
public void setPartitionType(String type) throws Exception
type
- the name of the type that implements DataCache interface.
Aliases such as "concurrent"
is also recognized.
Exception
- if the given type is not resolvable to a loadable type.public void setPartitions(String parts)
parts
- a String of the form (p1, p2, p3)
where p1, p2 etc. itself are plug-in strings
for individual Data Cache configuration.public List<String> getPartitions()
public DataCache getPartition(String name, boolean create)
DataCache
getPartition
in interface DataCache
getPartition
in class AbstractDataCache
name
- name of the given partition.create
- if true optionally create a new partition.
public Set<String> getPartitionNames()
getPartitionNames
in interface DataCache
getPartitionNames
in class AbstractDataCache
public final boolean isPartitioned()
isPartitioned
in interface DataCache
isPartitioned
in class AbstractDataCache
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
endConfiguration
in class AbstractDataCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |