org.jboss.cache.eviction
Class RegionManager

java.lang.Object
  extended by org.jboss.cache.eviction.RegionManager

public class RegionManager
extends java.lang.Object

Factory to create region from configuration, to track region, and to resolve naming conflict for regions. Note that in addition to user-specified regions, there is also a global cache _default_ region that covers everything else.

Version:
$Id: RegionManager.java,v 1.16.2.5 2007/03/06 21:18:29 msurtani Exp $
Author:
Ben Wang 02-2004, Daniel Huang (dhuang@jboss.org)

Field Summary
static int CAPACITY
          Default region capacity.
static Fqn DEFAULT_REGION
           
 
Constructor Summary
RegionManager()
           
 
Method Summary
 void checkConflict(Fqn fqn)
          Check for conflict in the current regions.
 void checkConflict(java.lang.String myFqn)
          Check for conflict in the current regions.
 void configure(TreeCache cache)
           
 Region createRegion(Fqn fqn, org.w3c.dom.Element regionConfig)
           
 Region createRegion(Fqn fqn, EvictionAlgorithm algorithm)
          Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY
 Region createRegion(Fqn fqn, EvictionPolicy policy, EvictionConfiguration config)
           
 Region createRegion(java.lang.String fqn, org.w3c.dom.Element regionConfig)
          Create a region based on fqn.
 Region createRegion(java.lang.String fqn, EvictionAlgorithm algorithm)
          Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY
 Region createRegion(java.lang.String fqn, EvictionPolicy policy, EvictionConfiguration config)
           
 int getEvictionThreadWakeupIntervalSeconds()
           
 Region getRegion(Fqn fqn)
          Returns the Region corresponding to this Fqn.
 Region getRegion(java.lang.String myFqn)
          Returns the Region belonging to a String FQN.
 Region[] getRegions()
          Returns an ordered list of regions.
 boolean hasRegion(Fqn fqn)
          Returns true if the region exists.
 boolean hasRegion(java.lang.String myFqn)
          Returns true if the region exists.
static boolean isUsingNewStyleConfiguration(org.w3c.dom.Element evictionRegionConfigElem)
           
 void markNodeCurrentlyInUse(Fqn fqn, long timeout)
          Mark a node as currently in use.
 boolean removeRegion(Fqn fqn)
          Removes a region by Fqn, returns true if the region was found.
 void removeRegion(java.lang.String fqn)
          Removes a region by string.
 java.lang.String toString()
           
 void unmarkNodeCurrentlyInUse(Fqn fqn)
          Unmark a node currently in use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CAPACITY

public static final int CAPACITY
Default region capacity.

See Also:
Constant Field Values

DEFAULT_REGION

public static final Fqn DEFAULT_REGION
Constructor Detail

RegionManager

public RegionManager()
Method Detail

getEvictionThreadWakeupIntervalSeconds

public int getEvictionThreadWakeupIntervalSeconds()

createRegion

public Region createRegion(java.lang.String fqn,
                           EvictionAlgorithm algorithm)
                    throws RegionNameConflictException
Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY

Throws:
RegionNameConflictException

createRegion

public Region createRegion(Fqn fqn,
                           EvictionAlgorithm algorithm)
                    throws RegionNameConflictException
Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY

Throws:
RegionNameConflictException

createRegion

public Region createRegion(java.lang.String fqn,
                           org.w3c.dom.Element regionConfig)
                    throws RegionNameConflictException
Create a region based on fqn.

Parameters:
fqn - The region identifier.
regionConfig - The XML configuration DOM Element for this region.
Throws:
RegionNameConflictException

createRegion

public Region createRegion(Fqn fqn,
                           org.w3c.dom.Element regionConfig)
                    throws RegionNameConflictException
Throws:
RegionNameConflictException

createRegion

public Region createRegion(java.lang.String fqn,
                           EvictionPolicy policy,
                           EvictionConfiguration config)
                    throws RegionNameConflictException
Throws:
RegionNameConflictException

createRegion

public Region createRegion(Fqn fqn,
                           EvictionPolicy policy,
                           EvictionConfiguration config)
                    throws RegionNameConflictException
Throws:
RegionNameConflictException

configure

public void configure(TreeCache cache)

removeRegion

public void removeRegion(java.lang.String fqn)
Removes a region by string.


removeRegion

public boolean removeRegion(Fqn fqn)
Removes a region by Fqn, returns true if the region was found.


hasRegion

public boolean hasRegion(java.lang.String myFqn)
Returns true if the region exists.


hasRegion

public boolean hasRegion(Fqn fqn)
Returns true if the region exists.


getRegion

public Region getRegion(java.lang.String myFqn)
Returns the Region belonging to a String FQN.


getRegion

public Region getRegion(Fqn fqn)
Returns the Region corresponding to this Fqn.


getRegions

public Region[] getRegions()
Returns an ordered list of regions. Orders (by reverse) Fqn.


checkConflict

public void checkConflict(java.lang.String myFqn)
                   throws RegionNameConflictException
Check for conflict in the current regions. There is a conflict if fqn is any parent fqn of the current regions.

Parameters:
myFqn - Current fqn for potential new region.
Throws:
RegionNameConflictException - to indicate a region name conflict has ocurred.

checkConflict

public void checkConflict(Fqn fqn)
                   throws RegionNameConflictException
Check for conflict in the current regions. There is a conflict if fqn is any parent fqn of the current regions.

Throws:
RegionNameConflictException

markNodeCurrentlyInUse

public void markNodeCurrentlyInUse(Fqn fqn,
                                   long timeout)
Mark a node as currently in use.

Parameters:
fqn - Fqn of the node.

unmarkNodeCurrentlyInUse

public void unmarkNodeCurrentlyInUse(Fqn fqn)
Unmark a node currently in use.

Parameters:
fqn - Fqn of the node.

isUsingNewStyleConfiguration

public static boolean isUsingNewStyleConfiguration(org.w3c.dom.Element evictionRegionConfigElem)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.