|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.CacheImpl<K,V>
public class CacheImpl<K,V>
The default implementation class of Cache
and CacheSPI
. This class
has its roots in the legacy (JBoss Cache 1.x.x) org.jboss.cache.TreeCache class.
Cache
or CacheSPI
interfaces directly to this class.
Cache
Nested Class Summary | |
---|---|
protected class |
CacheImpl.MembershipListenerAdaptor
|
protected class |
CacheImpl.MessageListenerAdaptor
|
Field Summary | |
---|---|
protected org.jgroups.Channel |
channel
The JGroups JChannel in use. |
Constructor Summary | |
---|---|
protected |
CacheImpl()
Constructs an uninitialized CacheImpl. |
Method Summary | ||
---|---|---|
void |
_addChild(GlobalTransaction gtx,
Fqn parent_fqn,
java.lang.Object child_name,
Node cn,
boolean undoOps)
Compensating method to _remove(GlobalTransaction,Fqn,boolean) . |
|
void |
_block()
|
|
java.util.List |
_clusteredGet(MethodCall methodCall,
java.lang.Boolean searchBackupSubtrees)
A 'clustered get' call, called from a remote ClusteredCacheLoader. |
|
void |
_dataGravitationCleanup(GlobalTransaction gtx,
Fqn primary,
Fqn backup)
|
|
boolean |
_evict(Fqn fqn)
Internal evict method called by eviction policy provider. |
|
boolean |
_evict(Fqn fqn,
DataVersion version)
Internal evict method called by eviction policy provider. |
|
protected void |
_evictSubtree(Fqn subtree)
Evicts the node at subtree along with all descendant nodes. |
|
Node<K,V> |
_get(Fqn<?> fqn)
Returns the raw data of the node; called externally internally. |
|
V |
_get(Fqn<?> fqn,
K key,
boolean sendNodeEvent)
|
|
|
_getChildrenNames(Fqn<E> fqn)
|
|
java.util.Map |
_getData(Fqn<?> fqn)
Returns the raw data of the node; called externally internally. |
|
java.util.Set |
_getKeys(Fqn<?> fqn)
|
|
void |
_lock(Fqn fqn,
NodeLock.LockType lock_type,
boolean recursive)
Should not be called. |
|
void |
_move(Fqn nodeToMoveFqn,
Fqn newParentFqn)
Called by reflection |
|
java.lang.String |
_print(Fqn fqn)
Finds and returns the string value for the Fqn. |
|
java.lang.Object |
_put(GlobalTransaction tx,
Fqn fqn,
K key,
V value,
boolean create_undo_ops)
Internal put method. |
|
java.lang.Object |
_put(GlobalTransaction tx,
Fqn fqn,
K key,
V value,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
java.util.Map<K,V> data,
boolean create_undo_ops)
Internal put method. |
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
java.util.Map<K,V> data,
boolean create_undo_ops,
boolean erase_contents)
Internal put method. |
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
java.util.Map<K,V> data,
boolean create_undo_ops,
boolean erase_contents,
DataVersion dv)
|
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
java.util.Map<K,V> data,
boolean create_undo_ops,
DataVersion dv)
|
|
java.lang.Object |
_put(GlobalTransaction tx,
java.lang.String fqn,
K key,
V value,
boolean create_undo_ops)
Internal put method. |
|
void |
_put(GlobalTransaction tx,
java.lang.String fqn,
java.util.Map<K,V> data,
boolean create_undo_ops)
Internal put method. |
|
void |
_putForExternalRead(GlobalTransaction gtx,
Fqn fqn,
K key,
V value)
|
|
void |
_putForExternalRead(GlobalTransaction gtx,
Fqn fqn,
K key,
V value,
DataVersion dv)
|
|
void |
_releaseAllLocks(Fqn fqn)
Releases all locks for a FQN. |
|
void |
_remoteAnnounceBuddyPoolName(org.jgroups.Address address,
java.lang.String buddyPoolName)
|
|
void |
_remoteAssignToBuddyGroup(BuddyGroup group,
java.util.Map<Fqn,byte[]> state)
|
|
void |
_remoteRemoveFromBuddyGroup(java.lang.String groupName)
|
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops)
Internal remove method. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent)
|
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction)
Internal method to remove a node. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction,
DataVersion version)
Internal method to remove a node. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
DataVersion dv)
|
|
V |
_remove(GlobalTransaction tx,
Fqn fqn,
K key,
boolean create_undo_ops)
Internal method to remove a key. |
|
java.lang.Object |
_remove(GlobalTransaction tx,
Fqn fqn,
K key,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_remove(GlobalTransaction tx,
java.lang.String fqn,
boolean create_undo_ops)
Internal remove method. |
|
V |
_remove(GlobalTransaction tx,
java.lang.String fqn,
K key,
boolean create_undo_ops)
Internal method to remove a key. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction,
DataVersion version)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_removeData(GlobalTransaction tx,
java.lang.String fqn,
boolean create_undo_ops)
Internal method to remove data from a node. |
|
void |
_replicate(java.util.List<MethodCall> methodCalls)
Replicates a list of method calls. |
|
java.lang.Object |
_replicate(MethodCall method_call)
Replicates changes across to other nodes in the cluster. |
|
void |
_unblock()
|
|
void |
addCacheListener(Fqn<?> region,
java.lang.Object listener)
Adds a CacheListener to a given region. |
|
void |
addCacheListener(java.lang.Object listener)
Adds a CacheListener to the entire cache. |
|
void |
addInterceptor(Interceptor i,
int position)
Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the chain is at position 0 and the last one at getInterceptorChain().size() - 1. |
|
void |
addUndoOperation(GlobalTransaction gtx,
MethodCall undo_op)
Adds an undo operatoin to the transaction table. |
|
java.util.List |
callRemoteMethods(java.util.List<org.jgroups.Address> mbrs,
MethodCall method_call,
boolean synchronous,
boolean exclude_self,
long timeout)
Deprecated. Note this is due to be moved to an interceptor. |
|
java.util.List |
callRemoteMethods(java.util.List<org.jgroups.Address> mbrs,
MethodCall method_call,
int mode,
boolean exclude_self,
long timeout)
Deprecated. Note this is due to be moved to an interceptor. |
|
java.util.List |
callRemoteMethods(java.util.List<org.jgroups.Address> members,
java.lang.reflect.Method method,
java.lang.Object[] args,
boolean synchronous,
boolean exclude_self,
long timeout)
Deprecated. Note this is due to be moved to an interceptor. |
|
java.util.List |
callRemoteMethods(java.util.Vector<org.jgroups.Address> members,
java.lang.String method_name,
java.lang.Class[] types,
java.lang.Object[] args,
boolean synchronous,
boolean exclude_self,
long timeout)
Deprecated. Note this is due to be moved to an interceptor. |
|
void |
commit(GlobalTransaction tx)
Throws UnsupportedOperationException. |
|
void |
create()
Lifecycle method. |
|
protected void |
createEvictionPolicy()
|
|
protected Node |
createSubtreeRootNode(Fqn<?> subtree)
Creates a subtree in the local cache. |
|
void |
destroy()
Lifecycle method. |
|
java.lang.String |
dumpTransactionTable()
Returns the contents of the TransactionTable as a string. |
|
void |
evict(Fqn fqn)
Called by eviction policy provider. |
|
void |
evict(Fqn<?> fqn,
boolean recursive)
Eviction call that evicts the specified Node from memory. |
|
boolean |
exists(Fqn<?> fqn)
Checks whether a given node exists in current in-memory state of the cache. |
|
boolean |
exists(Fqn<?> fqn,
java.lang.Object key)
Checks whether a given key exists in the given node. |
|
boolean |
exists(java.lang.String fqn)
Checks whether a given node exists in current in-memory state of the cache. |
|
boolean |
exists(java.lang.String fqn,
java.lang.Object key)
|
|
void |
fetchState(long timeout)
Fetches the group state from the current coordinator. |
|
protected void |
fetchStateOnStartup()
|
|
NodeSPI<K,V> |
findNode(Fqn fqn)
Finds a node given a fully qualified name. |
|
Node<K,V> |
get(Fqn<?> fqn)
Returns a DataNode corresponding to the fully qualified name or null if does not exist. |
|
V |
get(Fqn<?> fqn,
K key)
Finds a node given its name and returns the value associated with a given key in its data
map. |
|
protected V |
get(Fqn<?> fqn,
K key,
boolean sendNodeEvent)
|
|
Node |
get(java.lang.String fqn)
|
|
V |
get(java.lang.String fqn,
K key)
Finds a node given its name and returns the value associated with a given key in its data
map. |
|
BuddyManager |
getBuddyManager()
Retrieves the Buddy Manager configured. |
|
java.util.Set<java.lang.Object> |
getCacheListeners()
Retrieves an immutable List of objects annotated as CacheListener s attached to the cache. |
|
java.util.Set<java.lang.Object> |
getCacheListeners(Fqn<?> region)
Retrieves an immutable List of objects annotated as CacheListener s attached to a specific region. |
|
CacheLoader |
getCacheLoader()
Returns the underlying cache loader in use. |
|
CacheLoaderManager |
getCacheLoaderManager()
Returns the CacheLoaderManager. |
|
CacheStatus |
getCacheStatus()
Gets where the cache currently is its lifecycle transitions. |
|
|
getChildrenNames(Fqn<E> fqn)
Returns all children of a given node. |
|
java.util.Set |
getChildrenNames(java.lang.String fqn)
Returns all children of a given node. |
|
java.lang.String |
getClusterName()
|
|
Configuration |
getConfiguration()
Retrieves the configuration of this cache. |
|
org.jgroups.Address |
getCoordinator()
Returns the address of the coordinator or null if there is no coordinator. |
|
GlobalTransaction |
getCurrentTransaction()
Returns the transaction associated with the current thread. |
|
GlobalTransaction |
getCurrentTransaction(boolean createIfNotExists)
Returns the transaction associated with the thread; optionally creating it if is does not exist. |
|
GlobalTransaction |
getCurrentTransaction(javax.transaction.Transaction tx)
Returns the global transaction for this local transaction. |
|
GlobalTransaction |
getCurrentTransaction(javax.transaction.Transaction tx,
boolean createIfNotExists)
Returns the global transaction for this local transaction. |
|
protected java.lang.String |
getDefaultProperties()
Returns the default JGroup properties. |
|
java.lang.String |
getEvictionInterceptorClass()
|
|
java.util.List<Interceptor> |
getInterceptorChain()
|
|
java.util.List<Interceptor> |
getInterceptors()
|
|
java.util.Set<Fqn> |
getInternalFqns()
Returns a Set |
|
InvocationContext |
getInvocationContext()
|
|
java.util.Set<K> |
getKeys(Fqn<?> fqn)
Returns a set of attribute keys for the Fqn. |
|
java.util.Set |
getKeys(java.lang.String fqn)
Returns a set of attribute keys for the Fqn. |
|
org.jgroups.Address |
getLocalAddress()
Returns the local channel address. |
|
protected javax.transaction.Transaction |
getLocalTransaction()
Returns the transaction associated with the current thread. |
|
java.util.Map<java.lang.Thread,java.util.List<NodeLock>> |
getLockTable()
Returns the lock table. |
|
Marshaller |
getMarshaller()
Retrieves an instance of a Marshaller , which is capable of
converting Java objects to bytestreams and back in an efficient manner, which is
also interoperable with bytestreams produced/consumed by other versions of JBoss
Cache. |
|
java.util.List<org.jgroups.Address> |
getMembers()
Returns the members as a List. |
|
Notifier |
getNotifier()
|
|
int |
getNumberOfAttributes()
Returns an approximation of the total number of attributes in the cache. |
|
int |
getNumberOfAttributes(Fqn fqn)
Returns an approximation of the total number of attributes in this sub cache. |
|
int |
getNumberOfLocksHeld()
Returns the number of read or write locks held across the entire cache. |
|
int |
getNumberOfNodes()
Returns an approximation of the total number of nodes in the cache. |
|
protected java.lang.Object |
getOwnerForLock()
Returns an object suitable for use in node locking, either the current transaction or the current thread if there is no transaction. |
|
Region |
getRegion(Fqn<?> fqn,
boolean createIfAbsent)
Retrieves a Region for a given Fqn . |
|
RegionManager |
getRegionManager()
|
|
ReplicationQueue |
getReplicationQueue()
Returns the replication queue. |
|
NodeSPI<K,V> |
getRoot()
Returns the root node. |
|
RPCManager |
getRPCManager()
Gets a handle of the RPC manager. |
|
StateTransferManager |
getStateTransferManager()
|
|
javax.transaction.TransactionManager |
getTransactionManager()
Returns the transaction manager in use. |
|
TransactionTable |
getTransactionTable()
Returns the transaction table. |
|
java.lang.String |
getVersion()
Returns the CacheImpl implementation version. |
|
GravitateResult |
gravitateData(Fqn fqn,
boolean searchSubtrees)
Used with buddy replication's data gravitation interceptor. |
|
boolean |
hasChild(Fqn fqn)
Returns true if the FQN exists and the node has children. |
|
protected java.lang.Object |
invokeMethod(MethodCall m,
boolean originLocal)
Invokes a method against this object. |
|
boolean |
isCoordinator()
Returns true if this node is the group coordinator. |
|
boolean |
isStarted()
|
|
void |
killChannel()
Kills the JGroups channel; an unclean channel disconnect |
|
void |
load(java.lang.String fqn)
Loads the indicated Fqn, plus all parents recursively from the CacheLoader. |
|
void |
move(Fqn<?> nodeToMove,
Fqn<?> newParent)
New API to efficiently relocate a node |
|
void |
optimisticPrepare(GlobalTransaction gtx,
java.util.List modifications,
java.util.Map data,
org.jgroups.Address address,
boolean onePhaseCommit)
Throws UnsupportedOperationException. |
|
NodeSPI<K,V> |
peek(Fqn<?> fqn,
boolean includeDeletedNodes)
Gets node without attempt to load it from CacheLoader if not present |
|
void |
prepare(GlobalTransaction global_tx,
java.util.List modifications,
org.jgroups.Address coord,
boolean onePhaseCommit)
Throws UnsupportedOperationException. |
|
java.lang.String |
print(Fqn fqn)
Prints a representation of the node defined by fqn . |
|
java.lang.String |
print(java.lang.String fqn)
Prints a representation of the node defined by fqn . |
|
java.lang.String |
printDetails()
Prints information about the contents of the nodes in the cache's current in-memory state. |
|
java.lang.String |
printLockInfo()
Returns lock information. |
|
void |
purgeCacheLoaders()
Purges the contents of all configured CacheLoader s |
|
V |
put(Fqn<?> fqn,
K key,
V value)
Adds a key and value to a given node. |
|
void |
put(Fqn<?> fqn,
java.util.Map<K,V> data)
Sets a node's data. |
|
void |
put(Fqn<?> fqn,
java.util.Map<K,V> data,
boolean erase)
|
|
V |
put(java.lang.String fqn,
K key,
V value)
Adds a key and value to a given node. |
|
void |
put(java.lang.String fqn,
java.util.Map data)
Adds a new node to the cache and sets its data. |
|
void |
putForExternalRead(Fqn<?> fqn,
K key,
V value)
Under special operating behavior, associates the value with the specified key for a node identified by the Fqn passed in. |
|
boolean |
realRemove(Fqn f,
boolean skipMarkerCheck)
Internal method; not to be used externally. |
|
void |
releaseAllLocks(Fqn fqn)
Releases all locks for this node and the entire node subtree. |
|
void |
releaseAllLocks(java.lang.String fqn)
Releases all locks for this node and the entire node subtree. |
|
boolean |
remove(Fqn fqn)
Removes the node from the cache. |
|
V |
remove(Fqn<?> fqn,
K key)
Removes key from the node's hashmap |
|
void |
remove(java.lang.String fqn)
Removes the node from the cache. |
|
V |
remove(java.lang.String fqn,
K key)
Removes key from the node's hashmap |
|
void |
removeCacheListener(Fqn<?> region,
java.lang.Object listener)
Removes a CacheListener from a given region. |
|
void |
removeCacheListener(java.lang.Object listener)
Removes a CacheListener from the cache. |
|
void |
removeData(Fqn fqn)
Removes the keys and properties from a named node. |
|
void |
removeData(java.lang.String fqn)
Removes the keys and properties from a node. |
|
void |
removeInterceptor(int position)
Removes the interceptor at a specified position, where the first interceptor in the chain is at position 0 and the last one at getInterceptorChain().size() - 1. |
|
boolean |
removeNode(Fqn<?> fqn)
Removes a Node indicated by absolute Fqn . |
|
boolean |
removeRegion(Fqn<?> fqn)
Removes a region denoted by the Fqn passed in. |
|
void |
rollback(GlobalTransaction tx)
Throws UnsupportedOperationException. |
|
void |
setCacheLoader(CacheLoader loader)
Deprecated. only provided for backward compat |
|
void |
setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)
Sets the CacheLoaderManager. |
|
void |
setConfiguration(Configuration configuration)
|
|
void |
setInterceptorChain(Interceptor i)
Used for testing only - sets the interceptor chain. |
|
void |
setInvocationContext(InvocationContext ctx)
Sets the passed in InvocationContext as current. |
|
protected void |
setMessageListener(CacheImpl.MessageListenerAdaptor ml)
|
|
void |
setStateTransferManager(StateTransferManager manager)
|
|
void |
setTransactionManagerLookup(TransactionManagerLookup l)
Sets the TransactionManagerLookup object |
|
protected boolean |
shouldFetchStateOnStartup()
|
|
void |
start()
Lifecyle method. |
|
void |
stop()
Lifecycle method. |
|
java.lang.String |
toString()
Returns a debug string with few details. |
|
java.lang.String |
toString(boolean details)
Returns a debug string with optional details of contents. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected org.jgroups.Channel channel
Constructor Detail |
---|
protected CacheImpl() throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public StateTransferManager getStateTransferManager()
getStateTransferManager
in interface CacheSPI<K,V>
StateTransferManager
public void setStateTransferManager(StateTransferManager manager)
public Configuration getConfiguration()
Cache
getConfiguration
in interface Cache<K,V>
public java.lang.String getVersion()
getVersion
in interface Cache<K,V>
Version.printVersion()
public NodeSPI<K,V> getRoot()
getRoot
in interface Cache<K,V>
getRoot
in interface CacheSPI<K,V>
public org.jgroups.Address getLocalAddress()
getLocalAddress
in interface Cache<K,V>
null
if running in local mode.public java.util.List<org.jgroups.Address> getMembers()
getMembers
in interface Cache<K,V>
List
of members in the cluster, or null
if running in local mode.public boolean isCoordinator()
true
if this node is the group coordinator.
public TransactionTable getTransactionTable()
getTransactionTable
in interface CacheSPI<K,V>
TransactionTable
public java.util.Map<java.lang.Thread,java.util.List<NodeLock>> getLockTable()
getLockTable
in interface CacheSPI<K,V>
public java.lang.String dumpTransactionTable()
public void setInterceptorChain(Interceptor i)
public java.util.List<Interceptor> getInterceptors()
public CacheLoader getCacheLoader()
public java.lang.String getEvictionInterceptorClass()
public ReplicationQueue getReplicationQueue()
public void setTransactionManagerLookup(TransactionManagerLookup l)
public javax.transaction.TransactionManager getTransactionManager()
getTransactionManager
in interface CacheSPI<K,V>
public void fetchState(long timeout) throws org.jgroups.ChannelClosedException, org.jgroups.ChannelNotConnectedException
org.jgroups.ChannelClosedException
org.jgroups.ChannelNotConnectedException
public void create() throws CacheException
create
in interface Cache<K,V>
java.lang.Exception
CacheException
- if there are creation problemsprotected boolean shouldFetchStateOnStartup()
public void start() throws CacheException
start
in interface Cache<K,V>
CacheException
public void destroy()
destroy
in interface Cache<K,V>
public void stop()
stop
in interface Cache<K,V>
public CacheStatus getCacheStatus()
Cache
getCacheStatus
in interface Cache<K,V>
null
.public BuddyManager getBuddyManager()
getBuddyManager
in interface CacheSPI<K,V>
public java.util.Set<Fqn> getInternalFqns()
BuddyManager.BUDDY_BACKUP_SUBTREE
if buddy replication is
enabled.
null
.protected void createEvictionPolicy()
public void load(java.lang.String fqn) throws java.lang.Exception
fqn
-
java.lang.Exception
public org.jgroups.Address getCoordinator()
protected Node createSubtreeRootNode(Fqn<?> subtree) throws CacheException
CacheException
protected void _evictSubtree(Fqn subtree) throws CacheException
subtree
along with all descendant nodes.
subtree
- Fqn indicating the uppermost node in the
portion of the cache that should be evicted.
CacheException
protected void fetchStateOnStartup() throws java.lang.Exception
java.lang.Exception
public Node get(java.lang.String fqn) throws CacheException
fqn
- fqn String name to retrieve from cache
CacheException
public Node<K,V> get(Fqn<?> fqn) throws CacheException
fqn
- name of the DataNode to retreive
CacheException
public Node<K,V> _get(Fqn<?> fqn) throws CacheException
CacheException
public java.util.Map _getData(Fqn<?> fqn)
public java.util.Set getKeys(java.lang.String fqn) throws CacheException
fqn
- name of the node
CacheException
public java.util.Set<K> getKeys(Fqn<?> fqn) throws CacheException
fqn
- name of the node
CacheException
public java.util.Set _getKeys(Fqn<?> fqn) throws CacheException
CacheException
public V get(java.lang.String fqn, K key) throws CacheException
data
map. Returns null if the node was not found in the cache or the key was not found in the hashmap.
fqn
- The fully qualified name of the node.key
- The key.
CacheException
public V get(Fqn<?> fqn, K key) throws CacheException
data
map. Returns null if the node was not found in the cache or the key was not found in the hashmap.
get
in interface Cache<K,V>
fqn
- The fully qualified name of the node.key
- The key.
Node
denoted by specified Fqn.
CacheException
public V _get(Fqn<?> fqn, K key, boolean sendNodeEvent) throws CacheException
CacheException
protected V get(Fqn<?> fqn, K key, boolean sendNodeEvent) throws CacheException
CacheException
public boolean exists(java.lang.String fqn)
fqn
- The fully qualified name of the node
public boolean exists(Fqn<?> fqn)
fqn
- The fully qualified name of the node
public NodeSPI<K,V> peek(Fqn<?> fqn, boolean includeDeletedNodes)
peek
in interface CacheSPI<K,V>
fqn
- includeDeletedNodes
- if you intend to see nodes marked as deleted within the current tx, set this to true
public boolean exists(java.lang.String fqn, java.lang.Object key)
fqn
- key
- public boolean exists(Fqn<?> fqn, java.lang.Object key)
get(Fqn,Object)
fqn
- The fully qualified name of the nodekey
-
public void put(java.lang.String fqn, java.util.Map data) throws CacheException
fqn
- The fully qualified name of the new nodedata
- The new data. May be null if no data should be set in the node.
CacheException
public void put(Fqn<?> fqn, java.util.Map<K,V> data) throws CacheException
put
in interface Cache<K,V>
fqn
- The fully qualified name of the new nodedata
- The new data. May be null if no data should be set in the node.
CacheException
public void put(Fqn<?> fqn, java.util.Map<K,V> data, boolean erase) throws CacheException
CacheException
public V put(java.lang.String fqn, K key, V value) throws CacheException
fqn
- The fully qualified name of the nodekey
- The keyvalue
- The value
CacheException
public V put(Fqn<?> fqn, K key, V value) throws CacheException
put
in interface Cache<K,V>
fqn
- The fully qualified name of the nodekey
- The keyvalue
- The value
CacheException
public void remove(java.lang.String fqn) throws CacheException
fqn
- The fully qualified name of the node.
CacheException
public boolean remove(Fqn fqn) throws CacheException
fqn
- The fully qualified name of the node.
CacheException
public void evict(Fqn fqn) throws CacheException
get(java.lang.String)
returns null. After
that, the contents will be in sync.
fqn
- Will remove everythign assoicated with this fqn.
CacheException
public V remove(java.lang.String fqn, K key) throws CacheException
key
from the node's hashmap
fqn
- The fullly qualified name of the nodekey
- The key to be removed
CacheException
public V remove(Fqn<?> fqn, K key) throws CacheException
key
from the node's hashmap
remove
in interface Cache<K,V>
fqn
- The fullly qualified name of the nodekey
- The key to be removed
CacheException
public void removeData(java.lang.String fqn) throws CacheException
CacheException
public void removeData(Fqn fqn) throws CacheException
CacheException
public void releaseAllLocks(java.lang.String fqn)
public void releaseAllLocks(Fqn fqn)
public java.lang.String print(java.lang.String fqn)
fqn
.
Output includes name, fqn and data.
public java.lang.String print(Fqn fqn)
fqn
.
Output includes name, fqn and data.
public java.util.Set getChildrenNames(java.lang.String fqn) throws CacheException
fqn
- The fully qualified name of the node
CacheException
getChildrenNames(Fqn)
public <E> java.util.Set<E> getChildrenNames(Fqn<E> fqn) throws CacheException
fqn
- The fully qualified name of the node
CacheException
public <E> java.util.Set<E> _getChildrenNames(Fqn<E> fqn) throws CacheException
CacheException
public boolean hasChild(Fqn fqn)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean details)
public java.lang.String printDetails()
public java.lang.String printLockInfo()
public int getNumberOfLocksHeld()
public int getNumberOfNodes()
getNumberOfNodes
in interface CacheSPI<K,V>
public int getNumberOfAttributes()
getNumberOfAttributes
in interface CacheSPI<K,V>
public int getNumberOfAttributes(Fqn fqn)
getNumberOfAttributes()
@Deprecated public java.util.List callRemoteMethods(java.util.List<org.jgroups.Address> mbrs, MethodCall method_call, boolean synchronous, boolean exclude_self, long timeout) throws java.lang.Exception
mbrs
- method_call
- synchronous
- exclude_self
- timeout
-
java.lang.Exception
@Deprecated public java.util.List callRemoteMethods(java.util.List<org.jgroups.Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout) throws java.lang.Exception
mbrs
- method_call
- mode
- exclude_self
- timeout
-
java.lang.Exception
@Deprecated public java.util.List callRemoteMethods(java.util.List<org.jgroups.Address> members, java.lang.reflect.Method method, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout) throws java.lang.Exception
members
- method
- args
- synchronous
- exclude_self
- timeout
-
java.lang.Exception
@Deprecated public java.util.List callRemoteMethods(java.util.Vector<org.jgroups.Address> members, java.lang.String method_name, java.lang.Class[] types, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout) throws java.lang.Exception
members
- method_name
- types
- args
- synchronous
- exclude_self
- timeout
-
java.lang.Exception
public void _putForExternalRead(GlobalTransaction gtx, Fqn fqn, K key, V value, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, java.util.Map<K,V> data, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, java.util.Map<K,V> data, boolean create_undo_ops, boolean erase_contents, DataVersion dv) throws CacheException
CacheException
public java.lang.Object _put(GlobalTransaction tx, Fqn fqn, K key, V value, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public java.lang.Object _remove(GlobalTransaction tx, Fqn fqn, K key, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, java.lang.String fqn, java.util.Map<K,V> data, boolean create_undo_ops) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).
Otherwise they will not be created (used by rollback()).
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, java.util.Map<K,V> data, boolean create_undo_ops) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).
Otherwise they will not be created (used by rollback()).
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, java.util.Map<K,V> data, boolean create_undo_ops, boolean erase_contents) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).erase_contents
- Clear the existing hashmap before putting the new data into it
Otherwise they will not be created (used by rollback()).
CacheException
public java.lang.Object _put(GlobalTransaction tx, java.lang.String fqn, K key, V value, boolean create_undo_ops) throws CacheException
CacheException
public java.lang.Object _put(GlobalTransaction tx, Fqn fqn, K key, V value, boolean create_undo_ops) throws CacheException
CacheException
public void _remove(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction) throws CacheException
tx
- fqn
- create_undo_ops
- sendNodeEvent
-
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version) throws CacheException
DataVersion
which is used with optimistically locked nodes. Pass
in a null if optimistic locking is not used.
tx
- fqn
- create_undo_ops
- sendNodeEvent
- eviction
- version
-
CacheException
public V _remove(GlobalTransaction tx, java.lang.String fqn, K key, boolean create_undo_ops) throws CacheException
fqn
- key
-
CacheException
public V _remove(GlobalTransaction tx, Fqn fqn, K key, boolean create_undo_ops) throws CacheException
fqn
- key
-
CacheException
public void _removeData(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version) throws CacheException
CacheException
public boolean _evict(Fqn fqn) throws CacheException
fqn
- removes everything assoicated with this FQN
true
if the node has been completely removed,
false
if only the data map was removed, due
to the presence of children
CacheException
public boolean _evict(Fqn fqn, DataVersion version) throws CacheException
fqn
- version
-
true
if the node has been completely removed,
false
if only the data map was removed, due
to the presence of children
CacheException
public void _addChild(GlobalTransaction gtx, Fqn parent_fqn, java.lang.Object child_name, Node cn, boolean undoOps) throws CacheException
_remove(GlobalTransaction,Fqn,boolean)
.
CacheException
public java.lang.Object _replicate(MethodCall method_call) throws java.lang.Throwable
java.lang.Throwable
public void _replicate(java.util.List<MethodCall> methodCalls) throws java.lang.Throwable
java.lang.Throwable
public java.util.List _clusteredGet(MethodCall methodCall, java.lang.Boolean searchBackupSubtrees)
public GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees) throws CacheException
Configuration.useRegionBasedMarshalling
and the Region
pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
gravitateData
in interface CacheSPI<K,V>
fqn
- the fqn to gravitatesearchSubtrees
- if true, buddy backup subtrees are searched and if false, they are not.
CacheException
public void _remoteAssignToBuddyGroup(BuddyGroup group, java.util.Map<Fqn,byte[]> state) throws java.lang.Exception
java.lang.Exception
public void _remoteRemoveFromBuddyGroup(java.lang.String groupName) throws BuddyNotInitException
BuddyNotInitException
public void _remoteAnnounceBuddyPoolName(org.jgroups.Address address, java.lang.String buddyPoolName)
public void _dataGravitationCleanup(GlobalTransaction gtx, Fqn primary, Fqn backup) throws java.lang.Exception
java.lang.Exception
public void _releaseAllLocks(Fqn fqn)
public java.lang.String _print(Fqn fqn)
public void _lock(Fqn fqn, NodeLock.LockType lock_type, boolean recursive) throws TimeoutException, LockingException
TimeoutException
LockingException
public void optimisticPrepare(GlobalTransaction gtx, java.util.List modifications, java.util.Map data, org.jgroups.Address address, boolean onePhaseCommit)
public void prepare(GlobalTransaction global_tx, java.util.List modifications, org.jgroups.Address coord, boolean onePhaseCommit)
public void commit(GlobalTransaction tx)
public void rollback(GlobalTransaction tx)
public void addUndoOperation(GlobalTransaction gtx, MethodCall undo_op)
public CacheLoaderManager getCacheLoaderManager()
getCacheLoaderManager
in interface CacheSPI<K,V>
CacheLoaderManager
if one or more cache loaders are configured, null otherwise.public void setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)
public void setConfiguration(Configuration configuration)
public Notifier getNotifier()
getNotifier
in interface CacheSPI<K,V>
Notifier
which has been configured with this instance of CacheImpl.public InvocationContext getInvocationContext()
getInvocationContext
in interface Cache<K,V>
InvocationContext
public void setInvocationContext(InvocationContext ctx)
Cache
InvocationContext
as current.
setInvocationContext
in interface Cache<K,V>
ctx
- invocation context to usepublic void move(Fqn<?> nodeToMove, Fqn<?> newParent)
move
in interface Cache<K,V>
nodeToMove
- the Fqn of the node to move.newParent
- new location under which to attach the node being moved.public void _move(Fqn nodeToMoveFqn, Fqn newParentFqn)
newParentFqn
- nodeToMoveFqn
- public void _block()
public void _unblock()
public void killChannel()
protected javax.transaction.Transaction getLocalTransaction()
getCurrentTransaction()
public GlobalTransaction getCurrentTransaction()
public GlobalTransaction getCurrentTransaction(boolean createIfNotExists)
public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx)
public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx, boolean createIfNotExists)
getCurrentTransaction
in interface CacheSPI<K,V>
createIfNotExists
- if true, if a global transaction is not found; one is createdtx
- the current transaction
protected java.lang.Object invokeMethod(MethodCall m, boolean originLocal) throws CacheException
CacheException
protected java.lang.Object getOwnerForLock()
public NodeSPI<K,V> findNode(Fqn fqn)
TransactionEntry
field.added to the list of locked nodes
in the TransactionEntry
.
This operation will also apply different locking to the cache nodes, depending on operation_type. If it is read type, all nodes will be acquired with read lock. Otherwise, the operation is write type, all parent nodes will be acquired with read lock while the destination node acquires write lock.
fqn
- Fully qualified name for the corresponding node.
public boolean realRemove(Fqn f, boolean skipMarkerCheck)
f
- public RegionManager getRegionManager()
getRegionManager
in interface CacheSPI<K,V>
RegionManager
public Marshaller getMarshaller()
CacheSPI
Marshaller
, which is capable of
converting Java objects to bytestreams and back in an efficient manner, which is
also interoperable with bytestreams produced/consumed by other versions of JBoss
Cache.
The use of this marshaller is the recommended way of creating efficient,
compatible, byte streams from objects.
getMarshaller
in interface CacheSPI<K,V>
Marshaller
protected java.lang.String getDefaultProperties()
@Deprecated public void setCacheLoader(CacheLoader loader)
loader
- public void purgeCacheLoaders() throws java.lang.Exception
CacheLoader
s
java.lang.Exception
public java.util.List<Interceptor> getInterceptorChain()
getInterceptorChain
in interface CacheSPI<K,V>
List
of Interceptor
s configured for this cache, or
null
if create()
has not been invoked
and the interceptors thus do not exist.public void addCacheListener(java.lang.Object listener)
Cache
CacheListener
to the entire cache. The object passed in needs to be properly annotated with the
@org.jboss.cache.notifications.annotation.CacheListener
annotation otherwise an IncorrectCacheListenerException
will be thrown.
addCacheListener
in interface Cache<K,V>
listener
- listener to addpublic void addCacheListener(Fqn<?> region, java.lang.Object listener)
Cache
CacheListener
to a given region. The object passed in needs to be properly annotated with the
@org.jboss.cache.notifications.annotation.CacheListener
annotation otherwise an IncorrectCacheListenerException
will be thrown.
addCacheListener
in interface Cache<K,V>
region
- region to add listener tolistener
- listener to addpublic void removeCacheListener(java.lang.Object listener)
Cache
CacheListener
from the cache. The object passed in needs to be properly annotated with the
@org.jboss.cache.notifications.annotation.CacheListener
annotation otherwise an IncorrectCacheListenerException
will be thrown.
removeCacheListener
in interface Cache<K,V>
listener
- listener to removepublic void removeCacheListener(Fqn<?> region, java.lang.Object listener)
Cache
CacheListener
from a given region. The object passed in needs to be properly annotated with the
@org.jboss.cache.notifications.annotation.CacheListener
annotation otherwise an IncorrectCacheListenerException
will be thrown.
removeCacheListener
in interface Cache<K,V>
region
- region from which to remove listenerlistener
- listener to removepublic java.util.Set<java.lang.Object> getCacheListeners()
Cache
List
of objects annotated as CacheListener
s attached to the cache.
getCacheListeners
in interface Cache<K,V>
List
of objects annotated as CacheListener
s attached to the cache.public java.util.Set<java.lang.Object> getCacheListeners(Fqn<?> region)
Cache
List
of objects annotated as CacheListener
s attached to a specific region.
getCacheListeners
in interface Cache<K,V>
List
of objects annotated as CacheListener
s attached to a specific region.public void addInterceptor(Interceptor i, int position)
CacheSPI
addInterceptor
in interface CacheSPI<K,V>
i
- the interceptor to addposition
- the position to add the interceptorpublic void removeInterceptor(int position)
CacheSPI
removeInterceptor
in interface CacheSPI<K,V>
position
- the position at which to remove an interceptorpublic RPCManager getRPCManager()
CacheSPI
getRPCManager
in interface CacheSPI<K,V>
RPCManager
configured.public java.lang.String getClusterName()
getClusterName
in interface CacheSPI<K,V>
public void evict(Fqn<?> fqn, boolean recursive)
Cache
Node
from memory.
evict
in interface Cache<K,V>
fqn
- absolute Fqn
to the Node
to be evicted.recursive
- evicts children as wellpublic Region getRegion(Fqn<?> fqn, boolean createIfAbsent)
Cache
Region
for a given Fqn
. If the region does not exist,
and
getRegion
in interface Cache<K,V>
fqn
- Fqn that is contained in a region.createIfAbsent
- If true, will create a new associated region if not found.
Region
public boolean removeRegion(Fqn<?> fqn)
Cache
removeRegion
in interface Cache<K,V>
fqn
- of the region to remove
public boolean removeNode(Fqn<?> fqn)
Cache
Node
indicated by absolute Fqn
.
removeNode
in interface Cache<K,V>
fqn
- Node
to remove
public void putForExternalRead(Fqn<?> fqn, K key, V value)
Cache
putForExternalRead
in interface Cache<K,V>
fqn
- absolute Fqn
to the Node
to be accessed.key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.public void _putForExternalRead(GlobalTransaction gtx, Fqn fqn, K key, V value)
public boolean isStarted()
protected void setMessageListener(CacheImpl.MessageListenerAdaptor ml)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |