[jbosscache-commits] JBoss Cache SVN: r8052 - enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/de-DE.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue May 5 08:24:37 EDT 2009


Author: jdimanos at jboss.com
Date: 2009-05-05 08:24:37 -0400 (Tue, 05 May 2009)
New Revision: 8052

Modified:
   enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/de-DE/Eviction_policies.po
Log:
update

Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/de-DE/Eviction_policies.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/de-DE/Eviction_policies.po	2009-05-04 21:31:33 UTC (rev 8051)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/de-DE/Eviction_policies.po	2009-05-05 12:24:37 UTC (rev 8052)
@@ -1,24 +1,26 @@
+# translation of Eviction_policies.po to
 # Language /tmp/mike/JBEAP420/Cache translations for JBEAP package.
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 # Automatically generated, 2007.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: JBEAP 420\n"
+"Project-Id-Version: Eviction_policies\n"
 "Report-Msgid-Bugs-To: http://bugs.kde.org\n"
 "POT-Creation-Date: 2008-09-21 04:44+0000\n"
-"PO-Revision-Date: 2001-02-09 01:25+0100\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-05-05 22:20+1000\n"
+"Last-Translator: \n"
+"Language-Team:  <en at li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
 
 #. Tag: title
 #: Eviction_policies.xml:5
 #, no-c-format
 msgid "Eviction Policies"
-msgstr ""
+msgstr "Eviction Policies"
 
 #. Tag: para
 #: Eviction_policies.xml:6
@@ -29,12 +31,17 @@
 "mean caches cannot grow indefinitely, so policies need to be in place to "
 "restrict the size of the cache in memory."
 msgstr ""
+"Eviction Policies legen das Verhalten eines innerhalb des Cache befindlichen "
+"Nodes fest, z.B. Lebensdauer und maximal gestattete Anzahl. "
+"Speicherbeschränkungen auf Servern bedeuten, dass Caches nicht unbegrenzt "
+"wachsen können, daher müssen Richtlinien dafür sorgen, dass die Größe des "
+"Cache im Speicher beschränkt wird."
 
 #. Tag: title
 #: Eviction_policies.xml:10
 #, no-c-format
 msgid "Eviction Policy Plugin"
-msgstr ""
+msgstr "Eviction Policy Plugin"
 
 #. Tag: para
 #: Eviction_policies.xml:11
@@ -76,12 +83,18 @@
 "of these interface implementations define all the underlying mechanics "
 "necessary for a complete eviction policy implementation."
 msgstr ""
+"Um eine Eviction Policy zu implementieren, müssen folgende Interfaces "
+"implementiert sein: org.jboss.cache.eviction.EvictionPolicy, org.jboss.cache."
+"eviction.EvictionAlgorithm, org.jboss.cache.eviction.EvictionQueue und org."
+"jboss.cache.eviction.EvictionConfiguration. Gemeinsam definieren diese "
+"Interface-Implementierungen alle für eine vollständige Eviction Policy notwendigen, "
+"zugrundeliegenden Mechanismen."
 
 #. Tag: title
 #: Eviction_policies.xml:21
 #, no-c-format
 msgid "TreeCache eviction UML Diagram"
-msgstr ""
+msgstr "TreeCache Eviction UML-Diagramm"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:28
@@ -139,6 +152,57 @@
 "\n"
 "}"
 msgstr ""
+"public interface EvictionPolicy\n"
+"{\n"
+"   /**\n"
+"    * Evict a node form the underlying cache.\n"
+"    *\n"
+"    * @param fqn DataNode corresponds to this fqn.\n"
+"    * @throws Exception\n"
+"    */\n"
+"   void evict(Fqn fqn) throws Exception;\n"
+"\n"
+"   /**\n"
+"    * Return children names as Objects\n"
+"    *\n"
+"    * @param fqn\n"
+"    * @return Child names under given fqn\n"
+"    */\n"
+"   Set getChildrenNames(Fqn fqn);\n"
+"\n"
+"   /**\n"
+"    * Is this a leaf node?\n"
+"    *\n"
+"    * @param fqn\n"
+"    * @return true/false if leaf node.\n"
+"    */\n"
+"   boolean hasChild(Fqn fqn);\n"
+"\n"
+"   Object getCacheData(Fqn fqn, Object key);\n"
+"\n"
+"   /**\n"
+"    * Method called to configure this implementation.\n"
+"    */\n"
+"   void configure(TreeCache cache);\n"
+"\n"
+"   /**\n"
+"    * Get the associated EvictionAlgorithm used by the EvictionPolicy.\n"
+"    * &lt;p/&gt;\n"
+"    * This relationship should be 1-1.\n"
+"    *\n"
+"    * @return An EvictionAlgorithm implementation.\n"
+"    */\n"
+"   EvictionAlgorithm getEvictionAlgorithm();\n"
+"\n"
+"   /**\n"
+"    * The EvictionConfiguration implementation class used by this "
+"EvictionPolicy.\n"
+"    *\n"
+"    * @return EvictionConfiguration implementation class.\n"
+"    */\n"
+"   Class getEvictionConfigurationClass();\n"
+"\n"
+"}"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:29
@@ -174,6 +238,35 @@
 "\n"
 "}"
 msgstr ""
+"public interface EvictionAlgorithm\n"
+"{\n"
+"   /**\n"
+"    * Entry point for evictin algorithm. This is an api called by the "
+"EvictionTimerTask\n"
+"    * to process the node events in waiting and actual pruning, if "
+"necessary.\n"
+"    *\n"
+"    * @param region Region that this algorithm will operate on.\n"
+"    */\n"
+"   void process(Region region) throws EvictionException;\n"
+"\n"
+"   /**\n"
+"    * Reset the whole eviction queue. Queue may needs to be reset due to "
+"corrupted state, \n"
+"    * for example.\n"
+"    *\n"
+"    * @param region Region that this algorithm will operate on.\n"
+"    */\n"
+"   void resetEvictionQueue(Region region);\n"
+"\n"
+"   /**\n"
+"    * Get the EvictionQueue implementation used by this algorithm.\n"
+"    *\n"
+"    * @return the EvictionQueue implementation.\n"
+"    */\n"
+"   EvictionQueue getEvictionQueue();\n"
+"\n"
+"}"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:30
@@ -243,6 +336,69 @@
 "\n"
 "}"
 msgstr ""
+"public interface EvictionQueue\n"
+"{\n"
+"   /**\n"
+"    * Get the first entry in the queue.\n"
+"    * &lt;p/&gt;\n"
+"    * If there are no entries in queue, this method will return null.\n"
+"    * &lt;p/&gt;\n"
+"    * The first node returned is expected to be the first node to evict.\n"
+"    *\n"
+"    * @return first NodeEntry in queue.\n"
+"    */\n"
+"   public NodeEntry getFirstNodeEntry();\n"
+"\n"
+"   /**\n"
+"    * Retrieve a node entry by Fqn.\n"
+"    * &lt;p/&gt;\n"
+"    * This will return null if the entry is not found.\n"
+"    *\n"
+"    * @param fqn Fqn of the node entry to retrieve.\n"
+"    * @return Node Entry object associated with given Fqn param.\n"
+"    */\n"
+"   public NodeEntry getNodeEntry(Fqn fqn);\n"
+"\n"
+"   public NodeEntry getNodeEntry(String fqn);\n"
+"\n"
+"   /**\n"
+"    * Check if queue contains the given NodeEntry.\n"
+"    *\n"
+"    * @param entry NodeEntry to check for existence in queue.\n"
+"    * @return true/false if NodeEntry exists in queue.\n"
+"    */\n"
+"   public boolean containsNodeEntry(NodeEntry entry);\n"
+"\n"
+"   /**\n"
+"    * Remove a NodeEntry from queue.\n"
+"    * &lt;p/&gt;\n"
+"    * If the NodeEntry does not exist in the queue, this method will return "
+"normally.\n"
+"    *\n"
+"    * @param entry The NodeEntry to remove from queue.\n"
+"    */\n"
+"   public void removeNodeEntry(NodeEntry entry);\n"
+"\n"
+"   /**\n"
+"    * Add a NodeEntry to the queue.\n"
+"    *\n"
+"    * @param entry The NodeEntry to add to queue.\n"
+"    */\n"
+"   public void addNodeEntry(NodeEntry entry);\n"
+"\n"
+"   /**\n"
+"    * Get the size of the queue.\n"
+"    *\n"
+"    * @return The number of items in the queue.\n"
+"    */\n"
+"   public int size();\n"
+"\n"
+"   /**\n"
+"    * Clear the queue.\n"
+"    */\n"
+"   public void clear();\n"
+"\n"
+"}"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:31
@@ -283,13 +439,47 @@
 "   public void parseXMLConfig(Element element) throws ConfigureException;\n"
 "}"
 msgstr ""
+"public interface EvictionConfiguration\n"
+"{\n"
+"   public static final int WAKEUP_DEFAULT = 5;\n"
+"\n"
+"   public static final String ATTR = \"attribute\";\n"
+"   public static final String NAME = \"name\";\n"
+"\n"
+"   public static final String REGION = \"region\";\n"
+"   public static final String WAKEUP_INTERVAL_SECONDS = "
+"\"wakeUpIntervalSeconds\";\n"
+"   public static final String MAX_NODES = \"maxNodes\";\n"
+"   public static final String TIME_TO_IDLE_SECONDS = \"timeToIdleSeconds\";\n"
+"   public static final String TIME_TO_LIVE_SECONDS = \"timeToLiveSeconds\";\n"
+"   public static final String MAX_AGE_SECONDS = \"maxAgeSeconds\";\n"
+"   public static final String MIN_NODES = \"minNodes\";\n"
+"   public static final String REGION_POLICY_CLASS = \"policyClass\";\n"
+"\n"
+"   /**\n"
+"    * Parse the XML configuration for the given specific eviction region.\n"
+"    * &lt;p/&gt;\n"
+"    * The element parameter should contain the entire region block. An "
+"example\n"
+"    * of an entire Element of the region would be:\n"
+"    * &lt;p/&gt;\n"
+"    * &lt;region name=\"abc\"&gt;\n"
+"    * &lt;attribute name=\"maxNodes\"&gt;10&lt;/attribute&gt;\n"
+"    * &lt;/region&gt;\n"
+"    *\n"
+"    * @param element DOM element for the region. &lt;region name=\"abc\"&gt;"
+"&lt;/region&gt;\n"
+"    * @throws ConfigureException\n"
+"    */\n"
+"   public void parseXMLConfig(Element element) throws ConfigureException;\n"
+"}"
 
 #. Tag: emphasis
 #: Eviction_policies.xml:33 Eviction_policies.xml:55 Eviction_policies.xml:66
 #: Eviction_policies.xml:77
 #, no-c-format
 msgid "Note that:"
-msgstr ""
+msgstr "Beachten Sie, dass:"
 
 #. Tag: para
 #: Eviction_policies.xml:37
@@ -299,6 +489,9 @@
 "only the DOM element pertaining to the region the policy is being configured "
 "for."
 msgstr ""
+"Die EvictionConfiguration-Klasse 'parseXMLConfig(Element)' Methode erwartet "
+"nur das DOM-Element, das die Region betrifft, für die die Richtlinie (Policy) "
+"konfiguriert wird."
 
 #. Tag: para
 #: Eviction_policies.xml:44
@@ -309,6 +502,10 @@
 "cache region. (e.g. for LRUConfiguration there is a int getMaxNodes() and a "
 "setMaxNodes(int))"
 msgstr ""
+"Die EvictionConfiguration Implementierung sollte Getter und Setter "
+"Methoden für konfigurierte Properties enthalten, die die an einer gegebenen "
+" Cache Region verwenden. (z.B. für LRUConfiguration gibt es ein "
+"int getMaxNodes() ein setMaxNodes(int))"
 
 #. Tag: para
 #: Eviction_policies.xml:49
@@ -393,6 +590,72 @@
 "\n"
 "}"
 msgstr ""
+"public abstract class BaseEvictionPolicy implements EvictionPolicy\n"
+"{\n"
+"   protected static final Fqn ROOT = new Fqn(\"/\");\n"
+"\n"
+"   protected TreeCache cache_;\n"
+"\n"
+"   public BaseEvictionPolicy()\n"
+"   {\n"
+"   }\n"
+"\n"
+"   /** EvictionPolicy interface implementation */\n"
+"\n"
+"   /**\n"
+"    * Evict the node under given Fqn from cache.\n"
+"    *\n"
+"    * @param fqn The fqn of a node in cache.\n"
+"    * @throws Exception\n"
+"    */\n"
+"   public void evict(Fqn fqn) throws Exception\n"
+"   {\n"
+"      cache_.evict(fqn);\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Return a set of child names under a given Fqn.\n"
+"    *\n"
+"    * @param fqn Get child names for given Fqn in cache.\n"
+"    * @return Set of children name as Objects\n"
+"    */\n"
+"   public Set getChildrenNames(Fqn fqn)\n"
+"   {\n"
+"      try\n"
+"      {\n"
+"         return cache_.getChildrenNames(fqn);\n"
+"      }\n"
+"      catch (CacheException e)\n"
+"      {\n"
+"         e.printStackTrace();\n"
+"      }\n"
+"      return null;\n"
+"   }\n"
+"\n"
+"   public boolean hasChild(Fqn fqn)\n"
+"   {\n"
+"      return cache_.hasChild(fqn);\n"
+"   }\n"
+"\n"
+"   public Object getCacheData(Fqn fqn, Object key)\n"
+"   {\n"
+"      try\n"
+"      {\n"
+"         return cache_.get(fqn, key);\n"
+"      }\n"
+"      catch (CacheException e)\n"
+"      {\n"
+"         e.printStackTrace();\n"
+"      }\n"
+"      return null;\n"
+"   }\n"
+"\n"
+"   public void configure(TreeCache cache)\n"
+"   {\n"
+"      this.cache_ = cache;\n"
+"   }\n"
+"\n"
+"}"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:53
@@ -776,6 +1039,383 @@
 "\n"
 "}"
 msgstr ""
+"public abstract class BaseEvictionAlgorithm implements EvictionAlgorithm\n"
+"{\n"
+"   private static final Log log = LogFactory.getLog(BaseEvictionAlgorithm."
+"class);\n"
+"\n"
+"   protected Region region;\n"
+"   protected BoundedBuffer recycleQueue;\n"
+"   protected EvictionQueue evictionQueue;\n"
+"\n"
+"   /**\n"
+"    * This method will create an EvictionQueue implementation and prepare it "
+"for use.\n"
+"    *\n"
+"    * @param region Region to setup an eviction queue for.\n"
+"    * @return The created EvictionQueue to be used as the eviction queue for "
+"this algorithm.\n"
+"    * @throws EvictionException\n"
+"    * @see EvictionQueue\n"
+"    */\n"
+"   protected abstract EvictionQueue setupEvictionQueue(Region region) throws "
+"EvictionException;\n"
+"\n"
+"   /**\n"
+"    * This method will check whether the given node should be evicted or "
+"not.\n"
+"    *\n"
+"    * @param ne NodeEntry to test eviction for.\n"
+"    * @return True if the given node should be evicted. False if the given "
+"node should not \n"
+"    * be evicted.\n"
+"    */\n"
+"   protected abstract boolean shouldEvictNode(NodeEntry ne);\n"
+"\n"
+"   protected BaseEvictionAlgorithm()\n"
+"   {\n"
+"      recycleQueue = new BoundedBuffer();\n"
+"   }\n"
+"\n"
+"   protected void initialize(Region region) throws EvictionException\n"
+"   {\n"
+"      this.region = region;\n"
+"      evictionQueue = setupEvictionQueue(region);\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Process the given region.\n"
+"    * &lt;p/&gt;\n"
+"    * Eviction Processing encompasses the following:\n"
+"    * &lt;p/&gt;\n"
+"    * - Add/Remove/Visit Nodes\n"
+"    * - Prune according to Eviction Algorithm\n"
+"    * - Empty/Retry the recycle queue of previously evicted but locked "
+"(during actual \n"
+"    * cache eviction) \n"
+"    *nodes.\n"
+"    *\n"
+"    * @param region Cache region to process for eviction.\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   public void process(Region region) throws EvictionException\n"
+"   {\n"
+"      if (this.region == null)\n"
+"      {\n"
+"         this.initialize(region);\n"
+"      }\n"
+"\n"
+"      this.processQueues(region);\n"
+"      this.emptyRecycleQueue();\n"
+"      this.prune();\n"
+"   }\n"
+"\n"
+"   public void resetEvictionQueue(Region region)\n"
+"   {\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Get the underlying EvictionQueue implementation.\n"
+"    *\n"
+"    * @return the EvictionQueue used by this algorithm\n"
+"    * @see EvictionQueue\n"
+"    */\n"
+"   public EvictionQueue getEvictionQueue()\n"
+"   {\n"
+"      return this.evictionQueue;\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Event processing for Evict/Add/Visiting of nodes.\n"
+"    * &lt;p/&gt;\n"
+"    * - On AddEvents a new element is added into the eviction queue\n"
+"    * - On RemoveEvents, the removed element is removed from the eviction "
+"queue.\n"
+"    * - On VisitEvents, the visited node has its eviction statistics updated "
+"(idleTime, \n"
+"    * numberOfNodeVisists, etc..)\n"
+"    *\n"
+"    * @param region Cache region to process for eviction.\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   protected void processQueues(Region region) throws EvictionException\n"
+"   {\n"
+"      EvictedEventNode node;\n"
+"      int count = 0;\n"
+"      while ((node = region.takeLastEventNode()) != null)\n"
+"      {\n"
+"         int eventType = node.getEvent();\n"
+"         Fqn fqn = node.getFqn();\n"
+"\n"
+"         count++;\n"
+"         switch (eventType)\n"
+"         {\n"
+"            case EvictedEventNode.ADD_EVENT:\n"
+"               this.processAddedNodes(fqn);\n"
+"               break;\n"
+"            case EvictedEventNode.REMOVE_EVENT:\n"
+"               this.processRemovedNodes(fqn);\n"
+"               break;\n"
+"            case EvictedEventNode.VISIT_EVENT:\n"
+"               this.processVisitedNodes(fqn);\n"
+"               break;\n"
+"            default:\n"
+"               throw new RuntimeException(\"Illegal Eviction Event type \" + "
+"eventType);\n"
+"         }\n"
+"      }\n"
+"\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(\"processed \" + count + \" node events\");\n"
+"      }\n"
+"\n"
+"   }\n"
+"\n"
+"   protected void evict(NodeEntry ne)\n"
+"   {\n"
+"//      NodeEntry ne = evictionQueue.getNodeEntry(fqn);\n"
+"      if (ne != null)\n"
+"      {\n"
+"         evictionQueue.removeNodeEntry(ne);\n"
+"         if (!this.evictCacheNode(ne.getFqn()))\n"
+"         {\n"
+"            try\n"
+"            {\n"
+"               recycleQueue.put(ne);\n"
+"            }\n"
+"            catch (InterruptedException e)\n"
+"            {\n"
+"               e.printStackTrace();\n"
+"            }\n"
+"         }\n"
+"      }\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Evict a node from cache.\n"
+"    *\n"
+"    * @param fqn node corresponds to this fqn\n"
+"    * @return True if successful\n"
+"    */\n"
+"   protected boolean evictCacheNode(Fqn fqn)\n"
+"   {\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(\"Attempting to evict cache node with fqn of \" + fqn);\n"
+"      }\n"
+"      EvictionPolicy policy = region.getEvictionPolicy();\n"
+"      // Do an eviction of this node\n"
+"\n"
+"      try\n"
+"      {\n"
+"         policy.evict(fqn);\n"
+"      }\n"
+"      catch (Exception e)\n"
+"      {\n"
+"         if (e instanceof TimeoutException)\n"
+"         {\n"
+"            log.warn(\"eviction of \" + fqn + \" timed out. Will retry later."
+"\");\n"
+"            return false;\n"
+"         }\n"
+"         e.printStackTrace();\n"
+"         return false;\n"
+"      }\n"
+"\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(\"Eviction of cache node with fqn of \" + fqn + \" "
+"successful\");\n"
+"      }\n"
+"\n"
+"      return true;\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Process an Added cache node.\n"
+"    *\n"
+"    * @param fqn FQN of the added node.\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   protected void processAddedNodes(Fqn fqn) throws EvictionException\n"
+"   {\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(\"Adding node \" + fqn + \" to eviction queue\");\n"
+"      }\n"
+"\n"
+"      long stamp = System.currentTimeMillis();\n"
+"      NodeEntry ne = new NodeEntry(fqn);\n"
+"      ne.setModifiedTimeStamp(stamp);\n"
+"      ne.setNumberOfNodeVisits(1);\n"
+"      // add it to the node map and eviction queue\n"
+"      if (evictionQueue.containsNodeEntry(ne))\n"
+"      {\n"
+"         if (log.isTraceEnabled())\n"
+"         {\n"
+"            log.trace(\"Queue already contains \" + ne.getFqn() + \" "
+"processing it as visited\");\n"
+"         }\n"
+"         this.processVisitedNodes(ne.getFqn());\n"
+"         return;\n"
+"      }\n"
+"\n"
+"      evictionQueue.addNodeEntry(ne);\n"
+"\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(ne.getFqn() + \" added successfully to eviction queue"
+"\");\n"
+"      }\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Remove a node from cache.\n"
+"    * \n"
+"    * This method will remove the node from the eviction queue as well as\n"
+"    * evict the node from cache.\n"
+"    * \n"
+"    * If a node cannot be removed from cache, this method will remove it "
+"from the\n"
+"    * eviction queue and place the element into the recycleQueue. Each node "
+"in the recycle \n"
+"    * queue will get retried until proper cache eviction has taken place.\n"
+"    * \n"
+"    * Because EvictionQueues are collections, when iterating them from an "
+"iterator, use \n"
+"    * iterator.remove() to avoid ConcurrentModificationExceptions. Use the "
+"boolean \n"
+"    * parameter to indicate the calling context.\n"
+"    *\n"
+"    * @param fqn FQN of the removed node\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   protected void processRemovedNodes(Fqn fqn) throws EvictionException\n"
+"   {\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(\"Removing node \" + fqn + \" from eviction queue and "
+"attempting eviction\");\n"
+"      }\n"
+"\n"
+"      NodeEntry ne = evictionQueue.getNodeEntry(fqn);\n"
+"      if (ne != null)\n"
+"      {\n"
+"         evictionQueue.removeNodeEntry(ne);\n"
+"      }\n"
+"\n"
+"      if (log.isTraceEnabled())\n"
+"      {\n"
+"         log.trace(fqn + \" removed from eviction queue\");\n"
+"      }\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Visit a node in cache.\n"
+"    * &lt;p/&gt;\n"
+"    * This method will update the numVisits and modifiedTimestamp properties "
+"of the Node.\n"
+"    * These properties are used as statistics to determine eviction (LRU, "
+"LFU, MRU, etc..)\n"
+"    * &lt;p/&gt;\n"
+"    * *Note* that this method updates Node Entries by reference and does not "
+"put them back\n"
+"    * into the queue. For some sorted collections, a remove, and a re-add is "
+"required to\n"
+"    * maintain the sorted order of the elements.\n"
+"    *\n"
+"    * @param fqn FQN of the visited node.\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   protected void processVisitedNodes(Fqn fqn) throws EvictionException\n"
+"   {\n"
+"      NodeEntry ne = evictionQueue.getNodeEntry(fqn);\n"
+"      if (ne == null)\n"
+"      {\n"
+"         this.processAddedNodes(fqn);\n"
+"         return;\n"
+"      }\n"
+"      // note this method will visit and modify the node statistics by "
+"reference!\n"
+"      // if a collection is only guaranteed sort order by adding to the "
+"collection,\n"
+"      // this implementation will not guarantee sort order.\n"
+"      ne.setNumberOfNodeVisits(ne.getNumberOfNodeVisits() + 1);\n"
+"      ne.setModifiedTimeStamp(System.currentTimeMillis());\n"
+"   }\n"
+"\n"
+"   /**\n"
+"    * Empty the Recycle Queue.\n"
+"    * &lt;p/&gt;\n"
+"    * This method will go through the recycle queue and retry to evict the "
+"nodes from cache.\n"
+"    *\n"
+"    * @throws EvictionException\n"
+"    */\n"
+"   protected void emptyRecycleQueue() throws EvictionException\n"
+"   {\n"
+"      while (true)\n"
+"      {\n"
+"         Fqn fqn;\n"
+"\n"
+"         try\n"
+"         {\n"
+"            fqn = (Fqn) recycleQueue.poll(0);\n"
+"         }\n"
+"         catch (InterruptedException e)\n"
+"         {\n"
+"            e.printStackTrace();\n"
+"            break;\n"
+"         }\n"
+"\n"
+"         if (fqn == null)\n"
+"         {\n"
+"            if (log.isTraceEnabled())\n"
+"            {\n"
+"               log.trace(\"Recycle queue is empty\");\n"
+"            }\n"
+"            break;\n"
+"         }\n"
+"\n"
+"         if (log.isTraceEnabled())\n"
+"         {\n"
+"            log.trace(\"emptying recycle bin. Evict node \" + fqn);\n"
+"         }\n"
+"\n"
+"         // Still doesn't work\n"
+"         if (!evictCacheNode(fqn))\n"
+"         {\n"
+"            try\n"
+"            {\n"
+"               recycleQueue.put(fqn);\n"
+"            }\n"
+"            catch (InterruptedException e)\n"
+"            {\n"
+"               e.printStackTrace();\n"
+"            }\n"
+"            break;\n"
+"         }\n"
+"      }\n"
+"   }\n"
+"\n"
+"   protected void prune() throws EvictionException\n"
+"   {\n"
+"      NodeEntry entry;\n"
+"      while ((entry = evictionQueue.getFirstNodeEntry()) != null)\n"
+"      {\n"
+"         if (this.shouldEvictNode(entry))\n"
+"         {\n"
+"            this.evict(entry);\n"
+"         }\n"
+"         else\n"
+"         {\n"
+"            break;\n"
+"         }\n"
+"      }\n"
+"   }\n"
+"\n"
+"}"
 
 #. Tag: para
 #: Eviction_policies.xml:59
@@ -883,6 +1523,94 @@
 "\n"
 "   }"
 msgstr ""
+"public abstract class BaseSortedEvictionAlgorithm extends "
+"BaseEvictionAlgorithm \n"
+"   implements EvictionAlgorithm\n"
+"   {\n"
+"      private static final Log log = LogFactory.getLog"
+"(BaseSortedEvictionAlgorithm.class);\n"
+"\n"
+"      public void process(Region region) throws EvictionException\n"
+"      {\n"
+"         super.process(region);\n"
+"      }\n"
+"\n"
+"      protected void processQueues(Region region) throws EvictionException\n"
+"      {\n"
+"         boolean evictionNodesModified = false;\n"
+"\n"
+"         EvictedEventNode node;\n"
+"         int count = 0;\n"
+"         while ((node = region.takeLastEventNode()) != null)\n"
+"         {\n"
+"            int eventType = node.getEvent();\n"
+"            Fqn fqn = node.getFqn();\n"
+"\n"
+"            count++;\n"
+"            switch (eventType)\n"
+"            {\n"
+"               case EvictedEventNode.ADD_EVENT:\n"
+"                  this.processAddedNodes(fqn);\n"
+"                  evictionNodesModified = true;\n"
+"                  break;\n"
+"               case EvictedEventNode.REMOVE_EVENT:\n"
+"                  this.processRemovedNodes(fqn);\n"
+"                  break;\n"
+"               case EvictedEventNode.VISIT_EVENT:\n"
+"                  this.processVisitedNodes(fqn);\n"
+"                  evictionNodesModified = true;\n"
+"                  break;\n"
+"               default:\n"
+"                  throw new RuntimeException(\"Illegal Eviction Event type "
+"\" + eventType);\n"
+"            }\n"
+"         }\n"
+"\n"
+"         if (log.isTraceEnabled())\n"
+"         {\n"
+"            log.trace(\"Eviction nodes visited or added requires resort of "
+"queue \" +\n"
+"            evictionNodesModified);\n"
+"         }\n"
+"\n"
+"         this.resortEvictionQueue(evictionNodesModified);\n"
+"\n"
+"\n"
+"         if (log.isTraceEnabled())\n"
+"         {\n"
+"            log.trace(\"processed \" + count + \" node events\");\n"
+"         }\n"
+"\n"
+"      }\n"
+"\n"
+"      /**\n"
+"       * This method is called to resort the queue after add or visit events "
+"have occurred.\n"
+"       * \n"
+"       * If the parameter is true, the queue needs to be resorted. If it is "
+"false, the queue \n"
+"       * does not need resorting.\n"
+"       *\n"
+"       * @param evictionQueueModified True if the queue was added to or "
+"visisted during event \n"
+"       * processing.\n"
+"       */\n"
+"      protected void resortEvictionQueue(boolean evictionQueueModified)\n"
+"      {\n"
+"         long begin = System.currentTimeMillis();\n"
+"         ((SortedEvictionQueue) evictionQueue).resortEvictionQueue();\n"
+"         long end = System.currentTimeMillis();\n"
+"\n"
+"         if (log.isTraceEnabled())\n"
+"         {\n"
+"            long diff = end - begin;\n"
+"            log.trace(\"Took \" + diff + \"ms to sort queue with \" + "
+"getEvictionQueue().size()\n"
+"            + \" elements\");\n"
+"         }\n"
+"      }\n"
+"\n"
+"   }"
 
 #. Tag: para
 #: Eviction_policies.xml:70
@@ -907,6 +1635,13 @@
 "   public void resortEvictionQueue();\n"
 "}"
 msgstr ""
+"public interface SortedEvictionQueue extends EvictionQueue\n"
+"{\n"
+"   /**\n"
+"    * Provide contract to resort a sorted queue.\n"
+"    */\n"
+"   public void resortEvictionQueue();\n"
+"}"
 
 #. Tag: para
 #: Eviction_policies.xml:81
@@ -924,7 +1659,7 @@
 #: Eviction_policies.xml:89
 #, no-c-format
 msgid "TreeCache Eviction Policy Configuration"
-msgstr ""
+msgstr "TreeCache Eviction Policy Konfiguration"
 
 #. Tag: para
 #: Eviction_policies.xml:90
@@ -992,13 +1727,54 @@
 "             &lt;/config&gt;\n"
 "          &lt;/attribute&gt;"
 msgstr ""
+"&lt;attribute name=\"EvictionPolicyClass\"&gt;org.jboss.cache.eviction."
+"LRUPolicy&lt;/attribute&gt;\n"
+"          &lt;!-- Specific eviction policy configurations. This is LRU --"
+"&gt;\n"
+"          &lt;attribute name=\"EvictionPolicyConfig\"&gt;\n"
+"             &lt;config&gt;\n"
+"                &lt;attribute name=\"wakeUpIntervalSeconds\"&gt;5&lt;/"
+"attribute&gt;\n"
+"                &lt;!-- Cache wide default --&gt;\n"
+"                &lt;region name=\"/_default_\"&gt;\n"
+"                    &lt;attribute name=\"maxNodes\"&gt;5000&lt;/"
+"attribute&gt;\n"
+"                    &lt;attribute name=\"timeToLiveSeconds\"&gt;1000&lt;/"
+"attribute&gt;\n"
+"                &lt;/region&gt;\n"
+"                &lt;region name=\"/org/jboss/data\"&gt;\n"
+"                    &lt;attribute name=\"maxNodes\"&gt;5000&lt;/"
+"attribute&gt;\n"
+"                    &lt;attribute name=\"timeToLiveSeconds\"&gt;1000&lt;/"
+"attribute&gt;\n"
+"                &lt;/region&gt;\n"
+"                &lt;region name=\"/org/jboss/test/data\"&gt;\n"
+"                    &lt;attribute name=\"maxNodes\"&gt;5&lt;/attribute&gt;\n"
+"                    &lt;attribute name=\"timeToLiveSeconds\"&gt;4&lt;/"
+"attribute&gt;\n"
+"                &lt;/region&gt;\n"
+"                &lt;region name=\"/test/\"&gt;\n"
+"                    &lt;attribute name=\"maxNodes\"&gt;10000&lt;/"
+"attribute&gt;\n"
+"                    &lt;attribute name=\"timeToLiveSeconds\"&gt;5&lt;/"
+"attribute&gt;\n"
+"                &lt;/region&gt;\n"
+"                &lt;region name=\"/maxAgeTest/\"&gt;\n"
+"                   &lt;attribute name=\"maxNodes\"&gt;10000&lt;/"
+"attribute&gt;\n"
+"                   &lt;attribute name=\"timeToLiveSeconds\"&gt;8&lt;/"
+"attribute&gt;\n"
+"                   &lt;attribute name=\"maxAgeSeconds\"&gt;10&lt;/"
+"attribute&gt;\n"
+"                &lt;/region&gt;\n"
+"             &lt;/config&gt;\n"
+"          &lt;/attribute&gt;"
 
 #. Tag: para
 #: Eviction_policies.xml:97
 #, no-c-format
-msgid ""
-"Here is an example of configuring a different eviction provider per region"
-msgstr ""
+msgid "Here is an example of configuring a different eviction provider per region"
+msgstr "Hier ist ein Beispiel für die Konfiguration eines anderen Eviction Providers per Region"
 
 #. Tag: programlisting
 #: Eviction_policies.xml:100
@@ -1038,6 +1814,39 @@
 "         &lt;/config&gt;\n"
 "      &lt;/attribute&gt;"
 msgstr ""
+"&lt;attribute name=\"EvictionPolicyConfig\"&gt;\n"
+"         &lt;config&gt;\n"
+"            &lt;attribute name=\"wakeUpIntervalSeconds\"&gt;5&lt;/"
+"attribute&gt;\n"
+"            &lt;!-- Cache wide default --&gt;\n"
+"            &lt;region name=\"/_default_\" policyClass=\"org.jboss.cache."
+"eviction.LRUPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;5000&lt;/attribute&gt;\n"
+"               &lt;attribute name=\"timeToLiveSeconds\"&gt;1000&lt;/"
+"attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/org/jboss/data\" policyClass=\"org.jboss."
+"cache.eviction.LFUPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;5000&lt;/attribute&gt;\n"
+"               &lt;attribute name=\"minNodes\"&gt;1000&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/org/jboss/test/data\"\n"
+"                policyClass=\"org.jboss.cache.eviction.FIFOPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;5&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/test/\" policyClass=\"org.jboss.cache."
+"eviction.MRUPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;10000&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/maxAgeTest/\" policyClass=\"org.jboss.cache."
+"eviction.LRUPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;10000&lt;/attribute&gt;\n"
+"               &lt;attribute name=\"timeToLiveSeconds\"&gt;8&lt;/"
+"attribute&gt;\n"
+"               &lt;attribute name=\"maxAgeSeconds\"&gt;10&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"         &lt;/config&gt;\n"
+"      &lt;/attribute&gt;"
 
 #. Tag: para
 #: Eviction_policies.xml:101
@@ -1082,6 +1891,35 @@
 "         &lt;/config&gt;\n"
 "      &lt;/attribute&gt;"
 msgstr ""
+"&lt;attribute name=\"EvictionPolicyClass\"&gt;org.jboss.cache.eviction."
+"LRUPolicy&lt;/attribute&gt;\n"
+"      &lt;!-- Specific eviction policy configurations. This is LRU --&gt;\n"
+"      &lt;attribute name=\"EvictionPolicyConfig\"&gt;\n"
+"         &lt;config&gt;\n"
+"            &lt;attribute name=\"wakeUpIntervalSeconds\"&gt;5&lt;/"
+"attribute&gt;\n"
+"            &lt;!-- Cache wide default --&gt;\n"
+"            &lt;region name=\"/_default_\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;5000&lt;/attribute&gt;\n"
+"               &lt;attribute name=\"timeToLiveSeconds\"&gt;1000&lt;/"
+"attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/org/jboss/data\" policyClass=\"org.jboss."
+"cache.eviction.FIFOPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;5000&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/test/\" policyClass=\"org.jboss.cache."
+"eviction.MRUPolicy\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;10000&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"            &lt;region name=\"/maxAgeTest/\"&gt;\n"
+"               &lt;attribute name=\"maxNodes\"&gt;10000&lt;/attribute&gt;\n"
+"               &lt;attribute name=\"timeToLiveSeconds\"&gt;8&lt;/"
+"attribute&gt;\n"
+"               &lt;attribute name=\"maxAgeSeconds\"&gt;10&lt;/attribute&gt;\n"
+"            &lt;/region&gt;\n"
+"         &lt;/config&gt;\n"
+"      &lt;/attribute&gt;"
 
 #. Tag: para
 #: Eviction_policies.xml:105
@@ -1111,12 +1949,25 @@
 "         ((LRUConfiguration)config).setTimeToLiveSeconds(500);\n"
 "         ((LRUConfiguration)config).setMaxAgeSeconds(1000);"
 msgstr ""
+"// note this is just to show that a running TreeCache instance must be\n"
+"         // retrieved somehow. How it is implemented is up to the "
+"implementor.\n"
+"         TreeCache cache = getRunningTreeCacheInstance();\n"
+"\n"
+"         org.jboss.cache.eviction.RegionManager regionManager = cache."
+"getEvictionRegionManager();\n"
+"         org.jboss.cache.eviction.Region region = regionManager.getRegion(\"/"
+"myRegionName\");\n"
+"         EvictionConfiguation config = region.getEvictionConfiguration();\n"
+"         ((LRUConfiguration)config).setMaxNodes(12345);\n"
+"         ((LRUConfiguration)config).setTimeToLiveSeconds(500);\n"
+"         ((LRUConfiguration)config).setMaxAgeSeconds(1000);"
 
 #. Tag: title
 #: Eviction_policies.xml:112
 #, no-c-format
 msgid "TreeCache LRU eviction policy implementation"
-msgstr ""
+msgstr "TreeCache LRU Eviction Policy Implementierung"
 
 #. Tag: para
 #: Eviction_policies.xml:113
@@ -1185,13 +2036,13 @@
 #: Eviction_policies.xml:144
 #, no-c-format
 msgid "Please see the above section for an example."
-msgstr ""
+msgstr "Ein Beispiel sehen Sie im Abschnitt oben."
 
 #. Tag: title
 #: Eviction_policies.xml:150
 #, no-c-format
 msgid "TreeCache FIFO eviction policy implementation"
-msgstr ""
+msgstr "TreeCache FIFO Eviction Policy Implementierung"
 
 #. Tag: para
 #: Eviction_policies.xml:151
@@ -1217,13 +2068,13 @@
 #: Eviction_policies.xml:233
 #, no-c-format
 msgid "Please read the above section for an example."
-msgstr ""
+msgstr "Ein Beispiel sehen Sie im Abschnitt oben."
 
 #. Tag: title
 #: Eviction_policies.xml:178
 #, no-c-format
 msgid "TreeCache MRU eviction policy implementation"
-msgstr ""
+msgstr "TreeCache MRU Eviction Policy Implementierung"
 
 #. Tag: para
 #: Eviction_policies.xml:179
@@ -1240,7 +2091,7 @@
 #: Eviction_policies.xml:206
 #, no-c-format
 msgid "TreeCache LFU eviction policy implementation"
-msgstr ""
+msgstr "TreeCache LFU Eviction Policy Implementierung"
 
 #. Tag: para
 #: Eviction_policies.xml:207
@@ -1281,3 +2132,4 @@
 "cache is pruned down to the 10 most frequently used nodes when the eviction "
 "timer makes a pass through the eviction algorithm."
 msgstr ""
+




More information about the jbosscache-commits mailing list