|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.cache.TreeCache org.jboss.cache.aop.PojoCache
public class PojoCache
PojoCache implementation class. User should use the PojoCacheIfc
interface directly to
access the public APIs.
PojoCache is an in-memory, transactional, fine-grained, and object-oriented cache system. It differs from the typical generic cache library by operating on the pojo level directly without requiring that object to be serializable (although it does require "aspectizing" the POJO). Further, it can preserve object graph during replication or persistency. It also track the replication via fine-grained maner, i.e., only changed fields are replicated.
Field Summary | |
---|---|
protected java.util.Map |
cachedTypes
|
protected TreeCacheAopDelegate |
delegate_
|
protected java.lang.ThreadLocal |
hasSynchronizationHandler_
|
protected java.lang.String |
LOCK
|
protected boolean |
marshallNonSerializable_
|
protected int |
RETRY
|
protected java.lang.ThreadLocal |
undoListLocal_
|
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
---|
server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.system.ServiceMBean |
---|
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
---|---|
PojoCache()
|
|
PojoCache(org.jgroups.JChannel channel)
|
|
PojoCache(java.lang.String cluster_name,
java.lang.String props,
long state_fetch_timeout)
|
Method Summary | |
---|---|
java.lang.Object |
_evictObject(Fqn fqn)
Used by internal implementation. |
protected void |
_evictSubtree(Fqn subtree)
Evicts the node at subtree along with all descendant nodes. |
java.util.Map |
_findObjects(Fqn fqn)
Used by internal implementation. |
java.lang.Object |
_getObject(Fqn fqn)
Used by internal implementation. |
java.lang.Object |
_putObject(Fqn fqn,
java.lang.Object obj)
Used by internal implementation. |
java.lang.Object |
_removeObject(Fqn fqn)
Used by internal implementation. |
java.lang.Object |
_removeObject(Fqn fqn,
boolean removeCacheInterceptor)
Used by internal implementation. |
protected void |
acquireLocksForStateTransfer(DataNode root,
java.lang.Object lockOwner,
long timeout,
boolean force)
Overrides the superclass version by additionally acquiring locks on the internal reference map nodes used for tracking shared objects. |
void |
activateRegion(java.lang.String subtreeFqn)
Overrides the superclass method by
ensuring that the internal region where information on shared object is stored
has been activated. |
void |
addUndoCollectionProxy(java.lang.reflect.Field field,
java.lang.Object key,
java.lang.Object oldValue)
|
void |
addUndoInterceptor(org.jboss.aop.InstanceAdvisor advisor,
BaseInterceptor interceptor,
int op)
|
protected void |
createEvictionPolicy()
|
protected void |
endTransaction(Fqn fqn)
|
void |
evict(Fqn fqn)
Override to provide aop specific eviction. |
java.util.Map |
findObjects(Fqn fqn)
Query all managed pojo objects under the fqn recursively. |
java.util.Map |
findObjects(java.lang.String fqn)
Query all managed pojo objects under the fqn recursively. |
CachedType |
getCachedType(java.lang.Class clazz)
Obtain a cache aop type for user to traverse the defined "primitive" types in aop. |
java.util.List |
getModList()
|
java.lang.Object |
getObject(Fqn fqn)
Retrieve pojo object from the cache. |
java.lang.Object |
getObject(java.lang.String fqn)
Retrieve pojo from the cache. |
org.w3c.dom.Element |
getPojoCacheConfig()
|
protected boolean |
hasCurrentTransaction()
|
protected void |
init()
|
boolean |
isMarshallNonSerializable()
Indicate whether the flag is set or not. |
protected boolean |
lockPojo(java.lang.Object owner,
Fqn fqn)
|
protected void |
parseConfig()
|
java.lang.Object |
putObject(Fqn fqn,
java.lang.Object obj)
Insert a pojo into the cache. |
java.lang.Object |
putObject(java.lang.String fqn,
java.lang.Object obj)
Insert a pojo into the cache. |
protected void |
registerTxHandler()
|
protected void |
releasePojo(java.lang.Object owner,
Fqn fqn)
|
protected void |
releaseStateTransferLocks(DataNode root,
java.lang.Object lockOwner)
Overrides the superclass version by additionally releasing locks on the internal reference map nodes used for tracking shared objects. |
java.lang.Object |
removeObject(Fqn fqn)
Remove pojo object from the cache. |
java.lang.Object |
removeObject(java.lang.String fqn)
Remove pojo object from the cache. |
void |
resetUndoOp()
|
void |
setEvictionPolicyClass(java.lang.String eviction_policy_class)
Over-ride to make sure we are using an eviction policy specific to aop. |
void |
setMarshallNonSerializable(boolean marshall)
If the flag is set, then POJO which is not instrumented under AOP and which is not implementing the Serializable interface will still be marshalled and make serializable. |
void |
setPojoCacheConfig(org.w3c.dom.Element config)
Inject the config element that is specific to PojoCache. |
void |
startService()
Lifecyle method. |
void |
stopService()
Lifecycle method. |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
---|
create, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
---|
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.system.ServiceMBean |
---|
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
---|
create, destroy, start, stop |
Field Detail |
---|
protected java.util.Map cachedTypes
protected TreeCacheAopDelegate delegate_
protected final java.lang.String LOCK
protected final int RETRY
protected boolean marshallNonSerializable_
protected java.lang.ThreadLocal undoListLocal_
protected java.lang.ThreadLocal hasSynchronizationHandler_
Constructor Detail |
---|
public PojoCache(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout) throws java.lang.Exception
java.lang.Exception
public PojoCache() throws java.lang.Exception
java.lang.Exception
public PojoCache(org.jgroups.JChannel channel) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
protected void init()
public void startService() throws java.lang.Exception
TreeCache
start
startService
in interface TreeCacheMBean
startService
in class TreeCache
java.lang.Exception
public void stopService()
TreeCache
stop
.
stopService
in interface TreeCacheMBean
stopService
in class TreeCache
protected void parseConfig()
public void setEvictionPolicyClass(java.lang.String eviction_policy_class)
setEvictionPolicyClass
in interface TreeCacheMBean
setEvictionPolicyClass
in class TreeCache
public void addUndoInterceptor(org.jboss.aop.InstanceAdvisor advisor, BaseInterceptor interceptor, int op)
public void addUndoCollectionProxy(java.lang.reflect.Field field, java.lang.Object key, java.lang.Object oldValue)
public void resetUndoOp()
public java.util.List getModList()
public void evict(Fqn fqn) throws CacheException
evict
in interface TreeCacheMBean
evict
in class TreeCache
fqn
- Will remove everythign assoicated with this fqn.
CacheException
protected void createEvictionPolicy()
createEvictionPolicy
in class TreeCache
protected void _evictSubtree(Fqn subtree) throws CacheException
TreeCache
subtree
along with all descendant nodes.
_evictSubtree
in class TreeCache
subtree
- Fqn indicating the uppermost node in the
portion of the tree that should be evicted.
CacheException
public void activateRegion(java.lang.String subtreeFqn) throws RegionNotEmptyException, RegionNameConflictException, CacheException
superclass method
by
ensuring that the internal region where information on shared object is stored
has been activated.
activateRegion
in interface TreeCacheMBean
activateRegion
in class TreeCache
subtreeFqn
- Fqn string indicating the uppermost node in the
portion of the tree that should be activated.
RegionNotEmptyException
- if the node subtreeFqn
exists and has either data or children
RegionNameConflictException
CacheException
protected void acquireLocksForStateTransfer(DataNode root, java.lang.Object lockOwner, long timeout, boolean force) throws java.lang.Exception
java.lang.Exception
protected void releaseStateTransferLocks(DataNode root, java.lang.Object lockOwner)
public CachedType getCachedType(java.lang.Class clazz)
getCachedType
in interface PojoCacheIfc
clazz
- The original pojo class
public java.lang.Object getObject(java.lang.String fqn) throws CacheException
PojoCacheIfc
getObject
in interface PojoCacheIfc
fqn
- Instance that associates with this node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.lang.Object getObject(Fqn fqn) throws CacheException
PojoCacheIfc
getObject
in interface PojoCacheIfc
fqn
- Instance that associates with this node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.lang.Object putObject(java.lang.String fqn, java.lang.Object obj) throws CacheException
PojoCacheIfc
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface PojoCacheIfc
fqn
- The fqn instance to associate with the object in the cache.obj
- aop-enabled object to be inerted into the cache. If null,
it will nullify the fqn node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.lang.Object putObject(Fqn fqn, java.lang.Object obj) throws CacheException
PojoCacheIfc
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface PojoCacheIfc
fqn
- The fqn instance to associate with the object in the cache.obj
- aop-enabled object to be inerted into the cache. If null,
it will nullify the fqn node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.lang.Object removeObject(java.lang.String fqn) throws CacheException
PojoCacheIfc
removeObject
in interface PojoCacheIfc
fqn
- Instance that associates with this node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.lang.Object removeObject(Fqn fqn) throws CacheException
PojoCacheIfc
removeObject
in interface PojoCacheIfc
fqn
- Instance that associates with this node.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.util.Map findObjects(java.lang.String fqn) throws CacheException
PojoCacheIfc
findObjects
in interface PojoCacheIfc
fqn
- The starting place to find all pojos.
CacheException
- Throws if there is an error related to the cache operation, e.g.,
TimeoutException
.public java.util.Map findObjects(Fqn fqn) throws CacheException
PojoCacheIfc
findObjects
in interface PojoCacheIfc
fqn
- The starting place to find all pojos.
CacheException
public void setMarshallNonSerializable(boolean marshall)
PojoCacheIfc
setMarshallNonSerializable
in interface PojoCacheIfc
public boolean isMarshallNonSerializable()
PojoCacheIfc
isMarshallNonSerializable
in interface PojoCacheIfc
public void setPojoCacheConfig(org.w3c.dom.Element config) throws CacheException
setPojoCacheConfig
in interface PojoCacheMBean
setPojoCacheConfig
in interface TreeCacheMBean
setPojoCacheConfig
in class TreeCache
config
-
CacheException
public org.w3c.dom.Element getPojoCacheConfig()
getPojoCacheConfig
in interface PojoCacheMBean
getPojoCacheConfig
in interface TreeCacheMBean
getPojoCacheConfig
in class TreeCache
protected boolean lockPojo(java.lang.Object owner, Fqn fqn) throws CacheException
CacheException
protected void releasePojo(java.lang.Object owner, Fqn fqn) throws CacheException
CacheException
protected boolean hasCurrentTransaction()
protected void endTransaction(Fqn fqn)
public java.lang.Object _getObject(Fqn fqn) throws CacheException
CacheException
public java.lang.Object _putObject(Fqn fqn, java.lang.Object obj) throws CacheException
CacheException
protected void registerTxHandler() throws CacheException
CacheException
public java.lang.Object _removeObject(Fqn fqn) throws CacheException
CacheException
public java.lang.Object _removeObject(Fqn fqn, boolean removeCacheInterceptor) throws CacheException
CacheException
public java.lang.Object _evictObject(Fqn fqn) throws CacheException
CacheException
public java.util.Map _findObjects(Fqn fqn) throws CacheException
CacheException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |