|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.RegionManagerImpl
@ThreadSafe public class RegionManagerImpl
The default region manager, used with MVCC locking.
Field Summary | |
---|---|
protected BuddyFqnTransformer |
buddyFqnTransformer
|
protected Configuration |
configuration
|
static Fqn |
DEFAULT_REGION
The default region used in XML configuration files when defining eviction policies. |
protected LockManager |
lockManager
|
protected static org.apache.commons.logging.Log |
log
|
protected RPCManager |
rpcManager
|
protected static boolean |
trace
|
Constructor Summary | |
---|---|
RegionManagerImpl()
|
Method Summary | |
---|---|
void |
activate(Fqn fqn)
Activates unmarshalling of replication messages for the region rooted in the given Fqn. |
void |
activateIfEmpty(Fqn fqn)
Attempts to activate a given region rooted at a given Fqn, similar to RegionManager.activate(org.jboss.cache.Fqn) except
that if the fqn is currently already in use (probably already been activated) this method is a no-op. |
void |
deactivate(Fqn fqn)
Disables unmarshalling of replication messages for the region rooted in the given Fqn. |
protected void |
destroy()
|
String |
dumpRegions()
Returns a string containing debug information on every region. |
List<Region> |
getAllRegions(Region.Type type)
Returns an ordered list of all regions. |
CacheSPI |
getCache()
|
Configuration |
getConfiguration()
|
EvictionTimerTask |
getEvictionTimerTask()
|
int |
getNumRegions()
|
Region |
getRegion(Fqn fqn,
boolean createIfAbsent)
Returns a region by Fqn , creating it optionally if absent. |
Region |
getRegion(Fqn fqn,
Region.Type type,
boolean createIfAbsent)
An overloaded form of RegionManager.getRegion(org.jboss.cache.Fqn,boolean) that takes an additional Region.Type
parameter to force regions of a specific type. |
Region |
getRegion(String fqn,
boolean createIfAbsent)
Returns a region using Fqn.fromString(fqn), calling RegionManager.getRegion(org.jboss.cache.Fqn,boolean) |
Region |
getValidMarshallingRegion(Fqn fqn)
Retrieves a valid marshalling Region after taking into account that this may be a Buddy Backup Fqn. |
boolean |
hasRegion(Fqn fqn,
Region.Type type)
Returns true if the region exists |
protected void |
inactivateRegion(Fqn fqn)
Causes the cache to stop accepting replication events for the subtree rooted at subtreeFqn and evict all nodes in that subtree. |
void |
injectDependencies(CacheSPI cache,
Configuration configuration,
RPCManager rpcManager,
LockManager lockManager,
BuddyFqnTransformer transformer,
RegionRegistry regionsRegistry)
|
boolean |
isDefaultInactive()
|
boolean |
isInactive(Fqn fqn)
Convenienve method. |
protected boolean |
isRegionLocked(Fqn fqn)
|
boolean |
isUsingEvictions()
|
protected void |
lock(Fqn fqn)
|
boolean |
removeRegion(Fqn fqn)
Removes a Region identified by the given fqn. |
void |
reset()
Resets the region manager's regions registry |
void |
setContextClassLoaderAsCurrent(Fqn fqn)
Helper utility that checks for a ClassLoader registered for the
given Fqn , and if found sets it as the TCCL. |
void |
setDefaultInactive(boolean defaultInactive)
Sets if replication for new Region s is by default inactive. |
void |
setEvictionConfig(EvictionConfig evictionConfig)
Sets the eviction configuration. |
void |
setUsingEvictions(boolean usingEvictions)
Sets if evictions are processed. |
void |
start()
|
void |
startEvictionThread()
Starts the eviction processing thread. |
protected void |
stop()
|
void |
stopEvictionThread()
Stops the eviction processing thread |
String |
toString()
Returns a string containing debug information on every region. |
protected void |
unlock(Fqn fqn)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Fqn DEFAULT_REGION
Fqn.ROOT
internally so
any region that is not explicitly defined comes under the settings defined for this default.
protected static final org.apache.commons.logging.Log log
protected static final boolean trace
protected Configuration configuration
protected RPCManager rpcManager
protected LockManager lockManager
protected BuddyFqnTransformer buddyFqnTransformer
Constructor Detail |
---|
public RegionManagerImpl()
Method Detail |
---|
protected final boolean isRegionLocked(Fqn fqn)
protected final void lock(Fqn fqn)
protected final void unlock(Fqn fqn)
public void injectDependencies(CacheSPI cache, Configuration configuration, RPCManager rpcManager, LockManager lockManager, BuddyFqnTransformer transformer, RegionRegistry regionsRegistry)
public void start()
protected void stop()
protected void destroy()
public boolean isUsingEvictions()
isUsingEvictions
in interface RegionManager
public boolean isDefaultInactive()
isDefaultInactive
in interface RegionManager
Region
s.public void setDefaultInactive(boolean defaultInactive)
RegionManager
Region
s is by default inactive.
setDefaultInactive
in interface RegionManager
public void setContextClassLoaderAsCurrent(Fqn fqn)
RegionManager
ClassLoader
registered for the
given Fqn
, and if found sets it as the TCCL. If the given Fqn is
under the _BUDDY_BACKUP_ region, the equivalent region in the main
cache is used to find the ClassLoader
.
setContextClassLoaderAsCurrent
in interface RegionManager
fqn
- Fqn pointing to a region for which a special classloader
may have been registered.public Region getRegion(Fqn fqn, boolean createIfAbsent)
RegionManager
Fqn
, creating it optionally if absent. If the region does not exist and createIfAbsent
is false, a parent region which may apply to the Fqn
is sought.
Note that this takes into account the fact that this may be a Buddy Backup Fqn. If it is, the actual Fqn is calculated
and used instead.
getRegion
in interface RegionManager
public Region getValidMarshallingRegion(Fqn fqn)
RegionManager
Region
after taking into account that this may be a Buddy Backup Fqn.
If the fqn passed in is null, the region has been deactivated or if a region cannot be found, this method returns a null.
getValidMarshallingRegion
in interface RegionManager
fqn
- of the region to locate
public Region getRegion(Fqn fqn, Region.Type type, boolean createIfAbsent)
RegionManager
RegionManager.getRegion(org.jboss.cache.Fqn,boolean)
that takes an additional Region.Type
parameter to force regions of a specific type.
Note that this takes into account the fact that this may be a Buddy Backup Fqn. If it is, the actual Fqn is calculated
and used instead.
getRegion
in interface RegionManager
Region.Type
public Region getRegion(String fqn, boolean createIfAbsent)
RegionManager
RegionManager.getRegion(org.jboss.cache.Fqn,boolean)
getRegion
in interface RegionManager
RegionManager.getRegion(org.jboss.cache.Fqn,boolean)
public boolean removeRegion(Fqn fqn)
RegionManager
Region
identified by the given fqn.
removeRegion
in interface RegionManager
fqn
- fqn of the region to remove
public EvictionTimerTask getEvictionTimerTask()
getEvictionTimerTask
in interface RegionManager
public Configuration getConfiguration()
getConfiguration
in interface RegionManager
public void activate(Fqn fqn) throws RegionNotEmptyException
RegionManager
subtreeFqn
whether or not that
node exists anywhere else in the cluster. If the node does not exist
elsewhere, the local node will be empty. The creation of this node will
not be replicated.
activate
in interface RegionManager
fqn
- representing the region to be activated.
RegionNotEmptyException
- if the node fqn
exists and already has either data or childrenpublic void activateIfEmpty(Fqn fqn)
RegionManager
RegionManager.activate(org.jboss.cache.Fqn)
except
that if the fqn is currently already in use (probably already been activated) this method is a no-op.
activateIfEmpty
in interface RegionManager
fqn
- which represents the region to activatepublic boolean isInactive(Fqn fqn)
RegionManager
RegionManager.isDefaultInactive()
is returned, otherwise
!Region.isActive()
is returned.
isInactive
in interface RegionManager
fqn
- fqn to test
protected void inactivateRegion(Fqn fqn) throws CacheException
subtreeFqn
and evict all nodes in that subtree.
This is legacy code and should not be called directly. This is a private method for now and will be refactored out.
You should be using activate(Fqn)
and deactivate(Fqn)
fqn
- Fqn string indicating the uppermost node in the
portion of the cache that should be activated.
CacheException
- if there is a problem evicting nodes
IllegalStateException
- if Configuration.isUseRegionBasedMarshalling()
is false
public boolean hasRegion(Fqn fqn, Region.Type type)
RegionManager
hasRegion
in interface RegionManager
fqn
- FQN of the regiontype
- type of region to search for
public void deactivate(Fqn fqn)
RegionManager
deactivate
in interface RegionManager
public void reset()
RegionManager
reset
in interface RegionManager
public List<Region> getAllRegions(Region.Type type)
RegionManager
Comparable
interface, which Region
extends.
getAllRegions
in interface RegionManager
type
- Type of region to return
public void setUsingEvictions(boolean usingEvictions)
RegionManager
setUsingEvictions
in interface RegionManager
public void setEvictionConfig(EvictionConfig evictionConfig)
RegionManager
setEvictionConfig
in interface RegionManager
public String dumpRegions()
RegionManager
dumpRegions
in interface RegionManager
public String toString()
toString
in class Object
public CacheSPI getCache()
getCache
in interface RegionManager
public void startEvictionThread()
startEvictionThread
in interface RegionManager
public void stopEvictionThread()
stopEvictionThread
in interface RegionManager
public int getNumRegions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |