Class DistributableCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>
- java.lang.Object
-
- org.jboss.as.ejb3.cache.distributable.DistributableCache<K,V>
-
- Type Parameters:
K- the cache key typeV- the cache value type
- All Implemented Interfaces:
Cache<K,V>,org.wildfly.clustering.ee.Restartable,AffinitySupport<K>
public class DistributableCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>> extends Object implements Cache<K,V>
DistributableCacheimplementation. This object is responsible for:- Group association based on creation context
- Batching of bean manager operations
- Author:
- Paul Ferraro
-
-
Field Summary
-
Fields inherited from interface org.jboss.as.ejb3.cache.Cache
CURRENT_GROUP
-
-
Constructor Summary
Constructors Constructor Description DistributableCache(BeanManager<K,V,org.wildfly.clustering.ee.Batch> manager, StatefulObjectFactory<V> factory, javax.transaction.TransactionSynchronizationRegistry tsr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(K id)Indicates whether or not the specified key is contained within this cache.Vcreate()Creates and caches a new instance ofT.voiddiscard(V value)Discard the specified object from cache.Vget(K id)Get the specified object from cache.intgetCacheSize()Supplier<K>getIdentifierFactory()Returns the identifier factory of this cache.intgetPassivatedCount()org.jboss.ejb.client.AffinitygetStrictAffinity()intgetTotalSize()org.jboss.ejb.client.AffinitygetWeakAffinity(K id)booleanisRemotable(Throwable throwable)Checks whether the suppliedThrowableis remotable meaning it can be safely sent to the client over the wire.voidrelease(V value)Decreases the objects usage count.voidremove(K id)Remove and destroy the specified object from cache.voidstart()voidstop()
-
-
-
Constructor Detail
-
DistributableCache
public DistributableCache(BeanManager<K,V,org.wildfly.clustering.ee.Batch> manager, StatefulObjectFactory<V> factory, javax.transaction.TransactionSynchronizationRegistry tsr)
-
-
Method Detail
-
getStrictAffinity
public org.jboss.ejb.client.Affinity getStrictAffinity()
- Specified by:
getStrictAffinityin interfaceAffinitySupport<K>
-
getWeakAffinity
public org.jboss.ejb.client.Affinity getWeakAffinity(K id)
- Specified by:
getWeakAffinityin interfaceAffinitySupport<K>
-
getIdentifierFactory
public Supplier<K> getIdentifierFactory()
Description copied from interface:CacheReturns the identifier factory of this cache.- Specified by:
getIdentifierFactoryin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Returns:
- an identifier factory
-
create
public V create()
Description copied from interface:CacheCreates and caches a new instance ofT.- Specified by:
createin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Returns:
- a new
T
-
get
public V get(K id)
Description copied from interface:CacheGet the specified object from cache. This will mark the object as being in use, and increase its usage count.- Specified by:
getin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Parameters:
id- the identifier of the object- Returns:
- the object, or null if it does not exist
-
release
public void release(V value)
Description copied from interface:CacheDecreases the objects usage count. If the usage count hits 0 then the object will be released.- Specified by:
releasein interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Parameters:
value- the object
-
remove
public void remove(K id)
Description copied from interface:CacheRemove and destroy the specified object from cache.- Specified by:
removein interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Parameters:
id- the identifier of the object
-
discard
public void discard(V value)
Description copied from interface:CacheDiscard the specified object from cache.- Specified by:
discardin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Parameters:
value- the object to discard
-
contains
public boolean contains(K id)
Description copied from interface:CacheIndicates whether or not the specified key is contained within this cache.- Specified by:
containsin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>- Parameters:
id- the cache key- Returns:
trueif the key is present in the cache,falseotherwise.
-
start
public void start()
- Specified by:
startin interfaceorg.wildfly.clustering.ee.Restartable
-
stop
public void stop()
- Specified by:
stopin interfaceorg.wildfly.clustering.ee.Restartable
-
getCacheSize
public int getCacheSize()
- Specified by:
getCacheSizein interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>
-
getPassivatedCount
public int getPassivatedCount()
- Specified by:
getPassivatedCountin interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>
-
getTotalSize
public int getTotalSize()
- Specified by:
getTotalSizein interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>
-
isRemotable
public boolean isRemotable(Throwable throwable)
Description copied from interface:CacheChecks whether the suppliedThrowableis remotable meaning it can be safely sent to the client over the wire.- Specified by:
isRemotablein interfaceCache<K,V extends Identifiable<K> & Contextual<org.wildfly.clustering.ee.Batch>>
-
-