JBoss Cache SVN: r7043 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-31 07:21:10 -0400 (Fri, 31 Oct 2008)
New Revision: 7043
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
Log:
Better concurrent creation of regions and initialization of region eviction queues
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-31 04:22:58 UTC (rev 7042)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-31 11:21:10 UTC (rev 7043)
@@ -50,7 +50,7 @@
private Fqn fqn;
private Status status;
private ClassLoader classLoader;
- private BlockingQueue<EvictionEvent> evictionEventQueue = null;
+ private volatile BlockingQueue<EvictionEvent> evictionEventQueue = null;
private int capacityWarnThreshold = 0;
private EvictionRegionConfig evictionRegionConfig;
private EvictionAlgorithm evictionAlgorithm;
@@ -270,7 +270,10 @@
{
log.warn("Capacity warn threshold used in eviction is smaller than 1.");
}
- evictionEventQueue = new LinkedBlockingQueue<EvictionEvent>(size);
+ synchronized (this)
+ {
+ if (evictionEventQueue == null) evictionEventQueue = new LinkedBlockingQueue<EvictionEvent>(size);
+ }
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-31 04:22:58 UTC (rev 7042)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-31 11:21:10 UTC (rev 7043)
@@ -236,7 +236,10 @@
if (createIfAbsent)
{
Region r = new RegionImpl(fqnToUse, this);
- regionsRegistry.put(fqnToUse, r);
+
+ // could be created concurrently; so make sure we use appropriate methods on regionsRegistry for this.
+ Region previous = regionsRegistry.putIfAbsent(fqnToUse, r);
+ if (previous != null) r = previous;
if (type == MARSHALLING)
{
// insert current class loader into region so at least it is recognised as a marshalling region
16 years, 1 month
JBoss Cache SVN: r7042 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-31 00:22:58 -0400 (Fri, 31 Oct 2008)
New Revision: 7042
Modified:
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
Log:
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-10-31 03:55:37 UTC (rev 7041)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-10-31 04:22:58 UTC (rev 7042)
@@ -211,3 +211,4 @@
return LRUAlgorithmConfig.class;
}
}
+
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-10-31 03:55:37 UTC (rev 7041)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-10-31 04:22:58 UTC (rev 7042)
@@ -244,8 +244,11 @@
private void registerEvictionEventToRegionManager(Fqn fqn, EvictionEvent.Type type, int elementDifference, Region region)
{
//we do not trigger eviction events for resident nodes
- if (dataContainer.isResident(fqn)) return;
-
+ if (dataContainer.isResident(fqn))
+ {
+ if (trace) log.trace("Ignoring Fqn " + fqn + " as it is marked as resident");
+ return;
+ }
region.registerEvictionEvent(fqn, type, elementDifference);
if (trace) log.trace("Registering event " + type + " on node " + fqn);
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-10-31 03:55:37 UTC (rev 7041)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-10-31 04:22:58 UTC (rev 7042)
@@ -64,7 +64,7 @@
" loopback=\"true\" \n" +
" max_bundle_size=\"64000\" \n" +
" max_bundle_timeout=\"30\" \n" +
- " mcast_addr=\"228.10.10.10\"\n" +
+ " mcast_addr=\"232.5.5.5\"\n" +
" mcast_port=\"45588\" \n" +
" mcast_recv_buf_size=\"100000000\" \n" +
" mcast_send_buf_size=\"640000\"\n" +
16 years, 1 month
JBoss Cache SVN: r7041 - enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/es-ES.
by jbosscache-commits@lists.jboss.org
Author: mospina
Date: 2008-10-30 23:55:37 -0400 (Thu, 30 Oct 2008)
New Revision: 7041
Modified:
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/es-ES/Replication.po
Log:
translation in progress
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/es-ES/Replication.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/es-ES/Replication.po 2008-10-31 03:44:34 UTC (rev 7040)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Tree_Cache_Guide/es-ES/Replication.po 2008-10-31 03:55:37 UTC (rev 7041)
@@ -8,7 +8,7 @@
"Project-Id-Version: Replication\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:44+0000\n"
-"PO-Revision-Date: 2008-10-24 14:21+1000\n"
+"PO-Revision-Date: 2008-10-31 13:53+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -322,7 +322,7 @@
"other caches. This means that even if a cache containing your session dies, "
"other instances will still be able to access this data by asking the cluster "
"to search through their backups for this data."
-msgstr ""
+msgstr "La gravitación de datos es un concepto en donde si se realiza una petición a un caché en el clúster y el caché no contiene esta información entonces le pide los datos a otras instancias en el clúster. Si incluso esto falla enotnces (opcionalmente) le pide a otras instancias que chequeen en los datos que almacenan para otros cachés. Esto significa que incluso si un caché que contiene su sesión muere entonces otras instancias todavía podrán acceder estos datos pidiéndole al clúster que busque estos datos en sus copias de seguridad."
#. Tag: para
#: Replication.xml:97
@@ -333,7 +333,7 @@
"removed from all other instances (and backups) so that if session affinity "
"is used, the affinity should now be to this new cache instance which has "
"just <emphasis>taken ownership</emphasis> of this data."
-msgstr ""
+msgstr "Una vez localizados estos datos entonces se transfieren a la instacia que los solicitó y se añaden al árbol de datos de la instancia. Luego se remueve (opcionalmente) de todas las otras instancias (y las copias de seguridad) de manera que si se utiliza la afinidad de sesiones entonces la afinidad se debe encontrar en esta nueva instancia de caché la cual acaba de <emphasis>tomar propiedad</emphasis> de estos datos. "
#. Tag: para
#: Replication.xml:100
@@ -341,7 +341,7 @@
msgid ""
"Data Gravitation is implemented as an interceptor. The following (all "
"optional) configuration properties pertain to data gravitation."
-msgstr ""
+msgstr "La gravitación de datos se implementa como un interceptor. Las siguientes propiedades de configuración (todas opcionales) son pertinentes a la gravitación de datos. "
#. Tag: para
#: Replication.xml:103
@@ -354,6 +354,8 @@
"in cache loaders will remain. This is useful if you have a shared cache "
"loader configured. Defaults to <literal>true</literal>."
msgstr ""
+"<literal>dataGravitationRemoveOnFind</literal> - fuerza a todos los cachés remotos que son dueños de los datos o que mantienen copias de seguridad de estos a remover esos datos, de este modo haciendo que el caché que realiza la petición sea el nuevo dueño de los datos. Si se configura como <literal>false</"
+"literal> entonces se emite un evict en vez de un remove así que cualquier estado persistido en cargadores de caché se mantendrá. Esto es útil si tiene un cargador de caché compartido configurado. Su valor por defecto es <literal>true</literal>."
#. Tag: para
#: Replication.xml:106
@@ -365,6 +367,11 @@
"<literal>true</literal> then backup nodes can respond to data gravitation "
"requests in addition to data owners."
msgstr ""
+"<literal>dataGravitationSearchBackupTrees</literal> - Le piede a las instancias remotas que busquen en sus copias de seguridade instances "
+"to search through their backups as well as main data trees. Defaults to "
+"<literal>true</literal>. The resulting effect is that if this is "
+"<literal>true</literal> then backup nodes can respond to data gravitation "
+"requests in addition to data owners."
#. Tag: para
#: Replication.xml:109
@@ -378,12 +385,15 @@
"literal> is <literal>true</literal> this <literal>Option</literal> is "
"unnecessary."
msgstr ""
+"<literal>autoDataGravitation</literal> - Si la gravitación de datos debe ocurrir para toda falta del caché. Su valor por defecto es <literal>false</literal> para prevenir llamadas innnecesarias de la red. La mayoría de los casos sabrá cuando necesitan la gravitación de datos y pasará una <literal>Option</literal> para habilitar la gravitación de datos de acuerdo a cada invocación. Si <literal>autoDataGravitation</"
+"literal> es <literal>true</literal> entonces esta <literal>Option</literal> es "
+"innecesaria."
#. Tag: title
#: Replication.xml:116
#, no-c-format
msgid "Implementation"
-msgstr ""
+msgstr "Implementación"
#. Tag: title
#: Replication.xml:119
@@ -391,14 +401,13 @@
msgid ""
"Class diagram of the classes involved in buddy replication and how they are "
"related to each other"
-msgstr ""
+msgstr "Diagrama de las clases involucradas en la replicación de compañeros y la manera en que se relacionan entre sí"
#. Tag: title
#: Replication.xml:130
#, no-c-format
-#, fuzzy
msgid "Configuration"
-msgstr "Configuración"
+msgstr "Configuración "
#. Tag: programlisting
#: Replication.xml:132
@@ -528,7 +537,7 @@
#: Replication.xml:141
#, no-c-format
msgid "Clustered Cache - Using Invalidation"
-msgstr ""
+msgstr "Chaché en clústers - uso de validación"
#. Tag: para
#: Replication.xml:142
@@ -543,7 +552,7 @@
"traffic is minimised as invalidation messages are very small compared to "
"replicating updated data, and also that other caches in the cluster look up "
"modified data in a lazy manner, only when needed."
-msgstr ""
+msgstr "Si un caché es configurado para invalidación en vez de replicación entonces cada vez que se cambian datos en un caché los otros cachés en el clúster reciben un mensaje informándoles que sus datos no están actualizados y por lo tanto deben ser eliminados de la memoria. La invalidación, cuando se utiliza con un cargador de caché compartido (vea el capítulo sobre cargadores de caché) haría que los cachés remotos se referieran a cargador de caché compartido para recuperar datos modificados. El beneficio de esto es doble: se minimiza el tráfico de la red ya que los mensajes de invalidación son muy pequeños comparados con la replicación de datos actualizados y también que otros cachés en el clúster buscan los datos modificados de una manera perezosa sólo cuando es necesario. "
#. Tag: para
#: Replication.xml:145
@@ -553,7 +562,7 @@
"at the end of a transaction, upon successful commit. This is usually more "
"efficient as invalidation messages can be optimised for the transaction as a "
"whole rather than on a per-modification basis."
-msgstr ""
+msgstr "Los mensajes de invalidación se envían después de cada modificación (no transacciones) o al final de una transacción cuando tenga éxito al guardar los cambios. Usualmente esto es más eficiente ya que los mensajes de invalidación se pueden optimizar para la transacción entera en vez de modificación por modificación. "
#. Tag: para
#: Replication.xml:148
@@ -564,5 +573,5 @@
"cluster receive invalidation messages and have evicted stale data while "
"asynchronous invalidation works in a 'fire-and-forget' mode, where "
"invalidation messages are broadcast but doesn't block and wait for responses."
-msgstr ""
+msgstr "La invalidación también puede ser sincrónica o asincrónica y como en el caso de replicación la invalidación sincrónica bloquea hasta que todos los cachés en el clúster reciban mensajes de invalidación y hayan eliminado datos no actualizados mientras que la invalidación asincrónica funciona en modo 'dispara-y-olvida', en donde los mensajes de invalidación se emiten pero no bloquea y espera respuestas. "
16 years, 1 month
JBoss Cache SVN: r7040 - in core/trunk/src: test/java/org/jboss/cache/eviction and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 23:44:34 -0400 (Thu, 30 Oct 2008)
New Revision: 7040
Modified:
core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java
core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/FIFOConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/LFUConfigurationTest.java
Log:
Fixed broken tests + parched expiration algo
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -185,7 +185,7 @@
i.remove();
continue;
}
- if (ee.getExpiration() < now || (max != 0 && set.size() > max))
+ if (ee.getExpiration() < now || (max != -1 && set.size() > max))
{
i.remove();
evictCacheNode(ee.getFqn());
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -158,4 +158,16 @@
warnNoExpirationKey = true;
timeToLive = -1;
}
+
+
+ public String toString()
+ {
+ return "ExpirationAlgorithmConfig{" +
+ "expirationKeyName='" + expirationKeyName + '\'' +
+ ", warnNoExpirationKey=" + warnNoExpirationKey +
+ ", timeToLive=" + timeToLive +
+ ", maxNodes=" + maxNodes +
+ ", minTTL=" + minTimeToLive +
+ '}';
+ }
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeConfigurationTest.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ElementSizeConfigurationTest.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -6,10 +6,9 @@
*/
package org.jboss.cache.eviction;
-import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
-import static org.testng.AssertJUnit.*;
+import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
@@ -45,18 +44,9 @@
"</region>";
Element element = XmlConfigHelper.stringToElementInCoreNS(xml);
- try
- {
- EvictionElementParser.parseEvictionPolicyConfig(element, config);
- config.validate();
- }
- catch (ConfigurationException ce)
- {
- assertTrue("Configure exception properly thrown", true);
- return;
- }
-
- fail("Invalid region Element Size configuration did not cause ConfigureException to be thrown with empty maxElementsPerNode attribute");
+ EvictionElementParser.parseEvictionPolicyConfig(element, config);
+ config.validate();
+ assert config.getMaxElementsPerNode() == -1;
}
@@ -73,7 +63,7 @@
config.validate();
assertEquals(100, config.getMaxElementsPerNode());
- assertEquals(0, config.getMaxNodes());
+ assertEquals(-1, config.getMaxNodes());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -11,6 +11,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
+import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
@@ -22,7 +23,6 @@
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
-import org.jboss.cache.UnitTestCacheFactory;
/**
* Unit tests for {@link org.jboss.cache.eviction.ExpirationAlgorithm}.
@@ -59,6 +59,8 @@
future = System.currentTimeMillis() + 500;
past = System.currentTimeMillis() - 200;
+
+ System.out.println(eAC);
}
@AfterMethod(alwaysRun = true)
@@ -91,7 +93,7 @@
}
}
- @Test(invocationCount = 10)
+ @Test
public void testEviction() throws Exception
{
cache.put(fqn1, ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/FIFOConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/FIFOConfigurationTest.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/FIFOConfigurationTest.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -9,7 +9,8 @@
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
-import static org.testng.AssertJUnit.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
@@ -46,17 +47,10 @@
Element element = XmlConfigHelper.stringToElementInCoreNS(xml);
- try
- {
- EvictionElementParser.parseEvictionPolicyConfig(element, config);
- config.validate();
- }
- catch (ConfigurationException ce)
- {
- assertTrue("Configure Exception properly thrown", true);
- return;
- }
- fail("Invalid region FIFO configuration did not cause ConfigureException to be thrown");
+ EvictionElementParser.parseEvictionPolicyConfig(element, config);
+ config.validate();
+ assert config.getMaxNodes() == -1;
+ assert config.getMinTimeToLive() == -1;
}
public void testXMLParse3() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LFUConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LFUConfigurationTest.java 2008-10-31 02:56:09 UTC (rev 7039)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LFUConfigurationTest.java 2008-10-31 03:44:34 UTC (rev 7040)
@@ -53,7 +53,7 @@
config.validate();
assertEquals(10, config.getMinNodes());
- assertEquals(0, config.getMaxNodes());
+ assertEquals(-1, config.getMaxNodes());
}
public void testXMLParsing3() throws Exception
16 years, 1 month
JBoss Cache SVN: r7039 - in core/trunk/src: main/java/org/jboss/cache/eviction and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 22:56:09 -0400 (Thu, 30 Oct 2008)
New Revision: 7039
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java
core/trunk/src/test/java/org/jboss/cache/eviction/MRUConfigurationTest.java
Log:
Added more debug
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-31 01:16:04 UTC (rev 7038)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-31 02:56:09 UTC (rev 7039)
@@ -124,6 +124,7 @@
public void processEvictionQueues()
{
+ if (trace) log.trace("Processing eviction queue for region ["+getFqn()+"]. Queue size is " + evictionEventQueue.size());
evictionAlgorithm.process(evictionEventQueue);
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java 2008-10-31 01:16:04 UTC (rev 7038)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java 2008-10-31 02:56:09 UTC (rev 7039)
@@ -134,6 +134,8 @@
{
synchronized (processedRegions)
{
+ if (log.isTraceEnabled()) log.trace("Processing eviction regions " + processedRegions);
+
for (Region region : processedRegions)
{
handleRegion(region);
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/MRUConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/MRUConfigurationTest.java 2008-10-31 01:16:04 UTC (rev 7038)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/MRUConfigurationTest.java 2008-10-31 02:56:09 UTC (rev 7039)
@@ -6,11 +6,9 @@
*/
package org.jboss.cache.eviction;
-import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -71,22 +69,16 @@
String xml = "<region name=\"/Test/\">\n" +
"</region>";
Element element = XmlConfigHelper.stringToElementInCoreNS(xml);
- boolean caught = false;
- try
- {
EvictionElementParser.parseEvictionPolicyConfig(element, config);
config.validate();
- }
- catch (ConfigurationException ce)
- {
- caught = true;
- }
- assertTrue("Configure exception should have been caught, maxNodes is required", caught);
+ assert config.getMaxNodes() == -1;
+
xml = "<region name=\"/Test/\">\n" +
"<property name=\"maxNodes\" value=\"10000\"></property>\n" +
"</region>";
+
element = XmlConfigHelper.stringToElementInCoreNS(xml);
EvictionElementParser.parseEvictionPolicyConfig(element, config);
16 years, 1 month
JBoss Cache SVN: r7038 - in core/trunk/src/main/java/org/jboss/cache: eviction and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 21:16:04 -0400 (Thu, 30 Oct 2008)
New Revision: 7038
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeAlgorithmConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/EvictionAlgorithmConfigBase.java
core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithmConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithmConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithmConfig.java
Log:
Eviction defaults to match 2.x
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -509,7 +509,7 @@
{
// this is ok, but certainly log this as a warning
// this is hugely noisy!
- if (log.isDebugEnabled()) log.debug("Unrecognised attribute " + propName + ". Please check your configuration. Ignoring!!");
+ if (log.isTraceEnabled()) log.trace("Unrecognised attribute " + propName + ". Please check your configuration. Ignoring!!");
}
catch (Exception e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -120,10 +120,17 @@
XmlConfigHelper.setValues(c, attributes.stringAttribs, false, false);
// Special handling for XML elements -- we hard code the parsing
setXmlValues(c, attributes.xmlAttribs);
-
+ if (c.getEvictionConfig() != null) correctEvictionUnlimitedValues(c.getEvictionConfig());
return c;
}
+ private void correctEvictionUnlimitedValues(EvictionConfig ec)
+ {
+ EvictionRegionConfig def = ec.getDefaultEvictionRegionConfig();
+ EvictionAlgorithmConfig eac = def.getEvictionAlgorithmConfig();
+
+ }
+
/**
* Check for and remove any attributes that were supported in the
* 1.x releases and no longer are. Log a WARN or throw a
@@ -532,8 +539,22 @@
if (key.indexOf("Seconds") > 0)
{
key = key.substring(0, key.length() - "Seconds".length());
+
+
value = value.trim() + "000";
}
+ int intval = 1;
+ try
+ {
+ intval = Integer.parseInt(value);
+
+ }
+ catch (NumberFormatException e)
+ {
+
+ }
+ value = intval < 1 ? "-1" : value;
+
updatedElements.put(key, value);
}
attributes.stringAttribs.clear();
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ElementSizeAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -40,7 +40,7 @@
private static final long serialVersionUID = 2510593544656833758L;
@Dynamic
- private int maxElementsPerNode;
+ private int maxElementsPerNode = -1;
public ElementSizeAlgorithmConfig()
{
@@ -75,11 +75,7 @@
public void validate() throws ConfigurationException
{
super.validate();
- if (maxElementsPerNode < 0)
- {
- throw new ConfigurationException("maxElementsPerNode must be must be " +
- "configured to a value greater than or equal to 0");
- }
+ if (maxElementsPerNode < -1) maxElementsPerNode = -1;
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/EvictionAlgorithmConfigBase.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/EvictionAlgorithmConfigBase.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/EvictionAlgorithmConfigBase.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -41,9 +41,9 @@
protected String evictionAlgorithmClassName;
@Dynamic
- protected int maxNodes = 0;
+ protected int maxNodes = -1;
@Dynamic
- protected long minTimeToLive;
+ protected long minTimeToLive = -1;
/**
* Can only be instantiated by a subclass.
@@ -131,8 +131,8 @@
public void reset()
{
- maxNodes = 0;
- minTimeToLive = 0;
+ maxNodes = -1;
+ minTimeToLive = -1;
}
public EvictionAlgorithmConfig clone() throws CloneNotSupportedException
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -49,7 +49,7 @@
private boolean warnNoExpirationKey = true;
@Dynamic
- private long timeToLive = 0;
+ private long timeToLive = -1;
public ExpirationAlgorithmConfig()
{
@@ -156,6 +156,6 @@
super.reset();
evictionAlgorithmClassName = ExpirationAlgorithm.class.getName();
warnNoExpirationKey = true;
- timeToLive = 0;
+ timeToLive = -1;
}
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -60,11 +60,7 @@
public void validate() throws ConfigurationException
{
super.validate();
- if (getMaxNodes() < 0)
- {
- throw new ConfigurationException("maxNodes must be must be " +
- "configured to a value greater than or equal to 0");
- }
+ if (maxNodes < -1) maxNodes = -1;
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -37,7 +37,7 @@
private static final long serialVersionUID = 1865801530398969179L;
@Dynamic
- private int minNodes;
+ private int minNodes = -1;
public LFUAlgorithmConfig()
{
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -48,13 +48,24 @@
@Override
protected boolean shouldEvictNode(NodeEntry entry)
{
+ if (trace) log.trace("Deciding whether to evict node " + entry);
+ LRUAlgorithmConfig config = (LRUAlgorithmConfig) evictionAlgorithmConfig;
+ if (trace) log.trace("Config is " + config);
// check the minimum time to live and see if we should not evict the node. This check will
// ensure that, if configured, nodes are kept alive for at least a minimum period of time.
- if (isYoungerThanMinimumTimeToLive(entry)) return false;
+ if (isYoungerThanMinimumTimeToLive(entry))
+ {
+ log.trace("Do not evict - is younger than minimum TTL");
+ return false;
+ }
- LRUAlgorithmConfig config = (LRUAlgorithmConfig) evictionAlgorithmConfig;
+
// no idle or max time limit
- if (config.getTimeToLive() < 0 && config.getMaxAge() < 0) return false;
+ if (config.getTimeToLive() < 0 && config.getMaxAge() < 0)
+ {
+ log.trace("No idle or max time limit!");
+ return false;
+ }
long currentTime = System.currentTimeMillis();
if (config.getTimeToLive() > -1)
@@ -103,10 +114,17 @@
@Override
protected void evict(NodeEntry ne)
{
+ if (trace)
+ {
+ if (ne == null) log.trace("Got a NULL node entry!");
+ else log.trace("About to evict " + ne.getFqn());
+ }
+
if (ne != null && !this.evictCacheNode(ne.getFqn()))
{
try
{
+ if (trace) log.trace("Could not evict " + ne.getFqn() + " so adding to recycle queue");
recycleQueue.put(ne.getFqn());
}
catch (InterruptedException e)
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -45,13 +45,13 @@
* value expressed in millis
*/
@Dynamic
- private long timeToLive;
+ private long timeToLive = -1;
/**
* value expressed in millis
*/
@Dynamic
- private long maxAge;
+ private long maxAge = -1;
public LRUAlgorithmConfig()
{
@@ -139,11 +139,7 @@
public void validate() throws ConfigurationException
{
super.validate();
- if (timeToLive < -1)
- {
- throw new ConfigurationException("timeToLive must be " +
- "configured to a value greater than or equal to 0 (or -1 for unlimited time to live) for " + getEvictionAlgorithmClassName());
- }
+ if (timeToLive < -1) timeToLive = -1;
}
public String toString()
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithmConfig.java 2008-10-31 01:16:04 UTC (rev 7038)
@@ -59,8 +59,7 @@
public void validate() throws ConfigurationException
{
super.validate();
- if (getMaxNodes() < 0)
- throw new ConfigurationException("maxNodes not configured");
+ if (getMaxNodes() < -1) maxNodes = -1;
}
@Override
16 years, 1 month
JBoss Cache SVN: r7037 - core/trunk/src/main/java/org/jboss/cache/eviction.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 18:55:15 -0400 (Thu, 30 Oct 2008)
New Revision: 7037
Modified:
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java
Log:
Better toString
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java 2008-10-30 17:47:51 UTC (rev 7036)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithmConfig.java 2008-10-30 22:55:15 UTC (rev 7037)
@@ -148,10 +148,12 @@
public String toString()
{
- return "LRUAlgorithmConfig {" +
+ return getClass().getSimpleName() + "{" +
"algorithmClassName=" + evictionAlgorithmClassName +
", timeToLive=" + timeToLive +
", maxAge=" + maxAge +
+ ", minTTL=" + minTimeToLive +
+ ", maxNodes=" + maxNodes +
'}';
}
16 years, 1 month
JBoss Cache SVN: r7036 - core/trunk/src/main/resources.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 13:47:51 -0400 (Thu, 30 Oct 2008)
New Revision: 7036
Modified:
core/trunk/src/main/resources/config2to3.xslt
Log:
Updated
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2008-10-30 17:35:49 UTC (rev 7035)
+++ core/trunk/src/main/resources/config2to3.xslt 2008-10-30 17:47:51 UTC (rev 7036)
@@ -1,531 +1,529 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns="urn:jboss:jbosscache-core:config:3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
- <xsl:output method="xml" indent="yes"/>
+<xsl:stylesheet xmlns="urn:jboss:jbosscache-core:config:3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
+ <xsl:template match="/">
+ <xsl:element name="jbosscache">
+ <xsl:call-template name="locking"/>
+ <xsl:call-template name="transaction"/>
+ <xsl:call-template name="serialization"/>
+ <xsl:call-template name="startup"/>
+ <xsl:apply-templates select="//attribute"/>
+ </xsl:element>
+ </xsl:template>
- <xsl:template match="/">
- <xsl:element name="jbosscache">
- <xsl:call-template name="locking"/>
- <xsl:call-template name="transaction"/>
- <xsl:call-template name="serialization"/>
- <xsl:call-template name="startup"/>
- <xsl:apply-templates select="//attribute"/>
- </xsl:element>
- </xsl:template>
+ <xsl:template match="//attribute"/>
- <xsl:template match="//attribute"/>
+ <xsl:template name="locking">
+ <xsl:if
+ test="//attribute[@name='IsolationLevel'] | //attribute[@name='LockAcquisitionTimeout'] | //attribute[@name='LockParentForChildInsertRemove']">
+ <xsl:element name="locking">
+ <xsl:if test="//attribute[@name='IsolationLevel']">
+ <xsl:attribute name="isolationLevel">
+ <xsl:value-of select="normalize-space(//attribute[@name='IsolationLevel'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='LockAcquisitionTimeout']">
+ <xsl:attribute name="lockAcquisitionTimeout">
+ <xsl:value-of select="normalize-space(//attribute[@name='LockAcquisitionTimeout'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='LockParentForChildInsertRemove']">
+ <xsl:attribute name="lockParentForChildInsertRemove">
+ <xsl:value-of select="normalize-space(//attribute[@name='LockParentForChildInsertRemove'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='NodeLockingScheme']">
+ <xsl:attribute name="nodeLockingScheme">
+ <xsl:value-of select="normalize-space(//attribute[@name='NodeLockingScheme'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="locking">
- <xsl:if
- test="//attribute[@name='IsolationLevel'] | //attribute[@name='LockAcquisitionTimeout'] | //attribute[@name='LockParentForChildInsertRemove']">
- <xsl:element name="locking">
- <xsl:if test="//attribute[@name='IsolationLevel']">
- <xsl:attribute name="isolationLevel">
- <xsl:value-of select="normalize-space(//attribute[@name='IsolationLevel'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='LockAcquisitionTimeout']">
- <xsl:attribute name="lockAcquisitionTimeout">
- <xsl:value-of select="normalize-space(//attribute[@name='LockAcquisitionTimeout'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='LockParentForChildInsertRemove']">
- <xsl:attribute name="lockParentForChildInsertRemove">
- <xsl:value-of select="normalize-space(//attribute[@name='LockParentForChildInsertRemove'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='NodeLockingScheme']">
- <xsl:attribute name="nodeLockingScheme">
- <xsl:value-of select="normalize-space(//attribute[@name='NodeLockingScheme'])"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="transaction">
+ <xsl:if
+ test="//attribute[@name='TransactionManagerLookupClass'] | //attribute[@name='SyncRollbackPhase'] | //attribute[@name='SyncCommitPhase']">
+ <xsl:element name="transaction">
+ <xsl:if test="//attribute[@name='TransactionManagerLookupClass']">
+ <xsl:attribute name="transactionManagerLookupClass">
+ <xsl:value-of select="normalize-space(//attribute[@name='TransactionManagerLookupClass'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='SyncCommitPhase']">
+ <xsl:attribute name="syncCommitPhase">
+ <xsl:value-of select="normalize-space(//attribute[@name='SyncCommitPhase'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='SyncRollbackPhase']">
+ <xsl:attribute name="syncRollbackPhase">
+ <xsl:value-of select="normalize-space(//attribute[@name='SyncRollbackPhase'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="transaction">
- <xsl:if
- test="//attribute[@name='TransactionManagerLookupClass'] | //attribute[@name='SyncRollbackPhase'] | //attribute[@name='SyncCommitPhase']">
- <xsl:element name="transaction">
- <xsl:if test="//attribute[@name='TransactionManagerLookupClass']">
- <xsl:attribute name="transactionManagerLookupClass">
- <xsl:value-of select="normalize-space(//attribute[@name='TransactionManagerLookupClass'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='SyncCommitPhase']">
- <xsl:attribute name="syncCommitPhase">
- <xsl:value-of select="normalize-space(//attribute[@name='SyncCommitPhase'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='SyncRollbackPhase']">
- <xsl:attribute name="syncRollbackPhase">
- <xsl:value-of select="normalize-space(//attribute[@name='SyncRollbackPhase'])"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- </xsl:template>
+ <xsl:template match="//attribute[@name='CacheMode']">
+ <xsl:if test="(normalize-space(.) = 'INVALIDATION_ASYNC') or (normalize-space(.) = 'INVALIDATION_SYNC')">
+ <clustering mode="invalidation">
+ <xsl:if test="//attribute[@name='ClusterName']">
+ <xsl:attribute name="clusterName">
+ <xsl:value-of select="normalize-space(//attribute[@name='ClusterName'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(normalize-space(.) = 'INVALIDATION_ASYNC')">
+ <xsl:element name="async">
+ <xsl:call-template name="asyncAttributes"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(normalize-space(.) = 'INVALIDATION_SYNC')">
+ <xsl:element name="sync">
+ <xsl:call-template name="syncAttributes"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:call-template name="stateRetrieval" />
+ <xsl:call-template name="transport"/>
+ </clustering>
+ </xsl:if>
+ <xsl:if test="(normalize-space(.) = 'REPL_ASYNC') or (normalize-space(.) = 'REPL_SYNC')">
+ <clustering mode="replication">
+ <xsl:if test="//attribute[@name='ClusterName']">
+ <xsl:attribute name="clusterName">
+ <xsl:value-of select="normalize-space(//attribute[@name='ClusterName'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(normalize-space(.) = 'REPL_ASYNC')">
+ <xsl:element name="async">
+ <xsl:call-template name="asyncAttributes"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(normalize-space(.) = 'REPL_SYNC')">
+ <xsl:element name="sync">
+ <xsl:call-template name="syncAttributes"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:call-template name="buddy"/>
+ <xsl:call-template name="stateRetrieval" />
+ <xsl:call-template name="transport"/>
+ </clustering>
+ </xsl:if>
+ </xsl:template>
- <xsl:template match="//attribute[@name='CacheMode']">
- <xsl:if test="(normalize-space(.) = 'INVALIDATION_ASYNC') or (normalize-space(.) = 'INVALIDATION_SYNC')">
- <clustering mode="invalidation">
- <xsl:if test="//attribute[@name='ClusterName']">
- <xsl:attribute name="clusterName">
- <xsl:value-of select="normalize-space(//attribute[@name='ClusterName'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="(normalize-space(.) = 'INVALIDATION_ASYNC')">
- <xsl:element name="async">
- <xsl:call-template name="asyncAttributes"/>
- </xsl:element>
- </xsl:if>
- <xsl:if test="(normalize-space(.) = 'INVALIDATION_SYNC')">
- <xsl:element name="sync">
- <xsl:call-template name="syncAttributes"/>
- </xsl:element>
- </xsl:if>
- <xsl:call-template name="stateRetrieval" />
- <xsl:call-template name="transport"/>
- </clustering>
- </xsl:if>
- <xsl:if test="(normalize-space(.) = 'REPL_ASYNC') or (normalize-space(.) = 'REPL_SYNC')">
- <clustering mode="replication">
- <xsl:if test="//attribute[@name='ClusterName']">
- <xsl:attribute name="clusterName">
- <xsl:value-of select="normalize-space(//attribute[@name='ClusterName'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="(normalize-space(.) = 'REPL_ASYNC')">
- <xsl:element name="async">
- <xsl:call-template name="asyncAttributes"/>
- </xsl:element>
- </xsl:if>
- <xsl:if test="(normalize-space(.) = 'REPL_SYNC')">
- <xsl:element name="sync">
- <xsl:call-template name="syncAttributes"/>
- </xsl:element>
- </xsl:if>
- <xsl:call-template name="buddy"/>
- <xsl:call-template name="stateRetrieval" />
- <xsl:call-template name="transport"/>
- </clustering>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="serialization">
+ <xsl:if
+ test="//attribute[@name='ObjectInputStreamPoolSize'] | //attribute[@name='ObjectOutputStreamPoolSize'] | //attribute[@name='ReplicationVersion'] | //attribute[@name='MarshallerClass'] | //attribute[@name='UseLazyDeserialization'] | //attribute[@name='UseRegionBasedMarshalling']">
+ <serialization>
+ <xsl:if test="//attribute[@name='ObjectInputStreamPoolSize']">
+ <xsl:attribute name="objectInputStreamPoolSize">
+ <xsl:value-of select="normalize-space(//attribute[@name='ObjectInputStreamPoolSize'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='ObjectOutputStreamPoolSize']">
+ <xsl:attribute name="objectOutputStreamPoolSize">
+ <xsl:value-of select="normalize-space(//attribute[@name='ObjectOutputStreamPoolSize'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='ReplicationVersion']">
+ <xsl:attribute name="version">
+ <xsl:value-of select="normalize-space(//attribute[@name='ReplicationVersion'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='MarshallerClass']">
+ <xsl:attribute name="marshallerClass">
+ <xsl:value-of select="normalize-space(//attribute[@name='MarshallerClass'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='UseLazyDeserialization']">
+ <xsl:attribute name="useLazyDeserialization">
+ <xsl:value-of select="normalize-space(//attribute[@name='UseLazyDeserialization'])"/>
+ </xsl:attribute>
+ </xsl:if>
- <xsl:template name="serialization">
- <xsl:if
- test="//attribute[@name='ObjectInputStreamPoolSize'] | //attribute[@name='ObjectOutputStreamPoolSize'] | //attribute[@name='ReplicationVersion'] | //attribute[@name='MarshallerClass'] | //attribute[@name='UseLazyDeserialization'] | //attribute[@name='UseRegionBasedMarshalling']">
- <serialization>
- <xsl:if test="//attribute[@name='ObjectInputStreamPoolSize']">
- <xsl:attribute name="objectInputStreamPoolSize">
- <xsl:value-of select="normalize-space(//attribute[@name='ObjectInputStreamPoolSize'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='ObjectOutputStreamPoolSize']">
- <xsl:attribute name="objectOutputStreamPoolSize">
- <xsl:value-of select="normalize-space(//attribute[@name='ObjectOutputStreamPoolSize'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='ReplicationVersion']">
- <xsl:attribute name="version">
- <xsl:value-of select="normalize-space(//attribute[@name='ReplicationVersion'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='MarshallerClass']">
- <xsl:attribute name="marshallerClass">
- <xsl:value-of select="normalize-space(//attribute[@name='MarshallerClass'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='UseLazyDeserialization']">
- <xsl:attribute name="useLazyDeserialization">
- <xsl:value-of select="normalize-space(//attribute[@name='UseLazyDeserialization'])"/>
- </xsl:attribute>
- </xsl:if>
+ <xsl:if test="//attribute[@name='UseRegionBasedMarshalling']">
+ <xsl:attribute name="useRegionBasedMarshalling">
+ <xsl:value-of select="normalize-space(//attribute[@name='UseRegionBasedMarshalling'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ </serialization>
+ </xsl:if>
+ </xsl:template>
- <xsl:if test="//attribute[@name='UseRegionBasedMarshalling']">
- <xsl:attribute name="useRegionBasedMarshalling">
- <xsl:value-of select="normalize-space(//attribute[@name='UseRegionBasedMarshalling'])"/>
- </xsl:attribute>
- </xsl:if>
- </serialization>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="buddy">
+ <xsl:if test="//attribute[@name='BuddyReplicationConfig']">
+ <buddy>
+ <xsl:if test="//buddyReplicationEnabled">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="//buddyReplicationEnabled"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//buddyPoolName">
+ <xsl:attribute name="poolName">
+ <xsl:value-of select="//buddyPoolName"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//buddyCommunicationTimeout">
+ <xsl:attribute name="communicationTimeout">
+ <xsl:value-of select="//buddyCommunicationTimeout"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//autoDataGravitation | //dataGravitationRemoveOnFind | //dataGravitationSearchBackupTrees">
+ <dataGravitation>
+ <xsl:if test="//autoDataGravitation">
+ <xsl:attribute name="auto">
+ <xsl:value-of select="//autoDataGravitation"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//dataGravitationRemoveOnFind">
+ <xsl:attribute name="removeOnFind">
+ <xsl:value-of select="//dataGravitationRemoveOnFind"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//dataGravitationSearchBackupTrees">
+ <xsl:attribute name="searchBackupTrees">
+ <xsl:value-of select="//dataGravitationSearchBackupTrees"/>
+ </xsl:attribute>
+ </xsl:if>
+ </dataGravitation>
+ </xsl:if>
+ <xsl:if test="//buddyLocatorProperties">
+ <locator>
+ <xsl:if test="//buddyLocatorClass">
+ <xsl:attribute name="class">
+ <xsl:value-of select="//buddyLocatorClass"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//buddyLocatorProperties">
+ <properties>
+ <xsl:value-of select="//buddyLocatorProperties"/>
+ </properties>
+ </xsl:if>
+ </locator>
+ </xsl:if>
+ </buddy>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="buddy">
- <xsl:if test="//attribute[@name='BuddyReplicationConfig']">
- <buddy>
- <xsl:if test="//buddyReplicationEnabled">
- <xsl:attribute name="enabled">
- <xsl:value-of select="//buddyReplicationEnabled"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//buddyPoolName">
- <xsl:attribute name="poolName">
- <xsl:value-of select="//buddyPoolName"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//buddyCommunicationTimeout">
- <xsl:attribute name="communicationTimeout">
- <xsl:value-of select="//buddyCommunicationTimeout"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//autoDataGravitation | //dataGravitationRemoveOnFind | //dataGravitationSearchBackupTrees">
- <dataGravitation>
- <xsl:if test="//autoDataGravitation">
- <xsl:attribute name="auto">
- <xsl:value-of select="//autoDataGravitation"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//dataGravitationRemoveOnFind">
- <xsl:attribute name="removeOnFind">
- <xsl:value-of select="//dataGravitationRemoveOnFind"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//dataGravitationSearchBackupTrees">
- <xsl:attribute name="searchBackupTrees">
- <xsl:value-of select="//dataGravitationSearchBackupTrees"/>
- </xsl:attribute>
- </xsl:if>
- </dataGravitation>
- </xsl:if>
- <xsl:if test="//buddyLocatorProperties">
- <locator>
- <xsl:if test="//buddyLocatorClass">
- <xsl:attribute name="class">
- <xsl:value-of select="//buddyLocatorClass"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//buddyLocatorProperties">
- <properties>
- <xsl:value-of select="//buddyLocatorProperties"/>
- </properties>
- </xsl:if>
- </locator>
- </xsl:if>
- </buddy>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="asyncAttributes">
+ <xsl:if test="//attribute[@name='UseReplQueue']">
+ <xsl:attribute name="useReplQueue">
+ <xsl:value-of select="//attribute[@name='UseReplQueue']"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='ReplQueueInterval']">
+ <xsl:attribute name="replQueueInterval">
+ <xsl:value-of select="//attribute[@name='ReplQueueInterval']"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='ReplQueueMaxElements']">
+ <xsl:attribute name="replQueueMaxElements">
+ <xsl:value-of select="//attribute[@name='ReplQueueMaxElements']"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="asyncAttributes">
- <xsl:if test="//attribute[@name='UseReplQueue']">
- <xsl:attribute name="useReplQueue">
- <xsl:value-of select="//attribute[@name='UseReplQueue']"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='ReplQueueInterval']">
- <xsl:attribute name="replQueueInterval">
- <xsl:value-of select="//attribute[@name='ReplQueueInterval']"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='ReplQueueMaxElements']">
- <xsl:attribute name="replQueueMaxElements">
- <xsl:value-of select="//attribute[@name='ReplQueueMaxElements']"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="syncAttributes">
+ <xsl:if test="//attribute[@name='SyncReplTimeout']">
+ <xsl:attribute name="replTimeout">
+ <xsl:value-of select="//attribute[@name='SyncReplTimeout']"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="syncAttributes">
- <xsl:if test="//attribute[@name='SyncReplTimeout']">
- <xsl:attribute name="replTimeout">
- <xsl:value-of select="//attribute[@name='SyncReplTimeout']"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="startup">
+ <xsl:if test="//attribute[@name='InactiveOnStartup']">
+ <xsl:element name="startup">
+ <xsl:attribute name="regionsInactiveOnStartup">
+ <xsl:value-of select="normalize-space(//attribute[@name='InactiveOnStartup'])"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="startup">
- <xsl:if test="//attribute[@name='InactiveOnStartup']">
- <xsl:element name="startup">
- <xsl:attribute name="regionsInactiveOnStartup">
- <xsl:value-of select="normalize-space(//attribute[@name='InactiveOnStartup'])"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- </xsl:template>
+ <xsl:template name="stateRetrieval">
+ <xsl:if
+ test="//attribute[@name='FetchInMemoryState'] | //attribute[@name='StateRetrievalTimeout']">
+ <xsl:element name="stateRetrieval">
+ <xsl:if test="//attribute[@name='FetchInMemoryState']">
+ <xsl:attribute name="fetchInMemoryState">
+ <xsl:value-of select="normalize-space(//attribute[@name='FetchInMemoryState'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='StateRetrievalTimeout']">
+ <xsl:attribute name="timeout">
+ <xsl:value-of select="normalize-space(//attribute[@name='StateRetrievalTimeout'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="stateRetrieval">
- <xsl:if
- test="//attribute[@name='FetchInMemoryState'] | //attribute[@name='StateRetrievalTimeout']">
- <xsl:element name="stateRetrieval">
- <xsl:if test="//attribute[@name='FetchInMemoryState']">
- <xsl:attribute name="fetchInMemoryState">
- <xsl:value-of select="normalize-space(//attribute[@name='FetchInMemoryState'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='StateRetrievalTimeout']">
- <xsl:attribute name="timeout">
- <xsl:value-of select="normalize-space(//attribute[@name='StateRetrievalTimeout'])"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:if>
- </xsl:template>
+ <xsl:template match="//attribute[@name='ShutdownHookBehavior']">
+ <shutdown>
+ <xsl:attribute name="hookBehavior">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:attribute>
+ </shutdown>
+ </xsl:template>
- <xsl:template match="//attribute[@name='ShutdownHookBehavior']">
- <shutdown>
- <xsl:attribute name="hookBehavior">
- <xsl:value-of select="normalize-space(.)"/>
- </xsl:attribute>
- </shutdown>
- </xsl:template>
+ <xsl:template match="//attribute[@name='ExposeManagementStatistics']">
+ <jmxStatistics>
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:attribute>
+ </jmxStatistics>
+ </xsl:template>
- <xsl:template match="//attribute[@name='ExposeManagementStatistics']">
- <jmxStatistics>
- <xsl:attribute name="enabled">
- <xsl:value-of select="normalize-space(.)"/>
- </xsl:attribute>
- </jmxStatistics>
- </xsl:template>
+ <xsl:template match="//attribute[@name='EvictionPolicyConfig']">
+ <eviction>
+ <xsl:if test="./config/attribute[@name='wakeUpIntervalSeconds']">
+ <xsl:attribute name="wakeUpInterval">
+ <xsl:value-of
+ select="concat(normalize-space(./config/attribute[@name='wakeUpIntervalSeconds']), '000')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./config/region[@name='/_default_']">
+ <default>
+ <xsl:choose>
+ <xsl:when test="./config/region[@name='/_default_' and @policyClass]">
+ <xsl:if test="./config/region[@name='/_default_' and not(starts-with(@policyClass,'org.jboss.cache.eviction'))]">
+ <xsl:message terminate="yes">A custom eviction policy is used for '/_default_' region. Starting with JBossCache 3.x the eviction API changed, so this config file will require manual transformation.</xsl:message>
+ </xsl:if>
+ <xsl:attribute name="algorithmClass">
+ <xsl:value-of
+ select="concat(substring-before(./config/region[@name='/_default_']/@policyClass,'Policy'), 'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if
+ test="./config/attribute[@name='policyClass' and starts-with(string(.), 'org.jboss.cache.eviction')]">
+ <xsl:attribute name="algorithmClass">
+ <xsl:value-of
+ select="concat(substring-before(./config/attribute[@name='policyClass'],'Policy'), 'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if
+ test="./config/attribute[@name='policyClass' and not(starts-with(string(.), 'org.jboss.cache.eviction'))]">
+ <xsl:message terminate="yes">Custom eviction policies require manual transformation.</xsl:message>
+ </xsl:if>
+ <xsl:if test="./config/attribute[@name='eventQueueSize']">
+ <xsl:attribute name="eventQueueSize">
+ <xsl:value-of select="normalize-space(./config/attribute[@name='eventQueueSize'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="./config/region[@name='/_default_']/attribute">
+ <xsl:call-template name="attributesSecondsSubstitution">
+ <xsl:with-param name="attr" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </default>
+ </xsl:if>
+ <xsl:for-each select="./config/region[@name!='/_default_']">
+ <region>
+ <xsl:if test="@name">
+ <xsl:attribute name="name">
+ <xsl:value-of select="@name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@policyClass and starts-with(string(@policyClass), 'org.jboss.cache.eviction')">
+ <xsl:attribute name="algorithmClass">
+ <xsl:value-of select="concat(substring-before(@policyClass,'Policy'), 'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@policyClass and not(starts-with(string(@policyClass), 'org.jboss.cache.eviction'))">
+ <xsl:message terminate="yes">Custom eviction policies require manual transformation.</xsl:message>
+ </xsl:if>
+ <xsl:if test="not(@policyClass)">
+ <xsl:attribute name="algorithmClass">
+ <xsl:value-of
+ select="concat(substring-before(../attribute[@name='policyClass'],'Policy'), 'Algorithm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@eventQueueSize">
+ <xsl:attribute name="eventQueueSize">
+ <xsl:value-of select="normalize-space(@eventQueueSize)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@eventQueueSize)">
+ <xsl:attribute name="eventQueueSize">
+ <xsl:value-of select="normalize-space(../attribute[@name='eventQueueSize'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="./*">
+ <xsl:call-template name="attributesSecondsSubstitution">
+ <xsl:with-param name="attr" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </region>
+ </xsl:for-each>
+ </eviction>
+ </xsl:template>
- <xsl:template match="//attribute[@name='EvictionPolicyConfig']">
- <eviction>
- <xsl:if test="./config/attribute[@name='wakeUpIntervalSeconds']">
- <xsl:attribute name="wakeUpInterval">
- <xsl:value-of
- select="concat(normalize-space(./config/attribute[@name='wakeUpIntervalSeconds']), '000')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./config/region[@name='/_default_']">
- <default>
+ <xsl:template name="attributesSecondsSubstitution">
+ <xsl:param name="attr"/>
+ <property>
+ <xsl:choose>
+ <xsl:when test="contains($attr/@name,'Seconds')">
+ <xsl:attribute name="name">
+ <xsl:value-of select="substring-before($attr/@name,'Seconds')"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
<xsl:choose>
- <xsl:when test="./config/region[@name='/_default_' and @policyClass]">
- <xsl:if test="./config/region[@name='/_default_' and not(starts-with(@policyClass,'org.jboss.cache.eviction'))]">
- <xsl:message terminate="yes">A custom eviction policy is used for '/_default_' region. Starting with JBossCache 3.x the eviction API changed, so this config file will require manual transformation.</xsl:message>
- </xsl:if>
- <xsl:attribute name="algorithmClass">
- <xsl:value-of
- select="concat(substring-before(./config/region[@name='/_default_']/@policyClass,'Policy'), 'Algorithm')"/>
- </xsl:attribute>
+ <xsl:when test="$attr < 1">
+ <xsl:value-of select="-1"/>
</xsl:when>
+ <xsl:when test="$attr > 0">
+ <xsl:value-of select="concat($attr,'000')"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:if
- test="./config/attribute[@name='policyClass' and starts-with(string(.), 'org.jboss.cache.eviction')]">
- <xsl:attribute name="algorithmClass">
- <xsl:value-of
- select="concat(substring-before(./config/attribute[@name='policyClass'],'Policy'), 'Algorithm')"/>
- </xsl:attribute>
- </xsl:if>
+ <xsl:value-of select="$attr"/>
</xsl:otherwise>
</xsl:choose>
- <xsl:if
- test="./config/attribute[@name='policyClass' and not(starts-with(string(.), 'org.jboss.cache.eviction'))]">
- <xsl:message terminate="yes">Custom eviction policies require manual transformation.</xsl:message>
- </xsl:if>
- <xsl:if test="./config/attribute[@name='eventQueueSize']">
- <xsl:attribute name="eventQueueSize">
- <xsl:value-of select="normalize-space(./config/attribute[@name='eventQueueSize'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:for-each select="./config/region[@name='/_default_']/attribute">
- <xsl:call-template name="attributesSecondsSubstitution">
- <xsl:with-param name="attr" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </default>
- </xsl:if>
- <xsl:for-each select="./config/region[@name!='/_default_']">
- <region>
- <xsl:if test="@name">
- <xsl:attribute name="name">
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@policyClass and starts-with(string(@policyClass), 'org.jboss.cache.eviction')">
- <xsl:attribute name="algorithmClass">
- <xsl:value-of select="concat(substring-before(@policyClass,'Policy'), 'Algorithm')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@policyClass and not(starts-with(string(@policyClass), 'org.jboss.cache.eviction'))">
- <xsl:message terminate="yes">Custom eviction policies require manual transformation.</xsl:message>
- </xsl:if>
- <xsl:if test="not(@policyClass)">
- <xsl:attribute name="algorithmClass">
- <xsl:value-of
- select="concat(substring-before(../attribute[@name='policyClass'],'Policy'), 'Algorithm')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@eventQueueSize">
- <xsl:attribute name="eventQueueSize">
- <xsl:value-of select="normalize-space(@eventQueueSize)"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="not(@eventQueueSize)">
- <xsl:attribute name="eventQueueSize">
- <xsl:value-of select="normalize-space(../attribute[@name='eventQueueSize'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:for-each select="./*">
- <xsl:call-template name="attributesSecondsSubstitution">
- <xsl:with-param name="attr" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </region>
- </xsl:for-each>
- </eviction>
- </xsl:template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="name">
+ <xsl:value-of select="string($attr/@name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:choose>
+ <xsl:when test="$attr/@name = 'maxNodes' and $attr = '0'">
+ <xsl:value-of select="-1"/>
+ </xsl:when>
+ <xsl:when test="$attr/@name = 'minNodes' and $attr = '0'">
+ <xsl:value-of select="-1"/>
+ </xsl:when>
+ <xsl:when test="$attr < 0">
+ <xsl:value-of select="-1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$attr"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </property>
+ </xsl:template>
- <xsl:template name="attributesSecondsSubstitution">
- <xsl:param name="attr"/>
- <property>
- <xsl:choose>
- <xsl:when test="contains($attr/@name,'Seconds')">
- <xsl:attribute name="name">
- <xsl:value-of select="substring-before($attr/@name,'Seconds')"/>
- </xsl:attribute>
- <xsl:attribute name="value">
- <xsl:choose>
- <xsl:when test="$attr < 1">
- <xsl:value-of select="-1"/>
- </xsl:when>
- <xsl:when test="$attr > 0">
- <xsl:value-of select="concat($attr,'000')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$attr"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="name">
- <xsl:value-of select="string($attr/@name)"/>
- </xsl:attribute>
- <xsl:attribute name="value">
- <xsl:choose>
- <xsl:when test="$attr/@name = 'maxNodes' and $attr = '0'">
- <xsl:value-of select="-1"/>
- </xsl:when>
- <xsl:when test="$attr/@name = 'minNodes' and $attr = '0'">
- <xsl:value-of select="-1"/>
- </xsl:when>
- <xsl:when test="$attr < 0">
- <xsl:value-of select="-1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$attr"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </property>
- </xsl:template>
+ <xsl:template match="//attribute[@name='CacheLoaderConfig'] | //attribute[@name='CacheLoaderConfiguration']">
+ <loaders>
+ <xsl:if test="./config/passivation">
+ <xsl:attribute name="passivation">
+ <xsl:value-of select="./config/passivation"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./config/shared">
+ <xsl:attribute name="shared">
+ <xsl:value-of select="./config/shared"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./config/preload">
+ <preload>
+ <xsl:call-template name="preloadTokenizer">
+ <xsl:with-param name="string" select="./config/preload"/>
+ <xsl:with-param name="delimiter" select="','"/>
+ </xsl:call-template>
+ </preload>
+ </xsl:if>
+ <xsl:for-each select="./config/cacheloader">
+ <loader>
+ <xsl:if test="./class">
+ <xsl:attribute name="class">
+ <xsl:value-of select="./class"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./async">
+ <xsl:attribute name="async">
+ <xsl:value-of select="./async"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./fetchPersistentState">
+ <xsl:attribute name="fetchPersistentState">
+ <xsl:value-of select="./fetchPersistentState"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./ignoreModifications">
+ <xsl:attribute name="ignoreModifications">
+ <xsl:value-of select="./ignoreModifications"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./purgeOnStartup">
+ <xsl:attribute name="purgeOnStartup">
+ <xsl:value-of select="./purgeOnStartup"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./properties">
+ <xsl:copy-of select="./properties"/>
+ </xsl:if>
+ <xsl:if test="./singletonStore">
+ <singletonStore>
+ <xsl:if test="./singletonStore/enabled">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="./singletonStore/enabled"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./singletonStore/enabled">
+ <xsl:attribute name="enabled">
+ <xsl:value-of select="./singletonStore/enabled"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./singletonStore/class">
+ <xsl:attribute name="class">
+ <xsl:value-of select="./singletonStore/class"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="./singletonStore/properties"/>
+ </singletonStore>
+ </xsl:if>
+ </loader>
+ </xsl:for-each>
+ </loaders>
+ </xsl:template>
- <xsl:template match="//attribute[@name='CacheLoaderConfig'] | //attribute[@name='CacheLoaderConfiguration']">
- <loaders>
- <xsl:if test="./config/passivation">
- <xsl:attribute name="passivation">
- <xsl:value-of select="./config/passivation"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./config/shared">
- <xsl:attribute name="shared">
- <xsl:value-of select="./config/shared"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./config/preload">
- <preload>
- <xsl:call-template name="preloadTokenizer">
- <xsl:with-param name="string" select="./config/preload"/>
- <xsl:with-param name="delimiter" select="','"/>
- </xsl:call-template>
- </preload>
- </xsl:if>
- <xsl:for-each select="./config/cacheloader">
- <loader>
- <xsl:if test="./class">
- <xsl:attribute name="class">
- <xsl:value-of select="./class"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./async">
- <xsl:attribute name="async">
- <xsl:value-of select="./async"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./fetchPersistentState">
- <xsl:attribute name="fetchPersistentState">
- <xsl:value-of select="./fetchPersistentState"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./ignoreModifications">
- <xsl:attribute name="ignoreModifications">
- <xsl:value-of select="./ignoreModifications"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./purgeOnStartup">
- <xsl:attribute name="purgeOnStartup">
- <xsl:value-of select="./purgeOnStartup"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./properties">
- <xsl:copy-of select="./properties"/>
- </xsl:if>
- <xsl:if test="./singletonStore">
- <singletonStore>
- <xsl:if test="./singletonStore/enabled">
- <xsl:attribute name="enabled">
- <xsl:value-of select="./singletonStore/enabled"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./singletonStore/enabled">
- <xsl:attribute name="enabled">
- <xsl:value-of select="./singletonStore/enabled"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="./singletonStore/class">
- <xsl:attribute name="class">
- <xsl:value-of select="./singletonStore/class"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="./singletonStore/properties"/>
- </singletonStore>
- </xsl:if>
- </loader>
- </xsl:for-each>
- </loaders>
- </xsl:template>
+ <xsl:template name="preloadTokenizer">
+ <xsl:param name="string"/>
+ <xsl:param name="delimiter" select="' '"/>
+ <xsl:choose>
+ <xsl:when test="$delimiter and contains($string, $delimiter)">
+ <node>
+ <xsl:attribute name="fqn">
+ <xsl:value-of select="substring-before($string,$delimiter)"/>
+ </xsl:attribute>
+ </node>
+ <xsl:call-template name="preloadTokenizer">
+ <xsl:with-param name="string" select="substring-after($string,$delimiter)"/>
+ <xsl:with-param name="delimiter" select="$delimiter"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <node>
+ <xsl:attribute name="fqn">
+ <xsl:value-of select="$string"/>
+ </xsl:attribute>
+ </node>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <xsl:template name="preloadTokenizer">
- <xsl:param name="string"/>
- <xsl:param name="delimiter" select="' '"/>
- <xsl:choose>
- <xsl:when test="$delimiter and contains($string, $delimiter)">
- <node>
- <xsl:attribute name="fqn">
- <xsl:value-of select="substring-before($string,$delimiter)"/>
- </xsl:attribute>
- </node>
- <xsl:call-template name="preloadTokenizer">
- <xsl:with-param name="string" select="substring-after($string,$delimiter)"/>
- <xsl:with-param name="delimiter" select="$delimiter"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <node>
- <xsl:attribute name="fqn">
- <xsl:value-of select="$string"/>
- </xsl:attribute>
- </node>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:template name="transport">
+ <xsl:if
+ test="//attribute[@name='MultiplexerStack'] | //attribute[@name='ClusterConfig']">
+ <jgroupsConfig>
+ <xsl:if test="//attribute[@name='MultiplexerStack']">
+ <xsl:attribute name="multiplexerStack">
+ <xsl:value-of select="normalize-space(//attribute[@name='MultiplexerStack'])"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//attribute[@name='ClusterConfig']">
+ <xsl:copy-of select="//attribute[@name='ClusterConfig']/config/*"/>
+ </xsl:if>
+ </jgroupsConfig>
+ </xsl:if>
+ </xsl:template>
- <xsl:template name="transport">
- <xsl:if
- test="//attribute[@name='MultiplexerStack'] | //attribute[@name='ClusterConfig']">
- <jgroupsConfig>
- <xsl:if test="//attribute[@name='MultiplexerStack']">
- <xsl:attribute name="multiplexerStack">
- <xsl:value-of select="normalize-space(//attribute[@name='MultiplexerStack'])"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="//attribute[@name='ClusterConfig']">
- <xsl:copy-of select="//attribute[@name='ClusterConfig']/config/*"/>
- </xsl:if>
- </jgroupsConfig>
- </xsl:if>
- </xsl:template>
-
</xsl:stylesheet>
16 years, 1 month
JBoss Cache SVN: r7035 - core/trunk/src/main/java/org/jboss/cache/config/parsing.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 13:35:49 -0400 (Thu, 30 Oct 2008)
New Revision: 7035
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
Log:
msgs
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-10-30 17:10:26 UTC (rev 7034)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-10-30 17:35:49 UTC (rev 7035)
@@ -118,14 +118,16 @@
FileOutputStream fos = new FileOutputStream(destinationName);
convertor.parse(is, fos, "config2to3.xslt");
is.close();
- System.out.println("File successfully created.");
+ System.out.println("---");
+ System.out.println("New configuration file ["+destinationName+"] successfully created.");
+ System.out.println("---");
}
private Transformer getTransformer(InputStream xsltInStream)
throws TransformerConfigurationException
{
TransformerFactory tFactory = TransformerFactory.newInstance();
- StreamSource stylesource = new StreamSource(xsltInStream);
+ StreamSource stylesource = new StreamSource(xsltInStream);
return tFactory.newTransformer(stylesource);
}
16 years, 1 month
JBoss Cache SVN: r7034 - in core/trunk/src: test/java/org/jboss/cache/config and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-30 13:10:26 -0400 (Thu, 30 Oct 2008)
New Revision: 7034
Modified:
core/trunk/src/main/resources/config2to3.xslt
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml
Log:
Updated to take into account new meanings of 0 in eviction config and translate old 0's to -1's to denote no limit.
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/main/resources/config2to3.xslt 2008-10-30 17:10:26 UTC (rev 7034)
@@ -374,11 +374,14 @@
</xsl:attribute>
<xsl:attribute name="value">
<xsl:choose>
- <xsl:when test="$attr = '0'">
+ <xsl:when test="$attr < 1">
<xsl:value-of select="-1"/>
</xsl:when>
+ <xsl:when test="$attr > 0">
+ <xsl:value-of select="concat($attr,'000')"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:value-of select="concat($attr,'000')"/>
+ <xsl:value-of select="$attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -395,6 +398,9 @@
<xsl:when test="$attr/@name = 'minNodes' and $attr = '0'">
<xsl:value-of select="-1"/>
</xsl:when>
+ <xsl:when test="$attr < 0">
+ <xsl:value-of select="-1"/>
+ </xsl:when>
<xsl:otherwise>
<xsl:value-of select="$attr"/>
</xsl:otherwise>
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTransformerTest.java 2008-10-30 17:10:26 UTC (rev 7034)
@@ -133,10 +133,10 @@
private void correctUnlimitedValues(EvictionRegionConfig erc)
{
LRUAlgorithmConfig eac = (LRUAlgorithmConfig) erc.getEvictionAlgorithmConfig();
- if (eac.getMaxAge() == 0) eac.setMaxAge(-1);
- if (eac.getMaxNodes() == 0) eac.setMaxNodes(-1);
- if (eac.getMinTimeToLive() == 0) eac.setMinTimeToLive(-1);
- if (eac.getTimeToLive() == 0) eac.setTimeToLive(-1);
+ if (eac.getMaxAge() <= 0) eac.setMaxAge(-1);
+ if (eac.getMaxNodes() <= 0) eac.setMaxNodes(-1);
+ if (eac.getMinTimeToLive() <= 0) eac.setMinTimeToLive(-1);
+ if (eac.getTimeToLive() <= 0) eac.setTimeToLive(-1);
}
private String getFileName(String s)
Modified: core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml
===================================================================
--- core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml 2008-10-30 16:57:53 UTC (rev 7033)
+++ core/trunk/src/test/resources/configs/conf2x/zeroTTL.xml 2008-10-30 17:10:26 UTC (rev 7034)
@@ -32,6 +32,16 @@
<attribute name="minTimeToLiveSeconds">1000</attribute>
<attribute name="maxNodes">0</attribute>
</region>
+ <!-- already set to -1 -->
+ <region name="/org/jboss/data2">
+ <attribute name="minTimeToLiveSeconds">1000</attribute>
+ <attribute name="maxNodes">-1</attribute>
+ </region>
+ <!-- already set to -10 -->
+ <region name="/org/jboss/data3">
+ <attribute name="minTimeToLiveSeconds">1000</attribute>
+ <attribute name="maxNodes">-10</attribute>
+ </region>
</config>
</attribute>
</mbean>
16 years, 1 month