public class AtomicObjectFactory extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_CONTAINERS |
static Map<Class<?>,List<String>> |
updateMethods |
Constructor and Description |
---|
AtomicObjectFactory(Cache<?,?> c)
Return an AtomicObjectFactory built on top of cache c.
|
AtomicObjectFactory(Cache<?,?> c,
int m)
Returns an object factory built on top of cache c with a bounded amount m of
containers in it.
|
Modifier and Type | Method and Description |
---|---|
void |
disposeInstanceOf(Class<?> clazz,
Object key,
boolean keepPersistent)
Remove the object stored at keyfrom the local state.
|
static AtomicObjectFactory |
forCache(Cache<?,?> cache) |
<T> T |
getInstanceOf(Class<T> clazz,
Object key)
Returns an atomic object of class clazz.
|
<T> T |
getInstanceOf(Class<T> clazz,
Object key,
boolean withReadOptimization)
Returns an object of class clazz.
|
<T> T |
getInstanceOf(Class<T> clazz,
Object key,
boolean withReadOptimization,
Method equalsMethod,
boolean forceNew,
Object... initArgs)
Returns an object of class clazz.
|
protected static final int MAX_CONTAINERS
public AtomicObjectFactory(Cache<?,?> c, int m) throws InvalidCacheUsageException
c
- it must be synchronous.and transactional (with autoCommit set to true, its default value).m
- max amount of containers kept by this factory.InvalidCacheUsageException
public AtomicObjectFactory(Cache<?,?> c) throws InvalidCacheUsageException
c
- a cache, it must be synchronous.and transactional (with autoCommit set to true, its default value).InvalidCacheUsageException
public static AtomicObjectFactory forCache(Cache<?,?> cache)
public <T> T getInstanceOf(Class<T> clazz, Object key) throws InvalidCacheUsageException
clazz
- a class objectkey
- to use in order to store the object.InvalidCacheUsageException
public <T> T getInstanceOf(Class<T> clazz, Object key, boolean withReadOptimization) throws InvalidCacheUsageException
clazz
- a class objectkey
- the key to use in order to store the object.withReadOptimization
- set the read optimization on/off.InvalidCacheUsageException
public <T> T getInstanceOf(Class<T> clazz, Object key, boolean withReadOptimization, Method equalsMethod, boolean forceNew, Object... initArgs) throws InvalidCacheUsageException
clazz
- a class objectkey
- the key to use in order to store the object.withReadOptimization
- set the read optimization on/off.equalsMethod
- overriding the default clazz.equals().forceNew
- force the creation of the object, even if it exists already in the cacheInvalidCacheUsageException
public void disposeInstanceOf(Class<?> clazz, Object key, boolean keepPersistent) throws InvalidCacheUsageException
clazz
- a class objectkey
- the key to use in order to store the object.keepPersistent
- indicates that a persistent copy is stored in the cache or not.InvalidCacheUsageException
Copyright © 2020 JBoss, a division of Red Hat. All rights reserved.