public interface Region extends Comparable<Region>, Cloneable
Node
s belonging to a Region in a Cache
.
A Region is described by an Fqn
relative to the root of the cache.
All nodes and child nodes of this Fqn belong to this region.
If a region is to be recognised as an eviction region (region of type Region.Type.EVICTION
then
it must have an EvictionRegionConfig
set using setEvictionRegionConfig(org.jboss.cache.config.EvictionRegionConfig)
.
Similarly, to be recognised as a marshalling region (region of type Region.Type.MARSHALLING
then it must have a
ClassLoader
registered using registerContextClassLoader(ClassLoader)
.
Note that a single region can be both an eviction and marshalling region at the same time.
RegionManager
Modifier and Type | Interface and Description |
---|---|
static class |
Region.Status
Region status
|
static class |
Region.Type
Types of regions.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates this region for replication.
|
void |
activateIfEmpty()
Activates this region for replication, but if the
Fqn that represents this region already exists and
either contains data or children, no state transfers take place. |
Region |
clone()
Deprecated.
|
Region |
copy(Fqn newRoot)
copies the region - including eviction queue events - to a new Region instance, attached to a new Fqn root.
|
void |
deactivate()
Deactivates this region from being replicated.
|
Configuration |
getCacheConfiguration() |
ClassLoader |
getClassLoader()
Returns the configured
ClassLoader for this region. |
EvictionPolicy |
getEvictionPolicy()
Deprecated.
|
EvictionPolicyConfig |
getEvictionPolicyConfig()
Deprecated.
|
EvictionRegionConfig |
getEvictionRegionConfig() |
Fqn |
getFqn()
Returns the
Fqn of this region. |
Region.Status |
getStatus() |
boolean |
isActive()
Returns true if this region has been activated.
|
void |
markNodeCurrentlyInUse(Fqn fqn,
long timeout)
Marks a
Node as currently in use, by adding an event to the eviction queue. |
int |
nodeEventQueueSize()
Deprecated.
|
void |
processEvictionQueues()
Processes the eviction queues (primary and recycle queues) associated with this region.
|
void |
putNodeEvent(EvictedEventNode event)
Deprecated.
|
void |
registerContextClassLoader(ClassLoader classLoader)
Registers a specific
ClassLoader for this region,
overridding the default cache class loader. |
EvictionEvent |
registerEvictionEvent(Fqn fqn,
EvictionEvent.Type eventType)
An overloaded version of
registerEvictionEvent(Fqn, org.jboss.cache.eviction.EvictionEvent.Type, int, DataCommand, Transaction) which
uses a default elementDifference value. |
EvictionEvent |
registerEvictionEvent(Fqn fqn,
EvictionEvent.Type eventType,
int elementDifference,
DataCommand command,
Transaction tx)
Registers an eviction event on the region's eviction event queue for later processing by
processEvictionQueues() . |
void |
resetEvictionQueues()
Clears the node event queue used for processing eviction.
|
void |
setActive(boolean b)
Sets this region as active - this only marks a flag
and does not actually activates or
deactivates this region.
|
void |
setEvictionPolicy(EvictionPolicyConfig evictionPolicyConfig)
Deprecated.
|
void |
setEvictionRegionConfig(EvictionRegionConfig evictionRegionConfig)
Configures this region for eviction.
|
void |
setStatus(Region.Status status)
A mechanism to set status of a region, more fine grained control than just setActive();
|
EvictedEventNode |
takeLastEventNode()
Deprecated.
|
void |
unmarkNodeCurrentlyInUse(Fqn fqn)
Adds an event to the eviction queue indicating that a node is no longer in use.
|
void |
unregisterContextClassLoader()
Unregisters a registered
ClassLoader s for this region. |
compareTo
void registerContextClassLoader(ClassLoader classLoader)
ClassLoader
for this region,
overridding the default cache class loader.classLoader
- specific class loaderConfiguration getCacheConfiguration()
void unregisterContextClassLoader()
ClassLoader
s for this region.void activate() throws RegionNotEmptyException
RegionNotEmptyException
- if the Fqn
that represents this region already exists and contains data or children.void activateIfEmpty()
Fqn
that represents this region already exists and
either contains data or children, no state transfers take place. The region is simply marked as active in this
case.void deactivate()
void setActive(boolean b)
activate()
and deactivate()
for the full process.b
- boolean isActive()
ClassLoader getClassLoader()
ClassLoader
for this region.void processEvictionQueues()
void resetEvictionQueues()
void setEvictionRegionConfig(EvictionRegionConfig evictionRegionConfig)
evictionRegionConfig
- configuration to setEvictionRegionConfig getEvictionRegionConfig()
EvictionEvent registerEvictionEvent(Fqn fqn, EvictionEvent.Type eventType, int elementDifference, DataCommand command, Transaction tx)
processEvictionQueues()
.fqn
- passed in to the constructor of EvictionEvent
eventType
- passed in to the constructor of EvictionEvent
elementDifference
- passed in to the constructor of EvictionEvent
EvictionEvent registerEvictionEvent(Fqn fqn, EvictionEvent.Type eventType)
registerEvictionEvent(Fqn, org.jboss.cache.eviction.EvictionEvent.Type, int, DataCommand, Transaction)
which
uses a default elementDifference value.fqn
- passed in to the constructor of EvictionEvent
eventType
- passed in to the constructor of EvictionEvent
void markNodeCurrentlyInUse(Fqn fqn, long timeout)
Node
as currently in use, by adding an event to the eviction queue.
If there is an EvictionRegionConfig
associated with this region, and
it respects this event (e.g., LRUAlgorithm
does), then the Node
will not
be evicted until unmarkNodeCurrentlyInUse(Fqn)
is invoked.
This mechanism can be used to prevent eviction of data that the application
is currently using, in the absence of any locks on the Node
where the
data is stored.fqn
- Fqn of the node.unmarkNodeCurrentlyInUse(Fqn)
void unmarkNodeCurrentlyInUse(Fqn fqn)
fqn
- Fqn of the node.markNodeCurrentlyInUse(Fqn,long)
void setStatus(Region.Status status)
status
- status of the regionRegion.Status getStatus()
Region copy(Fqn newRoot)
newRoot
- new root for the region - e.g., a buddy backup root.@Deprecated void setEvictionPolicy(EvictionPolicyConfig evictionPolicyConfig)
evictionPolicyConfig
- configuration to set@Deprecated EvictionPolicyConfig getEvictionPolicyConfig()
@Deprecated EvictionPolicy getEvictionPolicy()
@Deprecated int nodeEventQueueSize()
@Deprecated EvictedEventNode takeLastEventNode()
EvictedEventNode
added to the event queue by
putNodeEvent(org.jboss.cache.eviction.EvictedEventNode)
.
Note: This is deprecated since this is an internal method and never was
meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
and its functionality is not guaranteed.
EvictedEventNode
, or null if no more events exist@Deprecated void putNodeEvent(EvictedEventNode event)
EvictedEventNode
to the internal queue for processing
by the eviction thread.
Note: This is deprecated since this is an internal method and never was
meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
and its functionality is not guaranteed.
event
- event to add@Deprecated Region clone() throws CloneNotSupportedException
CloneNotSupportedException
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.