org.jboss.cache
Interface RegionManager

All Known Implementing Classes:
LegacyRegionManagerImpl, RegionManagerImpl

public interface RegionManager

Manages regions.

Prior to 3.0.0, this was a concrete class. An interface was introduced in 3.0.0 for enhanced flexibility.

Since:
3.0
Author:
Manik Surtani (manik AT jboss DOT org)

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 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.
 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()
           
 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 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 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
 boolean isDefaultInactive()
           
 boolean isInactive(Fqn fqn)
          Convenienve method.
 boolean isUsingEvictions()
           
 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 Regions is by default inactive.
 void setEvictionConfig(EvictionConfig evictionConfig)
          Sets the eviction configuration.
 void setUsingEvictions(boolean usingEvictions)
          Sets if evictions are processed.
 void startEvictionThread()
          Deprecated.  
 void stopEvictionThread()
          Deprecated.  
 

Method Detail

isUsingEvictions

boolean isUsingEvictions()
Returns:
true if evictions are being processed.

isDefaultInactive

boolean isDefaultInactive()
Returns:
true if replication is by default inactive for new Regions.

setDefaultInactive

void setDefaultInactive(boolean defaultInactive)
Sets if replication for new Regions is by default inactive.


setContextClassLoaderAsCurrent

void setContextClassLoaderAsCurrent(Fqn fqn)
Helper utility that checks for a 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.

Parameters:
fqn - Fqn pointing to a region for which a special classloader may have been registered.

getRegion

Region getRegion(Fqn fqn,
                 boolean createIfAbsent)
Returns a region by 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.


getValidMarshallingRegion

Region getValidMarshallingRegion(Fqn fqn)
Retrieves a valid marshalling 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.

Parameters:
fqn - of the region to locate
Returns:
a region

getRegion

Region getRegion(Fqn fqn,
                 Region.Type type,
                 boolean createIfAbsent)
An overloaded form of 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.

See Also:
Region.Type

getRegion

Region getRegion(String fqn,
                 boolean createIfAbsent)
Returns a region using Fqn.fromString(fqn), calling getRegion(org.jboss.cache.Fqn,boolean)

Parameters:
fqn -
createIfAbsent -
See Also:
getRegion(org.jboss.cache.Fqn,boolean)

removeRegion

boolean removeRegion(Fqn fqn)
Removes a Region identified by the given fqn.

Parameters:
fqn - fqn of the region to remove
Returns:
true if such a region existed and was removed.

activate

void activate(Fqn fqn)
              throws RegionNotEmptyException
Activates unmarshalling of replication messages for the region rooted in the given Fqn.

NOTE: This method will cause the creation of a node in the local cache at 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.

Parameters:
fqn - representing the region to be activated.
Throws:
RegionNotEmptyException - if the node fqn exists and already has either data or children

activateIfEmpty

void activateIfEmpty(Fqn fqn)
Attempts to activate a given region rooted at a given Fqn, similar to 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.

Parameters:
fqn - which represents the region to activate

isInactive

boolean isInactive(Fqn fqn)
Convenienve method. If the region defined by fqn does not exist, isDefaultInactive() is returned, otherwise !Region.isActive() is returned.

Parameters:
fqn - fqn to test
Returns:
true if inactive

hasRegion

boolean hasRegion(Fqn fqn,
                  Region.Type type)
Returns true if the region exists

Parameters:
fqn - FQN of the region
type - type of region to search for
Returns:
true if the region exists

deactivate

void deactivate(Fqn fqn)
Disables unmarshalling of replication messages for the region rooted in the given Fqn.

Parameters:
fqn -

reset

void reset()
Resets the region manager's regions registry


getAllRegions

List<Region> getAllRegions(Region.Type type)
Returns an ordered list of all regions. Note that the ordered list returned is sorted according to the natural order defined in the Comparable interface, which Region extends.

Parameters:
type - Type of region to return
Returns:
an ordered list of all regions, based on the type requested.

setUsingEvictions

void setUsingEvictions(boolean usingEvictions)
Sets if evictions are processed.


setEvictionConfig

void setEvictionConfig(EvictionConfig evictionConfig)
Sets the eviction configuration.


dumpRegions

String dumpRegions()
Returns a string containing debug information on every region.

Returns:
Regions as a string

getCache

CacheSPI getCache()

getEvictionTimerTask

EvictionTimerTask getEvictionTimerTask()
Returns:
the eviction timer task attached to the region manager

getConfiguration

Configuration getConfiguration()
Returns:
the configuration

startEvictionThread

@Deprecated
void startEvictionThread()
Deprecated. 

Starts the eviction processing thread.


stopEvictionThread

@Deprecated
void stopEvictionThread()
Deprecated. 

Stops the eviction processing thread



Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.