|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PojoCache
Main PojoCache APIs. PojoCache is an in-memory, transactional, fine-grained, and object-oriented POJO (plain old Java object) distributed cache system. It differs from the traditional generic distributed cache library by operating on the POJO level directly without requiring that object to be serializable. It can preserve object graph relationship during replication or persistency. It also track the replication via fine-grained maner, i.e., only modified fields are replicated.
Method Summary | |
---|---|
void |
addListener(Object listener)
Add a PojoCache listener. |
void |
addListener(Object listener,
Pattern pattern)
Add a PojoCache listener that will only monitor a specific ID(FQN) pattern. |
Object |
attach(Fqn<?> id,
Object pojo)
Attach a POJO into PojoCache. |
Object |
attach(String id,
Object pojo)
Attach a POJO into PojoCache. |
void |
create()
Lifecycle method to start PojoCache. |
void |
destroy()
Lifecycle method to destroy PojoCache. |
Object |
detach(Fqn<?> id)
Remove POJO object from the cache. |
Object |
detach(String id)
Remove POJO object from the cache. |
boolean |
exists(Fqn<?> id)
Determines if an object is attached at a particular location. |
Object |
find(Fqn<?> id)
Retrieve POJO from the cache system. |
Object |
find(String id)
Retrieve POJO from the cache system. |
Map<Fqn<?>,Object> |
findAll(Fqn<?> id)
Query all managed POJO objects under the id recursively. |
Map<Fqn<?>,Object> |
findAll(String id)
Query all managed POJO objects under the id recursively. |
Cache<Object,Object> |
getCache()
Obtain the underlying generic cache system. |
Collection<Object> |
getListeners()
Retrieve a read-only list of listeners. |
String |
getPojoID(Object pojo)
Return the POJO id that is associated with PojoCache. |
PojoCacheThreadContext |
getThreadContext()
Get's the thread context for all POJO Cache operations. |
void |
removeListener(Object listener)
Remove the specific listener. |
void |
start()
Lifecycle method to start PojoCache. |
void |
stop()
Lifecycle method to stop PojoCache. |
Method Detail |
---|
Object attach(String id, Object pojo) throws PojoCacheException
Attach a POJO into PojoCache. It will also recursively put any sub-POJO into the cache system. A POJO can be the following and have the consqeuences when attached:
Replicable
annotation (or via XML),
and has
been "instrumented" either compile- or load-time. The POJO will be mapped
recursively to the system and fine-grained replication will be
performed.
id
- An id String to identify the object in the cache. To promote
concurrency, we recommend the use of hierarchical String separating by a
designated separator. Default is "/" but it can be set differently via a
System property, jbosscache.separator in the future release. E.g., "/ben",
or "/student/joe", etc.pojo
- object to be inerted into the cache. If null, it will nullify
the fqn node.
PojoCacheException
- Throws if there is an error related to the cache operation.Object attach(Fqn<?> id, Object pojo) throws PojoCacheException
Attach a POJO into PojoCache. It will also recursively put any sub-POJO into the cache system. A POJO can be the following and have the consequences when attached:
Replicable
annotation (or via XML),
and has
been "instrumented" either compile- or load-time. The POJO will be mapped
recursively to the system and fine-grained replication will be
performed.
id
- the Fqn that specifies the location in the cache to attach the objectpojo
- object to be inserted into the cache. If null, it will nullify
the fqn node.
PojoCacheException
- Throws if there is an error related to the cache operation.Object detach(String id) throws PojoCacheException
id
- Is string that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.Object detach(Fqn<?> id) throws PojoCacheException
id
- location of the object to remove
PojoCacheException
- Throws if there is an error related to the cache operation.String getPojoID(Object pojo)
pojo
- The POJO that is attached to PojoCache.
boolean exists(Fqn<?> id)
id
- the location in the cache to examine
Object find(String id) throws PojoCacheException
id
- that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.Object find(Fqn<?> id) throws PojoCacheException
id
- that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.Map<Fqn<?>,Object> findAll(String id) throws PojoCacheException
id
- The starting place to find all POJOs.
PojoCacheException
- Throws if there is an error related to the cache operation.Map<Fqn<?>,Object> findAll(Fqn<?> id) throws PojoCacheException
id
- The starting place to find all POJOs.
PojoCacheException
- Throws if there is an error related to the cache operation.void create() throws PojoCacheException
PojoCacheException
void start() throws PojoCacheException
PojoCacheException
void stop() throws PojoCacheException
PojoCacheException
void destroy() throws PojoCacheException
PojoCacheException
void addListener(Object listener)
Add a PojoCache listener. A given listener instance can only be added once. To have a duplicate listener simply create a new instance.
The listener must be annotated with the PojoCacheListener
annotation, and
all callback methods need to be annotated with the respective event annotations.
Otherwise, an exception will be thrown.
listener
- the listener instance to register
IllegalArgumentException
- if listener does not conform to annotation requirementsfor examples
void addListener(Object listener, Pattern pattern)
Add a PojoCache listener that will only monitor a specific ID(FQN) pattern. A given listener instance can only be added once, whether or not there is a pattern. To have a duplicate listener simply create a new instance.
The listener must be annotated with the PojoCacheListener
annotation, and
all callback methods need to be annotated with the respective event annotations.
Otherwise, an exception will be thrown.
listener
- the listener instance to registerpattern
- the ID pattern for notifications of interest
IllegalArgumentException
- if listener does not conform to annotation requirementsfor examples
Collection<Object> getListeners()
void removeListener(Object listener)
listener
- the listener to removePojoCacheThreadContext getThreadContext()
Cache<Object,Object> getCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |