JBoss Cache SVN: r6238 - 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-07-10 07:19:53 -0400 (Thu, 10 Jul 2008)
New Revision: 6238
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
Log:
Fixed passivation bug
Added better toString for EvictCommand
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-07-10 10:51:38 UTC (rev 6237)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-07-10 11:19:53 UTC (rev 6238)
@@ -187,7 +187,7 @@
@Override
public String toString()
{
- return "EvictCommand{" +
+ return getClass().getSimpleName() + "{" +
"fqn=" + fqn +
", recursive=" + recursive +
"}";
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-07-10 10:51:38 UTC (rev 6237)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-07-10 11:19:53 UTC (rev 6238)
@@ -46,16 +46,10 @@
@Override
public Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command) throws Throwable
{
- if (command.isRecursive())
+ List<Fqn> fqnsToEvict;
+ if (command.isRecursive() && (fqnsToEvict = command.getNodesToEvict()) != null && !fqnsToEvict.isEmpty())
{
- List<Fqn> fqnsToEvict = command.getNodesToEvict();
- if (fqnsToEvict != null)
- {
- for (Fqn f : fqnsToEvict)
- {
- passivate(ctx, f);
- }
- }
+ for (Fqn f : fqnsToEvict) passivate(ctx, f);
}
else
{
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-07-10 10:51:38 UTC (rev 6237)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2008-07-10 11:19:53 UTC (rev 6238)
@@ -101,7 +101,7 @@
{
final Fqn NODE = Fqn.fromString("/test");
final String KEY = "key";
- Object retval = null;
+ Object retval;
cache.removeNode(NODE);// nothing to remove
addDelay();
retval = cache.put(NODE, KEY, 10);// put in memory
@@ -111,13 +111,12 @@
assertEquals(10, retval);// get from memory
cache.evict(NODE, true);// passivate node
addDelay();
- log.debug("______________");
retval = cache.put(NODE, KEY, 30);// activate node then does put in memory
assertFalse(loader.exists(NODE));
assertEquals(20, retval);
}
- public void testPut2Passivation() throws CacheException
+ public void testPut2Passivation() throws Exception
{
final Fqn NODE = Fqn.fromString("/a/b/c");
final String KEY = "key";
@@ -133,23 +132,9 @@
cache.evict(Fqn.fromString("/a/b"), true);// passivate parent node
cache.evict(Fqn.fromString("/a"), true);// passivate parent node
addDelay();
- try
- {
- assertTrue(loader.exists(Fqn.fromString("/a/b/c")));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
+ assertTrue(loader.exists(Fqn.fromString("/a/b/c")));
retval = cache.put(NODE, KEY, 30);// activate node, put in memory new value
- try
- {
- assertFalse(loader.exists(NODE));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
+ assertFalse(loader.exists(NODE));
assertEquals(20, retval);
}
17 years, 5 months
JBoss Cache SVN: r6237 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-10 06:51:38 -0400 (Thu, 10 Jul 2008)
New Revision: 6237
Modified:
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
Log:
added log warning when old configuration file is used
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-07-10 10:48:31 UTC (rev 6236)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-07-10 10:51:38 UTC (rev 6237)
@@ -71,7 +71,7 @@
c = parser.parseFile(configFileName);
} catch (OldFileFormatException e)
{
- //todo mmarkus add an warning
+ log.warn(configFileName + " is an old configuration file; We stronly suggest migrating to the new file format(tools are available for that)");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseFile(configFileName);
}
@@ -159,6 +159,7 @@
c = parser.parseStream(is);
} catch (OldFileFormatException e)
{
+ log.warn("This is an old configuration file; We stronly suggest migrating to the new file format (tools are available for that)");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseStream(is);
}
17 years, 5 months
JBoss Cache SVN: r6236 - core/trunk/src/main/resources.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-10 06:48:31 -0400 (Thu, 10 Jul 2008)
New Revision: 6236
Modified:
core/trunk/src/main/resources/all-elements-file-3.x.xml
Log:
inactiveOnStartup -> regionsInactiveOnStartup
Modified: core/trunk/src/main/resources/all-elements-file-3.x.xml
===================================================================
--- core/trunk/src/main/resources/all-elements-file-3.x.xml 2008-07-10 10:47:50 UTC (rev 6235)
+++ core/trunk/src/main/resources/all-elements-file-3.x.xml 2008-07-10 10:48:31 UTC (rev 6236)
@@ -36,7 +36,7 @@
<!-- todo mmarkus -->
<stateRetrieval timeout="1524" fetchInMemoryState="true"/>
- <startup inactiveOnStartup="true"/>
+ <startup regionsInactiveOnStartup="true"/>
<shutdown hookBehavior="REGISTER"/>
<jmxStatistics enabled="false"/>
17 years, 5 months
JBoss Cache SVN: r6235 - in core/trunk/src: main/resources and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-10 06:47:50 -0400 (Thu, 10 Jul 2008)
New Revision: 6235
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/resources/config-samples/buddy-replication.xml
core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml
core/trunk/src/main/resources/config-samples/optimistically-locked.xml
core/trunk/src/main/resources/config2to3.xslt
core/trunk/src/main/resources/jbosscache-config-3.0.xsd
core/trunk/src/test/resources/configs/parser-test.xml
core/trunk/src/test/resources/configs/string-property-replaced.xml
Log:
inactiveOnStartup -> regionsInactiveOnStartup
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-10 10:47:50 UTC (rev 6235)
@@ -306,7 +306,7 @@
private void configureStartup(Element element)
{
if (element == null) return; //we might not have this configured
- String inactiveOnStartup = getAttributeValue(element, "inactiveOnStartup");
+ String inactiveOnStartup = getAttributeValue(element, "regionsInactiveOnStartup");
if (existsAttribute(inactiveOnStartup)) config.setInactiveOnStartup(getBoolean(inactiveOnStartup));
}
Modified: core/trunk/src/main/resources/config-samples/buddy-replication.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/buddy-replication.xml 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/resources/config-samples/buddy-replication.xml 2008-07-10 10:47:50 UTC (rev 6235)
@@ -5,7 +5,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000" nodeLockingScheme="mvcc"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
<TCP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="true"
Modified: core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml 2008-07-10 10:47:50 UTC (rev 6235)
@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="http://www.jboss.org/jbosscache/jbosscache-config-3.0.xsd">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000" nodeLockingScheme="mvcc"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster" multiplexerStack="fc-fast-minimalthreads">
<jgroupsConfig>
<TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
Modified: core/trunk/src/main/resources/config-samples/optimistically-locked.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/optimistically-locked.xml 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/resources/config-samples/optimistically-locked.xml 2008-07-10 10:47:50 UTC (rev 6235)
@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="http://www.jboss.org/jbosscache/jbosscache-config-3.0.xsd">
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" nodeLockingScheme="optimistic"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup fetchInMemoryState="false"/>
+ <stateRetrieval fetchInMemoryState="false"/>
<eviction wakeUpInterval="1000">
<defaults policyClass="org.jboss.cache.eviction.LRUPolicy"/>
<root>
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/resources/config2to3.xslt 2008-07-10 10:47:50 UTC (rev 6235)
@@ -223,7 +223,7 @@
<xsl:template name="startup">
<xsl:if test="//attribute[@name='InactiveOnStartup']">
<xsl:element name="startup">
- <xsl:attribute name="inactiveOnStartup">
+ <xsl:attribute name="regionsInactiveOnStartup">
<xsl:value-of select="normalize-space(//attribute[@name='InactiveOnStartup'])"/>
</xsl:attribute>
</xsl:element>
Modified: core/trunk/src/main/resources/jbosscache-config-3.0.xsd
===================================================================
--- core/trunk/src/main/resources/jbosscache-config-3.0.xsd 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/main/resources/jbosscache-config-3.0.xsd 2008-07-10 10:47:50 UTC (rev 6235)
@@ -49,7 +49,7 @@
</xs:complexType>
<xs:complexType name="startupType">
- <xs:attribute name="inactiveOnStartup" type="booleanType"/>
+ <xs:attribute name="regionsInactiveOnStartup" type="booleanType"/>
</xs:complexType>
<xs:complexType name="stateRetrievalType">
Modified: core/trunk/src/test/resources/configs/parser-test.xml
===================================================================
--- core/trunk/src/test/resources/configs/parser-test.xml 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/test/resources/configs/parser-test.xml 2008-07-10 10:47:50 UTC (rev 6235)
@@ -30,7 +30,7 @@
</replication>
<stateRetrieval timeout="15124" fetchInMemoryState="true"/>
- <startup inactiveOnStartup="true"/>
+ <startup regionsInactiveOnStartup="true"/>
<shutdown hookBehavior="REGISTER"/>
<transport clusterName="JBossCache-Cluster" multiplexerStack="file_name">
Modified: core/trunk/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/trunk/src/test/resources/configs/string-property-replaced.xml 2008-07-09 17:04:59 UTC (rev 6234)
+++ core/trunk/src/test/resources/configs/string-property-replaced.xml 2008-07-10 10:47:50 UTC (rev 6235)
@@ -6,7 +6,7 @@
<transaction syncCommitPhase="${test.property.SyncCommitPhase:true}" syncRollbackPhase="true"/>
<serialization useRegionBasedMarshalling="true"/>
<stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <startup inactiveOnStartup="true"/>
+ <startup regionsInactiveOnStartup="true"/>
<transport clusterName="optimistic-entity" multiplexerStack="udp-sync">
<jgroupsConfig/>
</transport>
17 years, 5 months
JBoss Cache SVN: r6234 - in core/trunk/src: main/java/org/jboss/cache/config/parsing and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-09 13:04:59 -0400 (Wed, 09 Jul 2008)
New Revision: 6234
Modified:
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
core/trunk/src/main/resources/all-elements-file-3.x.xml
core/trunk/src/main/resources/config2to3.xslt
core/trunk/src/main/resources/jbosscache-config-3.0.xsd
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java
core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/BuddyElementParserTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
core/trunk/src/test/resources/configs/buddy-replication-cache.xml
core/trunk/src/test/resources/configs/clonable-config.xml
core/trunk/src/test/resources/configs/local-lru-eviction.xml
core/trunk/src/test/resources/configs/local-passivation.xml
core/trunk/src/test/resources/configs/local-tx.xml
core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
core/trunk/src/test/resources/configs/mux.xml
core/trunk/src/test/resources/configs/parser-test.xml
core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
core/trunk/src/test/resources/configs/replSync.xml
core/trunk/src/test/resources/configs/string-property-replaced.xml
core/trunk/src/test/resources/unit-test-cache-service.xml
Log:
added stateRetreival element and fixed tests
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -71,6 +71,7 @@
c = parser.parseFile(configFileName);
} catch (OldFileFormatException e)
{
+ //todo mmarkus add an warning
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseFile(configFileName);
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -48,7 +48,7 @@
* By default this class uses a validating parser (configurable).
* <p/>
* In order to make the parser non-validating by default, the follwing system property is expected:
- * <b>-Djbc.config.validation=false</b>
+ * <b>-Djbosscache.config.validate=false</b>
* <p/>
* Implementation note: this class is stateful and one instance should be used for parsing a single configuration file.
*
@@ -59,7 +59,7 @@
{
private static final Log log = LogFactory.getLog(XmlConfigurationParser.class);
- public static final String VALIDATING_SYSTEM_PROPERTY = "jbc.config.validation";
+ public static final String VALIDATING_SYSTEM_PROPERTY = "jbosscache.config.validate";
/**
* the resulting configuration.
@@ -72,9 +72,9 @@
{
isValidating = true;
String validatingStr = System.getProperty(VALIDATING_SYSTEM_PROPERTY);
- if ("false".equalsIgnoreCase(validatingStr))
+ if (validatingStr != null)
{
- isValidating = false;
+ isValidating = Boolean.getBoolean(VALIDATING_SYSTEM_PROPERTY);
}
}
@@ -165,6 +165,7 @@
configureSerialization(getSingleElement("serialization"));
configureInvalidation(getSingleElement("invalidation"));
configureStartup(getSingleElement("startup"));
+ configureStateRetrieval(getSingleElement("stateRetrieval"));
configureTransport(getSingleElement("transport"));
configureShutdown(getSingleElement("shutdown"));
configureJmxStatistics(getSingleElement("jmxStatistics"));
@@ -178,6 +179,16 @@
return config;
}
+ private void configureStateRetrieval(Element element)
+ {
+ if (element == null) return; //we might not have this configured
+ String fetchInMemoryState = getAttributeValue(element, "fetchInMemoryState");
+ if (existsAttribute(fetchInMemoryState)) config.setFetchInMemoryState(getBoolean(fetchInMemoryState));
+ String stateRetrievalTimeout = getAttributeValue(element, "timeout");
+ if (existsAttribute(stateRetrievalTimeout)) config.setStateRetrievalTimeout(getLong(stateRetrievalTimeout));
+
+ }
+
private void configureTransaction(Element element)
{
if (element == null) return;
@@ -295,10 +306,6 @@
private void configureStartup(Element element)
{
if (element == null) return; //we might not have this configured
- String fetchInMemoryState = getAttributeValue(element, "fetchInMemoryState");
- if (existsAttribute(fetchInMemoryState)) config.setFetchInMemoryState(getBoolean(fetchInMemoryState));
- String stateRetrievalTimeout = getAttributeValue(element, "stateRetrievalTimeout");
- if (existsAttribute(stateRetrievalTimeout)) config.setStateRetrievalTimeout(getLong(stateRetrievalTimeout));
String inactiveOnStartup = getAttributeValue(element, "inactiveOnStartup");
if (existsAttribute(inactiveOnStartup)) config.setInactiveOnStartup(getBoolean(inactiveOnStartup));
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -148,7 +148,7 @@
if (timeToLive < 0)
{
throw new ConfigurationException("timeToLive must be " +
- "configured to a value greater than or equal to 0");
+ "configured to a value greater than or equal to 0 for " + getEvictionPolicyClass());
}
}
Modified: core/trunk/src/main/resources/all-elements-file-3.x.xml
===================================================================
--- core/trunk/src/main/resources/all-elements-file-3.x.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/resources/all-elements-file-3.x.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -13,6 +13,7 @@
<serialization objectInputStreamPoolSize="10" objectOutputStreamPoolSize="20" version="5.1.0"
marshallerClass="some.Clazz" useLazyDeserialization="true" useRegionBasedMarshalling="false"/>
+ <!-- local mode is achieved by not specifying replication or invalidation -->
<!-- either replication or invalidation tags will be present, not both -->
<replication>
<sync replTimeout="15421"/>
@@ -33,7 +34,9 @@
<sync replTimeout="15421"/>
</invalidation>
- <startup fetchInMemoryState="true" stateRetrievalTimeout="1524" inactiveOnStartup="true"/>
+ <!-- todo mmarkus -->
+ <stateRetrieval timeout="1524" fetchInMemoryState="true"/>
+ <startup inactiveOnStartup="true"/>
<shutdown hookBehavior="REGISTER"/>
<jmxStatistics enabled="false"/>
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/resources/config2to3.xslt 2008-07-09 17:04:59 UTC (rev 6234)
@@ -9,6 +9,7 @@
<xsl:call-template name="transaction"/>
<xsl:call-template name="serialization"/>
<xsl:call-template name="startup"/>
+ <xsl:call-template name="stateRetrieval"/>
<xsl:call-template name="transport"/>
<xsl:apply-templates select="//attribute"/>
</xsl:element>
@@ -220,24 +221,29 @@
</xsl:template>
<xsl:template name="startup">
+ <xsl:if test="//attribute[@name='InactiveOnStartup']">
+ <xsl:element name="startup">
+ <xsl:attribute name="inactiveOnStartup">
+ <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'] | //attribute[@name='InactiveOnStartup']">
- <xsl:element name="startup">
+ 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="stateRetrievalTimeout">
+ <xsl:attribute name="timeout">
<xsl:value-of select="normalize-space(//attribute[@name='StateRetrievalTimeout'])"/>
</xsl:attribute>
</xsl:if>
- <xsl:if test="//attribute[@name='InactiveOnStartup']">
- <xsl:attribute name="inactiveOnStartup">
- <xsl:value-of select="normalize-space(//attribute[@name='InactiveOnStartup'])"/>
- </xsl:attribute>
- </xsl:if>
</xsl:element>
</xsl:if>
</xsl:template>
@@ -262,7 +268,8 @@
<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:value-of
+ select="concat(normalize-space(./config/attribute[@name='wakeUpIntervalSeconds']), '000')"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="./config/attribute[@name='policyClass'] | ./config/attribute[@name='policyClass']">
@@ -283,7 +290,8 @@
<root>
<xsl:if test="./config/region[@name='/_default_' and string-length(@policyClass) > 0]">
<xsl:attribute name="policyClass">
- <xsl:value-of select="./config/region[@name='/_default_' and string-length(@policyClass) > 0]/@policyClass"/>
+ <xsl:value-of
+ select="./config/region[@name='/_default_' and string-length(@policyClass) > 0]/@policyClass"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="./config/region[@name='/_default_']/*"/>
Modified: core/trunk/src/main/resources/jbosscache-config-3.0.xsd
===================================================================
--- core/trunk/src/main/resources/jbosscache-config-3.0.xsd 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/main/resources/jbosscache-config-3.0.xsd 2008-07-09 17:04:59 UTC (rev 6234)
@@ -7,6 +7,7 @@
<xs:element name="locking" type="lockingType" minOccurs="0"/>
<xs:element name="transaction" type="transactionType" minOccurs="0"/>
<xs:element name="startup" type="startupType" minOccurs="0"/>
+ <xs:element name="stateRetrieval" type="stateRetrievalType" minOccurs="0"/>
<xs:element name="shutdown" type="shutdownType" minOccurs="0"/>
<xs:element name="serialization" type="serializationType" minOccurs="0"/>
<xs:element name="replication" type="replicationType" minOccurs="0"/>
@@ -48,11 +49,14 @@
</xs:complexType>
<xs:complexType name="startupType">
- <xs:attribute name="fetchInMemoryState" type="booleanType"/>
<xs:attribute name="inactiveOnStartup" type="booleanType"/>
- <xs:attribute name="stateRetrievalTimeout" type="positiveInteger"/>
</xs:complexType>
+ <xs:complexType name="stateRetrievalType">
+ <xs:attribute name="fetchInMemoryState" type="booleanType"/>
+ <xs:attribute name="timeout" type="positiveInteger"/>
+ </xs:complexType>
+
<xs:complexType name="shutdownType">
<xs:attribute name="hookBehavior">
<xs:simpleType>
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationCloningTest.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -31,7 +31,7 @@
public class ConfigurationCloningTest
{
/** A file that includes every configuration element I could think of */
- public static final String DEFAULT_CONFIGURATION_FILE = "/configs/clonable-config.xml";
+ public static final String DEFAULT_CONFIGURATION_FILE = "configs/clonable-config.xml";
private static final Log log = LogFactory.getLog(ConfigurationCloningTest.class);
Modified: core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/java/org/jboss/cache/config/ConfigurationTest.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -31,8 +31,6 @@
assertEquals(TransactionSetup.getManagerLookup(), conf.getTransactionManagerLookupClass());
assertEquals(IsolationLevel.REPEATABLE_READ, conf.getIsolationLevel());
assertEquals(false, conf.isUseReplQueue());
- assertEquals(0, conf.getReplQueueInterval());
- assertEquals(0, conf.getReplQueueMaxElements());
assertEquals("JBossCache-Cluster", conf.getClusterName());
assertEquals(true, conf.isFetchInMemoryState());
assertEquals(15000, conf.getStateRetrievalTimeout());
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/BuddyElementParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/BuddyElementParserTest.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/BuddyElementParserTest.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -42,12 +42,12 @@
public void testDefaultParamsForNextMemberBuddyLocator() throws Exception
{
String xmlConfig =
- " <buddyReplication enabled=\"true\" buddyPoolName=\"groupOne\">\n" +
- " <buddyLocator>\n" +
+ " <buddyReplication enabled=\"true\" poolName=\"groupOne\">\n" +
+ " <locator>\n" +
" <properties>\n" +
" numBuddies = 3\n" +
" </properties>\n" +
- " </buddyLocator>\n" +
+ " </locator>\n" +
" </buddyReplication>";
Element element = XmlConfigHelper.stringToElement(xmlConfig);
BuddyReplicationConfig brConfig = parser.parseBuddyElement(element);
@@ -59,12 +59,12 @@
public void testNormalConfig() throws Exception
{
String xmlConfig =
- " <buddyReplication enabled=\"true\" buddyPoolName=\"groupOne\">\n" +
- " <buddyLocator>\n" +
+ " <buddyReplication enabled=\"true\" poolName=\"groupOne\">\n" +
+ " <locator>\n" +
" <properties>\n" +
" numBuddies = 3\n" +
" </properties>\n" +
- " </buddyLocator>\n" +
+ " </locator>\n" +
" </buddyReplication>";
Element element = XmlConfigHelper.stringToElement(xmlConfig);
BuddyReplicationConfig brConfig = parser.parseBuddyElement(element);
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/EvictionElementParserTest.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -99,18 +99,21 @@
" <defaults policyClass=\"org.jboss.cache.eviction.LRUPolicy\" eventQueueSize=\"4\"/>\n" +
" <root>\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
- " <attribute name=\"timeToLiveSeconds\">1000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000000</attribute>\n" +
" <attribute name=\"maxAge\">15000</attribute>\n" +
" </root>\n" +
" <region name=\"/fifo\">\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000000</attribute>\n" +
" </region>\n" +
" <region name=\"/mru\">\n" +
" <attribute name=\"maxNodes\">10000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000000</attribute>\n" +
" </region>\n" +
" <region name=\"/lfu\">\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
" <attribute name=\"minNodes\">4000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000000</attribute>\n" +
" </region>\n" +
" </eviction>";
EvictionConfig evConfig = getEvictionConfig(xml);
@@ -190,7 +193,7 @@
" <eviction wakeUpInterval=\"5000\">\n" +
" <root>\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
- " <attribute name=\"timeToLiveSeconds\">1000</attribute>\n" +
+ " <attribute name=\"timeToLive\">1000</attribute>\n" +
" </root>\n" +
" <region name=\"/org/jboss/data\" policyClass=\"org.jboss.cache.eviction.LFUPolicy\">\n" +
" <attribute name=\"maxNodes\">5000</attribute>\n" +
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-07-09 17:04:59 UTC (rev 6234)
@@ -24,7 +24,7 @@
@BeforeMethod
public void setUp()
{
- XmlConfigurationParser parser = new XmlConfigurationParser();
+ XmlConfigurationParser parser = new XmlConfigurationParser(false, null);
config = parser.parseFile("configs/parser-test.xml");
}
Modified: core/trunk/src/test/resources/configs/buddy-replication-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/buddy-replication-cache.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/buddy-replication-cache.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="http://www.jboss.org/jbosscache/jbosscache-config-3.0.xsd">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
<TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
Modified: core/trunk/src/test/resources/configs/clonable-config.xml
===================================================================
--- core/trunk/src/test/resources/configs/clonable-config.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/clonable-config.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="http://www.jboss.org/jbosscache/jbosscache-config-3.0.xsd">
<locking isolationLevel="SERIALIZABLE" lockAcquisitionTimeout="1" nodeLockingScheme="optimistic"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup fetchInMemoryState="false" stateRetrievalTimeout="3"/>
+ <stateRetrieval fetchInMemoryState="false" timeout="3"/>
<transport clusterName="CloneCluster" multiplexerStack="udp">
<jgroupsConfig>
<UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
Modified: core/trunk/src/test/resources/configs/local-lru-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-lru-eviction.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/local-lru-eviction.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,7 +4,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster"/>
<eviction wakeUpInterval="5000">
<defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
Modified: core/trunk/src/test/resources/configs/local-passivation.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-passivation.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/local-passivation.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,7 +4,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster"/>
<eviction wakeUpInterval="1000">
<defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
Modified: core/trunk/src/test/resources/configs/local-tx.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-tx.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/local-tx.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -5,7 +5,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="false"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster"/>
<eviction wakeUpInterval="5000">
<defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
Modified: core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,7 +4,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
<UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
Modified: core/trunk/src/test/resources/configs/mux.xml
===================================================================
--- core/trunk/src/test/resources/configs/mux.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/mux.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,6 +4,6 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster" multiplexerStack="tcp"/>
</jbosscache>
Modified: core/trunk/src/test/resources/configs/parser-test.xml
===================================================================
--- core/trunk/src/test/resources/configs/parser-test.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/parser-test.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -29,7 +29,8 @@
</buddy>
</replication>
- <startup fetchInMemoryState="true" stateRetrievalTimeout="15124" inactiveOnStartup="true"/>
+ <stateRetrieval timeout="15124" fetchInMemoryState="true"/>
+ <startup inactiveOnStartup="true"/>
<shutdown hookBehavior="REGISTER"/>
<transport clusterName="JBossCache-Cluster" multiplexerStack="file_name">
Modified: core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="http://www.jboss.org/jbosscache/jbosscache-config-3.0.xsd">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
- <startup stateRetrievalTimeout="20000"/>
+ <stateRetrieval timeout="20000"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
<UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
Modified: core/trunk/src/test/resources/configs/replSync.xml
===================================================================
--- core/trunk/src/test/resources/configs/replSync.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/replSync.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -4,7 +4,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="true"/>
- <startup fetchInMemoryState="true" stateRetrievalTimeout="15000"/>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
<UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
Modified: core/trunk/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/trunk/src/test/resources/configs/string-property-replaced.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/configs/string-property-replaced.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -5,7 +5,8 @@
nodeLockingScheme="${test.property.NodeLockingScheme:OPTIMISTIC}"/>
<transaction syncCommitPhase="${test.property.SyncCommitPhase:true}" syncRollbackPhase="true"/>
<serialization useRegionBasedMarshalling="true"/>
- <startup fetchInMemoryState="false" stateRetrievalTimeout="20000" inactiveOnStartup="true"/>
+ <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
+ <startup inactiveOnStartup="true"/>
<transport clusterName="optimistic-entity" multiplexerStack="udp-sync">
<jgroupsConfig/>
</transport>
Modified: core/trunk/src/test/resources/unit-test-cache-service.xml
===================================================================
--- core/trunk/src/test/resources/unit-test-cache-service.xml 2008-07-09 12:47:56 UTC (rev 6233)
+++ core/trunk/src/test/resources/unit-test-cache-service.xml 2008-07-09 17:04:59 UTC (rev 6234)
@@ -6,7 +6,7 @@
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="false"/>
- <startup fetchInMemoryState="true" stateRetrievalTimeout="15000"/>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
<transport clusterName="JBossCache-Cluster"/>
<replication>
<sync replTimeout="15000"/>
17 years, 5 months
JBoss Cache SVN: r6233 - in core/trunk/src/main/java/org/jboss/cache: mvcc and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-09 08:47:56 -0400 (Wed, 09 Jul 2008)
New Revision: 6233
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java
core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
Log:
Minor updates and renaming
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -309,7 +309,7 @@
{
// for each of these, swap refs
ReadCommittedNode rcn = (ReadCommittedNode) ctx.lookUpNode(fqnsToUnlock[i]);
- if (rcn != null) rcn.commitUpdate(dataContainer, nodeFactory, ctx); // could be null with read-committed
+ if (rcn != null) rcn.commitUpdate(ctx, dataContainer, nodeFactory); // could be null with read-committed
// and then unlock
if (trace) log.trace("Releasing lock on [" + fqnsToUnlock[i] + "] for thread " + owner);
lockManager.unlock(fqnsToUnlock[i], owner);
@@ -348,7 +348,7 @@
if (commit)
{
// for each of these, swap refs
- rcn.commitUpdate(dataContainer, nodeFactory, ctx);
+ rcn.commitUpdate(ctx, dataContainer, nodeFactory);
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -172,7 +172,7 @@
if (lockForWriting && acquireLock(context, fqn))
{
// create a copy of the underlying node
- n.copyNodeForUpdate(dataContainer, allowWriteSkew, context, nodeFactory);
+ n.markForUpdate(context, dataContainer, nodeFactory, allowWriteSkew);
}
if (trace) log.trace("Retrieving wrapped node " + fqn);
if (n.isDeleted() && createIfAbsent)
@@ -197,7 +197,7 @@
}
n = nodeFactory.createMvccNode(in);
context.putLookedUpNode(fqn, n);
- if (needToCopy) n.copyNodeForUpdate(dataContainer, allowWriteSkew, context, nodeFactory);
+ if (needToCopy) n.markForUpdate(context, dataContainer, nodeFactory, allowWriteSkew);
}
else if (createIfAbsent) // else, do we need to create one?
{
@@ -209,7 +209,7 @@
if (parentLockNeeded && acquireLock(context, parentFqn))
{
ReadCommittedNode parentRCN = (ReadCommittedNode) context.lookUpNode(parentFqn);
- parentRCN.copyNodeForUpdate(dataContainer, allowWriteSkew, context, nodeFactory);
+ parentRCN.markForUpdate(context, dataContainer, nodeFactory, allowWriteSkew);
}
// now to lock and create the node.
@@ -223,7 +223,7 @@
n = nodeFactory.createMvccNode(in);
n.setCreated(true);
context.putLookedUpNode(fqn, n);
- n.copyNodeForUpdate(dataContainer, allowWriteSkew, context, nodeFactory);
+ n.markForUpdate(context, dataContainer, nodeFactory, allowWriteSkew);
}
}
@@ -269,7 +269,7 @@
ReadCommittedNode node = (ReadCommittedNode) ctx.lookUpNode(fqn);
// update child ref on parent to point to child as this is now a copy.
- if (node != null && !(node instanceof NullMarkerNode))
+ if (node != null && !(node.isNullNode()))
{
if (parentLockNeeded && (needToCopyNode || needToCopyParent))
{
@@ -304,7 +304,7 @@
ReadCommittedNode rcn = wrapNodeForWriting(ctx, fqn, true, false, true, false, false);
if (rcn != null)
{
- rcn.copyNodeForUpdate(dataContainer, allowWriteSkew, ctx, nodeFactory);
+ rcn.markForUpdate(ctx, dataContainer, nodeFactory, allowWriteSkew);
ReadCommittedNode parent = (ReadCommittedNode) ctx.lookUpNode(fqn.getParent());
parent.addChildDirect(nodeFactory.createNodeInvocationDelegate((InternalNode) rcn.getDelegationTarget()));
@@ -331,7 +331,7 @@
if (needToCopyNode && node != null && !node.isChanged()) // node could be null if using read-committed
{
- node.copyNodeForUpdate(dataContainer, allowWriteSkew, ctx, nodeFactory);
+ node.markForUpdate(ctx, dataContainer, nodeFactory, allowWriteSkew);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -1,5 +1,6 @@
package org.jboss.cache.mvcc;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -13,11 +14,20 @@
import java.util.Set;
/**
- * // TODO Document this
+ * A node reference that delegates all calls to a different {@link org.jboss.cache.InternalNode}. Simple indirection
+ * is all this class does, allowing other processes to change the delegate.
+ * <p/>
+ * The delegate is a volatile field so the class is thread safe.
+ * <p/>
+ * This is used to wrap all {@link org.jboss.cache.invocation.NodeInvocationDelegate}s in the {@link org.jboss.cache.DataContainer}
+ * when using {@link org.jboss.cache.config.Configuration.NodeLockingScheme#MVCC} and {@link org.jboss.cache.lock.IsolationLevel#READ_COMMITTED}.
+ * <p/>
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @see org.jboss.cache.mvcc.ReadCommittedNode
* @since 3.0
*/
+@ThreadSafe
public class NodeReference implements InternalNode
{
transient volatile InternalNode delegate;
@@ -27,11 +37,19 @@
this.delegate = delegate;
}
+ /**
+ * @return the InternalNode being delegated to.
+ */
public InternalNode getDelegate()
{
return delegate;
}
+ /**
+ * Sets the internal node to delegate to.
+ *
+ * @param delegate node to delegate to.
+ */
public void setDelegate(InternalNode delegate)
{
this.delegate = delegate;
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -6,7 +6,8 @@
import org.jboss.cache.invocation.InvocationContext;
/**
- * A marker node to represent a null node for repeatable read
+ * A marker node to represent a null node for repeatable read, so that a read that returns a null can continue to return
+ * null.
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
* @since 3.0
@@ -18,26 +19,38 @@
super(node);
}
+ /**
+ * @return always returns true
+ */
@Override
public boolean isNullNode()
{
return true;
}
+ /**
+ * @return always returns true so that any get commands, upon getting this node, will ignore the node as though it were removed.
+ */
@Override
public boolean isDeleted()
{
return true;
}
+ /**
+ * @return always returns true so that any get commands, upon getting this node, will ignore the node as though it were invalid.
+ */
@Override
public boolean isValid()
{
return false;
}
+ /**
+ * A no-op.
+ */
@Override
- public void copyNodeForUpdate(DataContainer d, boolean b, InvocationContext ctx, NodeFactory nodeFactory)
+ public void markForUpdate(InvocationContext ctx, DataContainer d, NodeFactory nodeFactory, boolean b)
{
// no op
}
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -12,7 +12,7 @@
import org.jboss.cache.optimistic.DefaultDataVersion;
/**
- * Repeatable read would do a simple delegation to the underlying node.
+ * A node delegate that encapsulates read committed semantics when writes are initiated, committed or rolled back.
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
* @since 3.0
@@ -23,7 +23,6 @@
protected boolean changed;
protected boolean created;
protected boolean deleted;
-// protected Set childrenAdded, childrenRemoved;
public ReadCommittedNode(InternalNode node)
{
@@ -35,7 +34,16 @@
return false;
}
- public void copyNodeForUpdate(DataContainer container, boolean allowWriteSkew, InvocationContext ctx, NodeFactory nodeFactory)
+ /**
+ * Marks a node for updating. Internally, this creates a copy of the delegate and performs any checks necessary to
+ * maintain isolation level.
+ *
+ * @param ctx invocation context
+ * @param container data container
+ * @param nodeFactory node factory for creating new nodes/copies.
+ * @param allowWriteSkew if true, write skews are allowed. Only makes sense with repeatable read.
+ */
+ public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean allowWriteSkew)
{
if (changed) return; // already copied
@@ -47,7 +55,14 @@
node.setVersion(newVersion);
}
- public void commitUpdate(DataContainer container, NodeFactory nf, InvocationContext ctx)
+ /**
+ * Commits any updates made on this node to the underlying data structure, making it visible to all other transactions.
+ *
+ * @param ctx invocation context
+ * @param container data container
+ * @param nodeFactory node factory
+ */
+ public void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory)
{
if (changed)
{
@@ -72,16 +87,16 @@
{
// add newly created nodes to parents.
NodeSPI parent = lookupParent(fqn, ctx, container);
- parent.addChildDirect(nf.createNodeInvocationDelegate(node));
+ parent.addChildDirect(nodeFactory.createNodeInvocationDelegate(node));
}
else if (fqn.isRoot())
{
// set root node reference in data container.
- container.setRoot(nf.createNodeInvocationDelegate(node));
+ container.setRoot(nodeFactory.createNodeInvocationDelegate(node));
}
else
{
- updateNode(container, nf, ctx);
+ updateNode(ctx, container, nodeFactory);
}
changed = false;
@@ -113,11 +128,11 @@
/**
* Updates state changes on the current node in the underlying data structure.
*
+ * @param ctx invocation context
* @param dataContainer data container
* @param nf node factory
- * @param ctx invocation context
*/
- protected void updateNode(DataContainer dataContainer, NodeFactory nf, InvocationContext ctx)
+ protected void updateNode(InvocationContext ctx, DataContainer dataContainer, NodeFactory nf)
{
// swap refs
((NodeReference) backup).setDelegate(((NodeReference) node).getDelegate());
@@ -131,16 +146,17 @@
changed = false;
}
+ /**
+ * @return true if this node has been marked for update, false otherwise.
+ */
public boolean isChanged()
{
return changed;
}
- public void setChanged(boolean changed)
- {
- this.changed = changed;
- }
-
+ /**
+ * @return true if this node has been newly created in the current scope.
+ */
public boolean isCreated()
{
return created;
@@ -151,16 +167,6 @@
this.created = created;
}
- public InternalNode getNode()
- {
- return node;
- }
-
- public InternalNode getBackupNode()
- {
- return backup;
- }
-
// do not propagate deletion flags to the underlying node.
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-09 12:25:00 UTC (rev 6232)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-09 12:47:56 UTC (rev 6233)
@@ -11,7 +11,7 @@
import org.jboss.cache.optimistic.DefaultDataVersion;
/**
- * // TODO Document this
+ * A node delegate that encapsulates repeatable read semantics when writes are initiated, committed or rolled back.
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
* @since 3.0
@@ -24,7 +24,7 @@
}
@Override
- public void copyNodeForUpdate(DataContainer container, boolean allowWriteSkew, InvocationContext ctx, NodeFactory nodeFactory)
+ public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean allowWriteSkew)
{
if (changed) return; // already copied
@@ -54,7 +54,7 @@
}
@Override
- protected void updateNode(DataContainer dataContainer, NodeFactory nf, InvocationContext ctx)
+ protected void updateNode(InvocationContext ctx, DataContainer dataContainer, NodeFactory nf)
{
NodeSPI parent = lookupParent(getFqn(), ctx, dataContainer);
parent.addChildDirect(nf.createNodeInvocationDelegate(node));
17 years, 5 months
JBoss Cache SVN: r6232 - in core/trunk: assembly and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-09 08:25:00 -0400 (Wed, 09 Jul 2008)
New Revision: 6232
Modified:
core/trunk/assembly/all.xml
core/trunk/assembly/bin.xml
core/trunk/pom.xml
Log:
Updated dependencies
Modified: core/trunk/assembly/all.xml
===================================================================
--- core/trunk/assembly/all.xml 2008-07-09 12:01:42 UTC (rev 6231)
+++ core/trunk/assembly/all.xml 2008-07-09 12:25:00 UTC (rev 6232)
@@ -74,11 +74,6 @@
<outputFileNameMapping>${scope}/${artifactId}.${extension}</outputFileNameMapping>
<unpack>false</unpack>
<scope>test</scope>
- <excludes>
- <exclude>apache-xerces:xml-apis</exclude>
- <exclude>apache-httpclient:commons-httpclient</exclude>
- <exclude>apache-slide:webdavlib</exclude>
- </excludes>
</dependencySet>
</dependencySets>
</assembly>
Modified: core/trunk/assembly/bin.xml
===================================================================
--- core/trunk/assembly/bin.xml 2008-07-09 12:01:42 UTC (rev 6231)
+++ core/trunk/assembly/bin.xml 2008-07-09 12:25:00 UTC (rev 6232)
@@ -44,11 +44,6 @@
<outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
<unpack>false</unpack>
<scope>runtime</scope>
- <excludes>
- <exclude>apache-xerces:xml-apis</exclude>
- <exclude>apache-httpclient:commons-httpclient</exclude>
- <exclude>apache-slide:webdavlib</exclude>
- </excludes>
</dependencySet>
</dependencySets>
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2008-07-09 12:01:42 UTC (rev 6231)
+++ core/trunk/pom.xml 2008-07-09 12:25:00 UTC (rev 6232)
@@ -27,7 +27,7 @@
<dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>2.6.2</version>
+ <version>2.6.3.GA</version>
</dependency>
<!-- For the JTA 1.1 API; consuming projects can safely
@@ -47,21 +47,7 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
- <version>2.2.3.GA</version>
- <exclusions>
- <exclusion>
- <groupId>apache-slide</groupId>
- <artifactId>webdavlib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
- </exclusions>
+ <version>2.2.7.GA</version>
</dependency>
<!-- optional dependencies -->
@@ -104,9 +90,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.transaction</groupId>
- <artifactId>jboss-jta</artifactId>
- <version>4.3.0.BETA2</version>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossjta</artifactId>
+ <version>4.3.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
17 years, 5 months
JBoss Cache SVN: r6231 - in core/trunk/src: main/java/org/jboss/cache/util and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-09 08:01:42 -0400 (Wed, 09 Jul 2008)
New Revision: 6231
Added:
core/trunk/src/main/java/org/jboss/cache/util/FileLookup.java
Removed:
core/trunk/src/main/java/org/jboss/cache/config/parsing/FileLookup.java
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
Log:
moved FileLookup from config to util as it might be referenced from here aswell
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -22,8 +22,6 @@
package org.jboss.cache.config.parsing;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
@@ -32,6 +30,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
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-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -23,6 +23,7 @@
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
+import org.jboss.cache.util.FileLookup;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
@@ -46,7 +47,7 @@
/**
* Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
* as <b>is</b>. Transformation is performed according to the <b>xsltFile</b>. The xslt file is looked up using a
- * {@link org.jboss.cache.config.parsing.FileLookup}
+ * {@link org.jboss.cache.util.FileLookup}
*/
public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception
{
@@ -66,7 +67,7 @@
/**
* Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
* as <b>inputFile</b>. Transformation is performed according to the <b>xsltFile</b>. Both <b>inputFile</b> and he xslt
- * file are looked up using a {@link org.jboss.cache.config.parsing.FileLookup}
+ * file are looked up using a {@link org.jboss.cache.util.FileLookup}
*/
public void parse(String inputFile, OutputStream os, String xsltFile) throws Exception
{
Deleted: core/trunk/src/main/java/org/jboss/cache/config/parsing/FileLookup.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/FileLookup.java 2008-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/FileLookup.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.cache.config.parsing;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * Holds the logic of looking up a file, in the following sequence:
- * <ol>
- * <li> try to load it with the curent thread's context ClassLoader</li>
- * <li> if fails, the system ClassLoader</li>
- * <li> if fails, try to load it as a file from the disck </li>
- * </ol>
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 3.0
- */
-public class FileLookup
-{
- private static final Log log = LogFactory.getLog(FileLookup.class);
-
- /**
- * Looks up the file, see : {@link org.jboss.cache.config.parsing.FileLookup}.
- * @param filename might be the name of the file (too look it up in the class path) or an url to a file.
- * @return an input stream to the file or null if nothing found through all lookup steps.
- */
- public InputStream lookupFile(String filename)
- {
- InputStream is = getAsInputStreamFromClassLoader(filename);
- if (is == null)
- {
- if (log.isDebugEnabled())
- log.debug("Unable to find configuration file " + filename + " in classpath; searching for this file on the filesystem instead.");
- try
- {
- is = new FileInputStream(filename);
- }
- catch (FileNotFoundException e)
- {
- return null;
- }
- }
- return is;
- }
-
- protected InputStream getAsInputStreamFromClassLoader(String filename)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream is = cl == null ? null : cl.getResourceAsStream(filename);
- if (is == null)
- {
- // check system class loader
- is = getClass().getClassLoader().getResourceAsStream(filename);
- }
- return is;
- }
-}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -28,6 +28,7 @@
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -107,10 +108,10 @@
/**
* Parses an XML file and returns a new configuration.
- * For looking up the file, {@link org.jboss.cache.config.parsing.FileLookup} is used.
+ * For looking up the file, {@link org.jboss.cache.util.FileLookup} is used.
*
* @throws OldFileFormatException if the file has a 2.x format
- * @see org.jboss.cache.config.parsing.FileLookup
+ * @see org.jboss.cache.util.FileLookup
*/
public Configuration parseFile(String filename)
{
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-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -22,14 +22,13 @@
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.eviction.EvictionPolicy;
import org.jboss.cache.util.Util;
+import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
Copied: core/trunk/src/main/java/org/jboss/cache/util/FileLookup.java (from rev 6225, core/trunk/src/main/java/org/jboss/cache/config/parsing/FileLookup.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/FileLookup.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/util/FileLookup.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+/**
+ * Holds the logic of looking up a file, in the following sequence:
+ * <ol>
+ * <li> try to load it with the curent thread's context ClassLoader</li>
+ * <li> if fails, the system ClassLoader</li>
+ * <li> if fails, try to load it as a file from the disck </li>
+ * </ol>
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 3.0
+ */
+public class FileLookup
+{
+ private static final Log log = LogFactory.getLog(FileLookup.class);
+
+ /**
+ * Looks up the file, see : {@link FileLookup}.
+ * @param filename might be the name of the file (too look it up in the class path) or an url to a file.
+ * @return an input stream to the file or null if nothing found through all lookup steps.
+ */
+ public InputStream lookupFile(String filename)
+ {
+ InputStream is = getAsInputStreamFromClassLoader(filename);
+ if (is == null)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Unable to find configuration file " + filename + " in classpath; searching for this file on the filesystem instead.");
+ try
+ {
+ is = new FileInputStream(filename);
+ }
+ catch (FileNotFoundException e)
+ {
+ return null;
+ }
+ }
+ return is;
+ }
+
+ protected InputStream getAsInputStreamFromClassLoader(String filename)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream is = cl == null ? null : cl.getResourceAsStream(filename);
+ if (is == null)
+ {
+ // check system class loader
+ is = getClass().getClassLoader().getResourceAsStream(filename);
+ }
+ return is;
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-07-09 10:50:13 UTC (rev 6230)
+++ core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2008-07-09 12:01:42 UTC (rev 6231)
@@ -14,7 +14,7 @@
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.XmlConfigurationParser;
-import org.jboss.cache.config.parsing.FileLookup;
+import org.jboss.cache.util.FileLookup;
import org.jboss.cache.eviction.LRUConfiguration;
import org.jboss.cache.transaction.TransactionSetup;
import org.jgroups.conf.XmlConfigurator;
17 years, 5 months
JBoss Cache SVN: r6230 - core/branches/2.2.X.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-09 06:50:13 -0400 (Wed, 09 Jul 2008)
New Revision: 6230
Modified:
core/branches/2.2.X/pom.xml
Log:
Updated JBoss JTA dependency
Modified: core/branches/2.2.X/pom.xml
===================================================================
--- core/branches/2.2.X/pom.xml 2008-07-09 00:40:35 UTC (rev 6229)
+++ core/branches/2.2.X/pom.xml 2008-07-09 10:50:13 UTC (rev 6230)
@@ -104,9 +104,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.transaction</groupId>
- <artifactId>jboss-jta</artifactId>
- <version>4.3.0.BETA2</version>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossjta</artifactId>
+ <version>4.3.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
17 years, 5 months