JBoss Cache SVN: r6842 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-06 07:21:05 -0400 (Mon, 06 Oct 2008)
New Revision: 6842
Modified:
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
Log:
Fixed bug in copying maps
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-06 11:10:07 UTC (rev 6841)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-06 11:21:05 UTC (rev 6842)
@@ -455,7 +455,7 @@
if (data != null)
{
if (this.data == null)
- copyDataMap(data);
+ this.data = copyDataMap(data);
else
if (this.data.size() == 1 && data.size() == 1 && this.data.keySet().iterator().next().equals(data.keySet().iterator().next()))
{
16 years, 2 months
JBoss Cache SVN: r6841 - core/trunk/src/test/java/org/jboss/cache/util/internals.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-06 07:10:07 -0400 (Mon, 06 Oct 2008)
New Revision: 6841
Modified:
core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionController.java
Log:
JBCACHE-1422: Allow thread pools and executors to be injected via the RuntimeConfig
Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionController.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionController.java 2008-10-06 11:04:49 UTC (rev 6840)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/EvictionController.java 2008-10-06 11:10:07 UTC (rev 6841)
@@ -75,7 +75,7 @@
if (restartEvictionTimerTask)
{
- timerTask.init(originalWakeupInterval);
+ timerTask.init(originalWakeupInterval, null);
}
}
@@ -150,7 +150,7 @@
{
throw new RuntimeException(e);
}
- timerTask.init(originalWakeupInterval);
+ timerTask.init(originalWakeupInterval, null);
return s;
}
16 years, 2 months
JBoss Cache SVN: r6840 - in core/trunk/src/main/java/org/jboss/cache: config and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-06 07:04:49 -0400 (Mon, 06 Oct 2008)
New Revision: 6840
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java
core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
Log:
JBCACHE-1422: Allow thread pools and executors to be injected via the RuntimeConfig
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-06 10:45:52 UTC (rev 6839)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-06 11:04:49 UTC (rev 6840)
@@ -138,7 +138,8 @@
setDefaultInactive(configuration.isInactiveOnStartup());
- if (isUsingEvictions()) evictionTimerTask.init(evictionConfig.getWakeupInterval());
+ if (isUsingEvictions())
+ evictionTimerTask.init(evictionConfig.getWakeupInterval(), configuration.getRuntimeConfig().getEvictionTimerThreadFactory());
}
@Stop
@@ -732,7 +733,7 @@
*/
public void startEvictionThread()
{
- evictionTimerTask.init(evictionConfig.getWakeupInterval());
+ evictionTimerTask.init(evictionConfig.getWakeupInterval(), configuration.getRuntimeConfig().getEvictionTimerThreadFactory());
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java 2008-10-06 10:45:52 UTC (rev 6839)
+++ core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java 2008-10-06 11:04:49 UTC (rev 6840)
@@ -26,8 +26,10 @@
import org.jboss.cache.util.Util;
import org.jgroups.Channel;
import org.jgroups.ChannelFactory;
+import org.jgroups.util.ThreadFactory;
import javax.transaction.TransactionManager;
+import java.util.concurrent.ExecutorService;
public class RuntimeConfig extends ConfigurationComponent
{
@@ -41,6 +43,9 @@
private transient ChannelFactory muxChannelFactory;
private transient BuddyGroup buddyGroup;
private RPCManager rpcManager;
+ private transient ThreadFactory evictionTimerThreadFactory;
+ private transient ExecutorService asyncSerializationExecutor;
+ private transient ExecutorService asyncCacheListenerExecutor;
/**
* Resets the runtime to default values.
@@ -141,6 +146,81 @@
this.transactionManager = transactionManager;
}
+ /**
+ * This is only relevant if an eviction timer thread factory has been set using {@link #setEvictionTimerThreadFactory(org.jgroups.util.ThreadFactory)}.
+ * Will return a null if the eviction timer thread factory needs to be created internally.
+ * <p/>
+ *
+ * @return the thread factory used by the eviction timer's scheduled executor.
+ * @since 3.0
+ */
+ public ThreadFactory getEvictionTimerThreadFactory()
+ {
+ return evictionTimerThreadFactory;
+ }
+
+ /**
+ * Sets the eviction timer thread factory to use when creating a scheduled executor. If this is not set, the eviction
+ * timer task will use a default thread factory.
+ *
+ * @param evictionTimerThreadFactory factory to use
+ * @since 3.0
+ */
+ public void setEvictionTimerThreadFactory(ThreadFactory evictionTimerThreadFactory)
+ {
+ this.evictionTimerThreadFactory = evictionTimerThreadFactory;
+ }
+
+ /**
+ * This is only relevant if the async cache replication executor has been set using {@link #setAsyncSerializationExecutor(java.util.concurrent.ExecutorService)}.
+ * If the executor is created internally, this method will return null.
+ * <p/>
+ *
+ * @return the executor used for async replication.
+ * @since 3.0
+ */
+ public ExecutorService getAsyncSerializationExecutor()
+ {
+ return asyncSerializationExecutor;
+ }
+
+ /**
+ * This is used to set the executor to use for async cache replucation, and effectively overrides {@link org.jboss.cache.config.Configuration#setSerializationExecutorPoolSize(int)}
+ * <p/>
+ *
+ * @param asyncSerializationExecutor executor to set
+ * @since 3.0
+ */
+ public void setAsyncSerializationExecutor(ExecutorService asyncSerializationExecutor)
+ {
+ this.asyncSerializationExecutor = asyncSerializationExecutor;
+ }
+
+ /**
+ * This is only relevant if the async cache listener executor has been set using {@link #setAsyncCacheListenerExecutor(java.util.concurrent.ExecutorService)}.
+ * If the executor is created internally, this method will return null.
+ * <p/>
+ *
+ * @return the executor to use for async cache listeners
+ * @since 3.0
+ */
+ public ExecutorService getAsyncCacheListenerExecutor()
+ {
+ return asyncCacheListenerExecutor;
+ }
+
+ /**
+ * This is used to set the executor to use for async cache listeners, and effectively overrides {@link org.jboss.cache.config.Configuration#setListenerAsyncPoolSize(int)}
+ * <p/>
+ *
+ * @param asyncCacheListenerExecutor the executor to use for async cache listeners
+ * @since 3.0
+ */
+ public void setAsyncCacheListenerExecutor(ExecutorService asyncCacheListenerExecutor)
+ {
+ this.asyncCacheListenerExecutor = asyncCacheListenerExecutor;
+ }
+
@Override
public boolean equals(Object obj)
{
@@ -155,7 +235,10 @@
return Util.safeEquals(transactionManager, other.transactionManager)
&& Util.safeEquals(muxChannelFactory, other.muxChannelFactory)
&& Util.safeEquals(rpcManager, other.rpcManager)
- && Util.safeEquals(channel, other.channel);
+ && Util.safeEquals(channel, other.channel)
+ && Util.safeEquals(evictionTimerThreadFactory, other.evictionTimerThreadFactory)
+ && Util.safeEquals(asyncCacheListenerExecutor, other.asyncCacheListenerExecutor)
+ && Util.safeEquals(asyncSerializationExecutor, other.asyncSerializationExecutor);
}
return false;
@@ -169,6 +252,9 @@
result = result * 29 + (muxChannelFactory == null ? 0 : muxChannelFactory.hashCode());
result = result * 29 + (rpcManager == null ? 0 : rpcManager.hashCode());
result = result * 29 + (channel == null ? 0 : channel.hashCode());
+ result = result * 29 + (evictionTimerThreadFactory == null ? 0 : evictionTimerThreadFactory.hashCode());
+ result = result * 29 + (asyncCacheListenerExecutor == null ? 0 : asyncCacheListenerExecutor.hashCode());
+ result = result * 29 + (asyncSerializationExecutor == null ? 0 : asyncSerializationExecutor.hashCode());
return result;
}
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-06 10:45:52 UTC (rev 6839)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/EvictionTimerTask.java 2008-10-06 11:04:49 UTC (rev 6840)
@@ -58,12 +58,12 @@
task = new Task();
}
- public void init(long wakeupInterval)
+ public void init(long wakeupInterval, ThreadFactory evictionThreadFactory)
{
if (log.isTraceEnabled())
log.trace("Creating a new eviction listener with wakeupInterval millis set at " + wakeupInterval);
this.wakeupInterval = wakeupInterval;
- start();
+ start(evictionThreadFactory);
}
/**
@@ -107,7 +107,7 @@
scheduledExecutor = null;
}
- private void start()
+ private void start(ThreadFactory tf)
{
if (wakeupInterval < 1)
{
@@ -115,7 +115,8 @@
log.info("Wakeup Interval set to " + wakeupInterval + ". Not starting an eviction thread!");
return;
}
- scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory()
+
+ if (tf == null) tf = new ThreadFactory()
{
public Thread newThread(Runnable r)
{
@@ -123,7 +124,9 @@
t.setDaemon(true);
return t;
}
- });
+ };
+
+ scheduledExecutor = Executors.newSingleThreadScheduledExecutor(tf);
scheduledExecutor.scheduleWithFixedDelay(task, wakeupInterval, wakeupInterval, TimeUnit.MILLISECONDS);
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-06 10:45:52 UTC (rev 6839)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-06 11:04:49 UTC (rev 6840)
@@ -86,7 +86,9 @@
// what sort of a repl processor do we need?
Configuration c = componentRegistry.getComponent(Configuration.class);
- if (c.getCacheMode().isSynchronous() || c.getSerializationExecutorPoolSize() < 1)
+ replicationProcessor = c.getRuntimeConfig().getAsyncSerializationExecutor();
+ if (c.getCacheMode().isSynchronous() ||
+ (replicationProcessor == null && c.getSerializationExecutorPoolSize() < 1)) // if an executor has not been injected and the pool size is set
{
// in-process thread. Not async.
replicationProcessor = new WithinThreadExecutor();
@@ -95,16 +97,19 @@
else
{
asyncSerial = true;
- replicationProcessorCount = new AtomicInteger(0);
- replicationProcessor = Executors.newFixedThreadPool(c.isUseReplQueue() ? 1 : c.getSerializationExecutorPoolSize(),
- new ThreadFactory()
- {
- public Thread newThread(Runnable r)
+ if (replicationProcessor == null)
+ {
+ replicationProcessorCount = new AtomicInteger(0);
+ replicationProcessor = Executors.newFixedThreadPool(c.isUseReplQueue() ? 1 : c.getSerializationExecutorPoolSize(),
+ new ThreadFactory()
{
- return new Thread(r, "AsyncReplicationProcessor-" + replicationProcessorCount.incrementAndGet());
+ public Thread newThread(Runnable r)
+ {
+ return new Thread(r, "AsyncReplicationProcessor-" + replicationProcessorCount.incrementAndGet());
+ }
}
- }
- );
+ );
+ }
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-06 10:45:52 UTC (rev 6839)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-06 11:04:49 UTC (rev 6840)
@@ -162,21 +162,27 @@
{
useMarshalledValueMaps = config.isUseLazyDeserialization();
syncProcessor = new WithinThreadExecutor();
- if (config.getListenerAsyncPoolSize() > 0)
+
+ // first try and use an injected executor for async listeners
+ if ((asyncProcessor = config.getRuntimeConfig().getAsyncCacheListenerExecutor()) == null)
{
- asyncProcessor = Executors.newFixedThreadPool(config.getListenerAsyncPoolSize(), new ThreadFactory()
+ // create one if needed
+ if (config.getListenerAsyncPoolSize() > 0)
{
- public Thread newThread(Runnable r)
+ asyncProcessor = Executors.newFixedThreadPool(config.getListenerAsyncPoolSize(), new ThreadFactory()
{
- return new Thread(r, "AsyncNotifier-" + asyncNotifierThreadNumber.getAndIncrement());
- }
- });
+ public Thread newThread(Runnable r)
+ {
+ return new Thread(r, "AsyncNotifier-" + asyncNotifierThreadNumber.getAndIncrement());
+ }
+ });
+ }
+ else
+ {
+ // use the same sync executor
+ asyncProcessor = syncProcessor;
+ }
}
- else
- {
- // use the same sync executor
- asyncProcessor = syncProcessor;
- }
}
/**
16 years, 2 months
JBoss Cache SVN: r6839 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-10-06 06:45:52 -0400 (Mon, 06 Oct 2008)
New Revision: 6839
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
Log:
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-06 10:16:34 UTC (rev 6838)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-06 10:45:52 UTC (rev 6839)
@@ -146,11 +146,11 @@
log.info("Gathering replication delay");
String key = "registerReplicationDelay";
List<String> path = Arrays.asList(key);
- cacheWrapper.put(path, key + getNodeIndex(), "value" + getNodeIndex());
Set received = new HashSet();
int clusterSize = configuration.getClusterConfig().getClusterSize();
while (received.size() < clusterSize)
{
+ cacheWrapper.put(path, key + getNodeIndex(), "value" + getNodeIndex());
for (int i = 0; i < clusterSize; i++)
{
Object replicatedValue = cacheWrapper.get(path, key + i);
16 years, 2 months
JBoss Cache SVN: r6838 - in benchmarks/benchmark-fwk/trunk: cache-products/jbosscache-3.0.0/conf and 4 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-10-06 06:16:34 -0400 (Mon, 06 Oct 2008)
New Revision: 6838
Modified:
benchmarks/benchmark-fwk/trunk/build.xml
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
Log:
register replication delay functionality
Modified: benchmarks/benchmark-fwk/trunk/build.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/build.xml 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/build.xml 2008-10-06 10:16:34 UTC (rev 6838)
@@ -77,7 +77,7 @@
</target>
- <target name="compile.module.framework" description="Compile module Framework">
+ <target name="fwk" description="Compile module Framework">
<mkdir dir="${framework.output.dir}"/>
<javac destdir="${framework.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}"
fork="true">
@@ -86,7 +86,7 @@
</javac>
</target>
- <target name="compile.module.ehcache159" depends="compile.module.framework"
+ <target name="compile.module.ehcache159" depends="fwk"
description="Compile module ehcache-1.5.0; production classes">
<mkdir dir="./classes/production/ehcache-1.5.0"/>
<javac destdir="./classes/production/ehcache-1.5.0" debug="${compiler.debug}"
@@ -102,7 +102,7 @@
</javac>
</target>
- <target name="compile.module.coherence331" depends="compile.module.framework"
+ <target name="compile.module.coherence331" depends="fwk"
description="Compile module coherence331; production classes" if="coherence.jars.present">
<mkdir dir="./classes/production/coherence-3.3.1"/>
<javac destdir="./classes/production/coherence-3.3.1" debug="${compiler.debug}"
@@ -117,7 +117,7 @@
</javac>
</target>
- <target name="compile.module.terracotta250" depends="compile.module.framework"
+ <target name="compile.module.terracotta250" depends="fwk"
description="Compile module terracotta-2.5.0; production classes">
<mkdir dir="./classes/production/terracotta-2.5.0"/>
<javac destdir="./classes/production/terracotta-2.5.0" debug="${compiler.debug}"
@@ -131,7 +131,7 @@
</javac>
</target>
- <target name="compile.module.jbosscache140" depends="compile.module.framework"
+ <target name="compile.module.jbosscache140" depends="fwk"
description="Compile module jbosscache-1.4.1; production classes">
<mkdir dir="./classes/production/jbosscache-1.4.1"/>
<javac destdir="./classes/production/jbosscache-1.4.1" debug="${compiler.debug}"
@@ -148,7 +148,7 @@
</javac>
</target>
- <target name="compile.module.jbosscache200" depends="compile.module.framework"
+ <target name="compile.module.jbosscache200" depends="fwk"
description="Compile module jbosscache-2.0.0">
<mkdir dir="./classes/production/jbosscache-2.0.0"/>
<javac destdir="./classes/production/jbosscache-2.0.0" debug="${compiler.debug}"
@@ -162,7 +162,7 @@
</javac>
</target>
- <target name="compile.module.jbosscache210" depends="compile.module.framework"
+ <target name="compile.module.jbosscache210" depends="fwk"
description="Compile module jbosscache-2.1.0cr2; production classes">
<mkdir dir="./classes/production/jbosscache-2.1.0"/>
<javac destdir="./classes/production/jbosscache-2.1.0" debug="${compiler.debug}"
@@ -176,7 +176,7 @@
</javac>
</target>
- <target name="compile.module.jbosscache220" depends="compile.module.framework"
+ <target name="compile.module.jbosscache220" depends="fwk"
description="Compile module jbosscache-2.2.0; production classes">
<mkdir dir="./classes/production/jbosscache-2.2.0"/>
<javac destdir="./classes/production/jbosscache-2.2.0" debug="${compiler.debug}"
@@ -190,7 +190,7 @@
</javac>
</target>
- <target name="compile.module.pojocache220" depends="compile.module.framework"
+ <target name="compile.module.pojocache220" depends="fwk"
description="Compile module pojocache-2.2.0; production classes">
<mkdir dir="./classes/production/pojocache-2.2.0"/>
<javac destdir="./classes/production/pojocache-2.2.0" debug="${compiler.debug}"
@@ -204,7 +204,7 @@
</javac>
</target>
- <target name="compile.module.whirlycache101" depends="compile.module.framework"
+ <target name="compile.module.whirlycache101" depends="fwk"
description="Compile module whirlycache-1.0.1; production classes">
<mkdir dir="./classes/production/whirlycache-1.0.1"/>
<javac destdir="./classes/production/whirlycache-1.0.1" debug="${compiler.debug}"
@@ -217,7 +217,7 @@
</javac>
</target>
- <target name="compile.module.jbosscache300" depends="compile.module.framework"
+ <target name="compile.module.jbosscache300" depends="fwk"
description="Compile module jbosscache-3.0.0">
<mkdir dir="./classes/production/jbosscache-3.0.0"/>
<javac destdir="./classes/production/jbosscache-3.0.0" debug="${compiler.debug}"
@@ -237,10 +237,10 @@
</target>
<target name="all"
- depends="clean, compile.module.framework, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache159, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331"
+ depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache159, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331"
description="build all"/>
- <target name="checkClusterAddresses" depends="compile.module.framework"
+ <target name="checkClusterAddresses" depends="fwk"
description="Check whether the cluster config is a valid one">
<java classname="org.cachebench.ClusterConfigurationCheck" clonevm="true" fork="true">
<classpath>
@@ -250,7 +250,7 @@
</java>
</target>
- <target name="deploy.sf" depends="compile.module.framework" description="builds the smartfrog jar and deploys it">
+ <target name="deploy.sf" depends="fwk" description="builds the smartfrog jar and deploys it">
<rmic classname="org.cachebench.smartfrog.CacheBenchmarkPrim" base="${framework.output.dir}" verify="true"
debug="true">
<classpath refid="framework.module.classpath"/>
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml 2008-10-06 10:16:34 UTC (rev 6838)
@@ -6,14 +6,14 @@
<stateRetrieval timeout="20000" fetchInMemoryState="false"/>
<transport clusterName="JBossCache-Cluster">
<jgroupsConfig>
- <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+ <UDP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="false" ip_ttl="2"
loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
mcast_port="45588" mcast_recv_buf_size="100000000" mcast_send_buf_size="640000"
oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="20"
oob_thread_pool.min_threads="8" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
- thread_pool.keep_alive_time="10000" thread_pool.max_threads="30" thread_pool.min_threads="8"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+ thread_pool.keep_alive_time="10000" thread_pool.max_threads="15" thread_pool.min_threads="8"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="100000" thread_pool.rejection_policy="Discard"
tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
use_incoming_packet_handler="true"/>
<PING num_initial_members="3" timeout="2000"/>
@@ -22,7 +22,7 @@
<FD max_tries="5" shun="true" timeout="10000"/>
<VERIFY_SUSPECT timeout="1500"/>
<pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="false"/>
+ use_mcast_xmit="true"/>
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
<pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
@@ -34,6 +34,6 @@
</jgroupsConfig>
</transport>
<replication>
- <async/>
+ <async useReplQueue="true" replQueueInterval="3000" replQueueMaxElements="30000"/>
</replication>
</jbosscache>
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -57,6 +57,7 @@
{
bindAddr = InetAddress.getByName(bindAddrStr);
}
+ clusterConfig.validateMembers();
log.trace("Bind address is:" + bindAddr + "; startPort is:" + startPort);
nodes = clusterConfig.getMemberAddresses();
connectionTable = new ConnectionTable(nodes);
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -6,6 +6,8 @@
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
/**
* Configuration for this cache instance.
@@ -118,4 +120,14 @@
{
return "{bindAddress:" + bindAddress + ", members:" + getMembers() + ", clusterSize:" + getClusterSize() + "}";
}
+
+ public void validateMembers()
+ {
+ List<InetSocketAddress> addressList = getMemberAddresses();
+ Set addressSet = new HashSet(addressList);
+ if (addressList.size() != addressSet.size())
+ {
+ throw new RuntimeException("There are memebers defined which point to the same host:port. Verify the configuration");
+ }
+ }
}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -36,4 +36,9 @@
{
return Integer.parseInt(configParams.get(name));
}
+
+ public boolean getBooleanValue(String paramName)
+ {
+ return Boolean.valueOf(getParamValue(paramName));
+ }
}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -36,6 +36,11 @@
buf.append(ssResult.getReadCount());
buf.append(",");
buf.append(ssResult.getWriteCount());
+ if (ssResult.registeredReplicationDelays())
+ {
+ buf.append(",");
+ buf.append(ssResult.getReplicationDelayMillis());
+ }
}
else
{
@@ -57,7 +62,7 @@
protected void writeHeaderLine(BufferedWriter writer) throws IOException
{
log.debug("Write the Report Header");
- writer.write("TEST NAME, TEST DATE, REQ PER SEC, BYTES READ, BYTES WRITTEN, DURATION, TOTAL OPERATION COUNT, READ COUNT, WRITE COUNT" );
+ writer.write("TEST NAME, TEST DATE, REQ PER SEC, BYTES READ, BYTES WRITTEN, DURATION, TOTAL OPERATION COUNT, READ COUNT, WRITE COUNT, REPLICATION DELAY" );
writer.newLine();
log.debug("Complted the Report Header");
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -8,14 +8,13 @@
import org.cachebench.config.TestConfig;
import org.cachebench.tests.results.TestResult;
-import java.util.Date;
-import java.util.List;
-import java.util.Random;
+import java.util.*;
/**
* Simulates work with a web session.
+ * <p/>
+ * todo mmarkus - improve the test to support multiple threads. Correlate this with usage of message_bundling in JBC
*
- * todo mmarkus - improve the test to support multiple threads. Correlate this with usage of message_bundling in JBC
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
@@ -30,6 +29,7 @@
private String sessionId;
private CacheWrapper cacheWrapper;
private boolean reportNanos = false;
+ private boolean registerReplicationDelay = false;
/**
@@ -122,21 +122,62 @@
}
}
}
+ long replicationDelay = System.currentTimeMillis();
+ replicationDelay = verifyReplicationDelay(replicationDelay);
long duration = this.reportNanos ? durationNanos : durationNanos / 1000000;
SessionSimulatorTestResult result = new SessionSimulatorTestResult(reads, writes, duration, totalBytesRead, totalBytesWritten);
result.setTestPassed(true);
result.setTestName(testCaseName + getNodeIndex());
result.setTestTime(new Date());
result.setTestType(testName);
+ if (registerReplicationDelay)
+ {
+ result.setReplicationDelayMillis(replicationDelay);
+ }
log.trace("Returning result:" + result);
return result;
}
+ private long verifyReplicationDelay(long replicationDelay)
+ throws Exception
+ {
+ if (registerReplicationDelay)
+ {
+ log.info("Gathering replication delay");
+ String key = "registerReplicationDelay";
+ List<String> path = Arrays.asList(key);
+ cacheWrapper.put(path, key + getNodeIndex(), "value" + getNodeIndex());
+ Set received = new HashSet();
+ int clusterSize = configuration.getClusterConfig().getClusterSize();
+ while (received.size() < clusterSize)
+ {
+ for (int i = 0; i < clusterSize; i++)
+ {
+ Object replicatedValue = cacheWrapper.get(path, key + i);
+ if (log.isTraceEnabled()) log.trace("replication delay value from node " + i + " is " + replicatedValue);
+ if (replicatedValue != null)
+ {
+ received.add(replicatedValue);
+ }
+ }
+ if (received.size() < clusterSize)
+ {
+ //todo mmarkus this brings a delay of 1 sec to the async replication config
+ log.info("Recieved " + received.size() + " replication messages. Sleeping 1 sec before moving on");
+ Thread.sleep(1000);
+ }
+ }
+ replicationDelay = System.currentTimeMillis() - replicationDelay;
+ log.info("Replication delay is " + replicationDelay + " millis.");
+ }
+ return replicationDelay;
+ }
+
private void logRunCount(int i)
{
- if (i % LOG_AFTER_OPERATION_COUNT == 0)
+ if (((i + 1) % LOG_AFTER_OPERATION_COUNT == 0) || (i == 0))
{
- log.info("SessionSimulatorTest performed " + i + " operations");
+ log.info("SessionSimulatorTest performed " + (i == 0 ? 0 : (i+1)) + " operations");
}
}
@@ -170,8 +211,12 @@
sizeOfAnAttribute = thisTestConfig.getIntValue("sizeOfAnAttribute");
if (thisTestConfig.existsParam("reportNanos"))
{
- this.reportNanos = Boolean.valueOf(thisTestConfig.getParamValue("reportNanos"));
+ this.reportNanos = thisTestConfig.getBooleanValue("reportNanos");
}
+ if (thisTestConfig.existsParam("registerReplicationDelay"))
+ {
+ this.registerReplicationDelay = thisTestConfig.getBooleanValue("registerReplicationDelay");
+ }
log.debug("recieved follosing params[ numberOfRequests=" + numberOfRequests + ", numberOfAttributes="
+ numberOfAttributes + ", writePercentage=" + writePercentage + ", sizeOfAnAttribute=" + sizeOfAnAttribute + " ]");
}
@@ -180,4 +225,5 @@
{
return configuration.isLocalOnly() ? "0" : configuration.getClusterConfig().getCurrentNodeIndex() + "";
}
+
}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java 2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java 2008-10-06 10:16:34 UTC (rev 6838)
@@ -16,7 +16,9 @@
long bytesRead;
long bytesWritten;
+ long replicationDelayMillis = -1;
+
public SessionSimulatorTestResult(long readCount, long writeCount, long durration, long bytesRead, long bytesWritten)
{
this.readCount = readCount;
@@ -65,4 +67,19 @@
{
return CsvSessionSimlatorReportGenerator.class.getName();
}
+
+ public long getReplicationDelayMillis()
+ {
+ return replicationDelayMillis;
+ }
+
+ public void setReplicationDelayMillis(long replicationDelayMillis)
+ {
+ this.replicationDelayMillis = replicationDelayMillis;
+ }
+
+ public boolean registeredReplicationDelays()
+ {
+ return replicationDelayMillis != -1;
+ }
}
16 years, 2 months
JBoss Cache SVN: r6837 - in core/trunk/src/main/java/org/jboss/cache: util/concurrent/locks and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-03 12:38:10 -0400 (Fri, 03 Oct 2008)
New Revision: 6837
Modified:
core/trunk/src/main/java/org/jboss/cache/lock/StripedLock.java
core/trunk/src/main/java/org/jboss/cache/util/concurrent/locks/LockContainer.java
Log:
Better bit spreader
Modified: core/trunk/src/main/java/org/jboss/cache/lock/StripedLock.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-10-03 15:47:22 UTC (rev 6836)
+++ core/trunk/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-10-03 16:38:10 UTC (rev 6837)
@@ -138,12 +138,9 @@
*/
final int hash(Object x)
{
- int h = x.toString().hashCode();
- h += ~(h << 9);
- h ^= (h >>> 14);
- h += (h << 4);
- h ^= (h >>> 10);
- return h;
+ int h = x.hashCode();
+ h ^= (h >>> 20) ^ (h >>> 12);
+ return h ^ (h >>> 7) ^ (h >>> 4);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/util/concurrent/locks/LockContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/concurrent/locks/LockContainer.java 2008-10-03 15:47:22 UTC (rev 6836)
+++ core/trunk/src/main/java/org/jboss/cache/util/concurrent/locks/LockContainer.java 2008-10-03 16:38:10 UTC (rev 6837)
@@ -68,11 +68,8 @@
final int hash(E object)
{
int h = object.hashCode();
- h += ~(h << 9);
- h ^= (h >>> 14);
- h += (h << 4);
- h ^= (h >>> 10);
- return h;
+ h ^= (h >>> 20) ^ (h >>> 12);
+ return h ^ (h >>> 7) ^ (h >>> 4);
}
protected abstract void initLocks(int numLocks);
16 years, 2 months
JBoss Cache SVN: r6836 - core/trunk/src/main/java/org/jboss/cache/util/concurrent.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-03 11:47:22 -0400 (Fri, 03 Oct 2008)
New Revision: 6836
Modified:
core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java
Log:
Smaller default child map
Modified: core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java 2008-10-03 15:12:19 UTC (rev 6835)
+++ core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java 2008-10-03 15:47:22 UTC (rev 6836)
@@ -49,7 +49,7 @@
private synchronized void init()
{
// Reminiscent of DCL but the delegate here is volatile so construction reordering should not affect.
- if (delegate == null) delegate = new ConcurrentHashMap<K, V>(4, 0.75f, 4);
+ if (delegate == null) delegate = new ConcurrentHashMap<K, V>(1, 0.75f, 4);
}
// -------------- Public API methods that will trigger initialization ----------------------
16 years, 2 months
JBoss Cache SVN: r6835 - in core/trunk/src/main/java/org/jboss/cache: util and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-03 11:12:19 -0400 (Fri, 03 Oct 2008)
New Revision: 6835
Modified:
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/util/FastCopyHashMap.java
Log:
JBCACHE-1082: Optimise nodes for single elements
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-03 13:27:23 UTC (rev 6834)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-03 15:12:19 UTC (rev 6835)
@@ -33,6 +33,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -49,13 +50,13 @@
/**
* Debug log.
*/
- static Log log = LogFactory.getLog(UnversionedNode.class);
+ protected static Log log = LogFactory.getLog(UnversionedNode.class);
protected static final boolean trace = log.isTraceEnabled();
/**
* Map of general data keys to values.
*/
- protected FastCopyHashMap<K, V> data;
+ protected Map<K, V> data;
protected NodeSPI<K, V> delegate;
protected CacheSPI<K, V> cache;
@@ -137,10 +138,10 @@
}
// does not need to be synchronized since this will only be accessed by a single thread in MVCC thanks to the write lock.
- private void initDataMap()
- {
- if (data == null) data = new FastCopyHashMap<K, V>();
- }
+// private void initDataMap()
+// {
+// if (data == null) data = new FastCopyHashMap<K, V>();
+// }
public CacheSPI<K, V> getCache()
{
@@ -170,7 +171,19 @@
public V put(K key, V value)
{
- if (data == null) initDataMap();
+ if (data == null)
+ {
+ // new singleton map!
+ data = Collections.singletonMap(key, value);
+ return null;
+ }
+ if (data.size() == 1 && data.containsKey(key))
+ {
+ V oldVal = data.get(key);
+ data = Collections.singletonMap(key, value);
+ return oldVal;
+ }
+ upgradeDataMap();
return data.put(key, value);
}
@@ -280,7 +293,19 @@
public V remove(K key)
{
if (data == null) return null;
- return data.remove(key);
+ V value;
+ if (data instanceof FastCopyHashMap)
+ {
+ value = data.remove(key);
+ downgradeDataMapIfNeeded();
+ }
+ else
+ {
+ // singleton maps cannot remove!
+ value = data.get(key);
+ data = null;
+ }
+ return value;
}
public void printDetails(StringBuilder sb, int indent)
@@ -388,7 +413,8 @@
public void clear()
{
- if (data != null) data.clear();
+ data = null;
+// if (data != null) data.clear();
}
@SuppressWarnings("unchecked")
@@ -428,11 +454,38 @@
{
if (data != null)
{
- if (this.data == null) initDataMap();
- this.data.putAll(data);
+ if (this.data == null)
+ copyDataMap(data);
+ else
+ if (this.data.size() == 1 && data.size() == 1 && this.data.keySet().iterator().next().equals(data.keySet().iterator().next()))
+ {
+ // replace key!
+ Entry<? extends K, ? extends V> e = data.entrySet().iterator().next();
+ this.data = Collections.singletonMap(e.getKey(), e.getValue());
+ }
+ else
+ {
+ // size. Do we need to update the existing data map to a FCHM?
+ upgradeDataMap();
+ this.data.putAll(data);
+ }
}
}
+ protected final void upgradeDataMap()
+ {
+ if (data != null && !(data instanceof FastCopyHashMap)) data = new FastCopyHashMap<K, V>(data);
+ }
+
+ protected final void downgradeDataMapIfNeeded()
+ {
+ if (data.size() == 1 && data instanceof FastCopyHashMap)
+ {
+ Entry<K, V> e = data.entrySet().iterator().next();
+ data = Collections.singletonMap(e.getKey(), e.getValue());
+ }
+ }
+
public void removeChildren()
{
children.clear();
@@ -556,7 +609,7 @@
public InternalNode<K, V> copy()
{
UnversionedNode<K, V> n = new UnversionedNode<K, V>(fqn, cache, isFlagSet(LOCK_FOR_CHILD_INSERT_REMOVE));
- if (data != null) n.data = (FastCopyHashMap<K, V>) data.clone();
+ n.data = copyDataMap(data);
copyInternals(n);
return n;
}
@@ -573,7 +626,7 @@
{
if (data == null)
{
- data = state == null ? new FastCopyHashMap<K, V>() : new FastCopyHashMap<K, V>(state);
+ data = copyDataMap(state);
}
else
{
@@ -582,6 +635,29 @@
}
}
+ protected final Map copyDataMap(Map<? extends K, ? extends V> toCopyFrom)
+ {
+ if (toCopyFrom != null && toCopyFrom.size() > 0)
+ {
+ Map map;
+ if (toCopyFrom instanceof FastCopyHashMap)
+ {
+ map = (FastCopyHashMap<K, V>) ((FastCopyHashMap<K, V>) toCopyFrom).clone();
+ }
+ else if (toCopyFrom.size() == 1)
+ {
+ Entry<? extends K, ? extends V> e = toCopyFrom.entrySet().iterator().next();
+ map = Collections.singletonMap(e.getKey(), e.getValue());
+ }
+ else
+ {
+ map = new FastCopyHashMap<K, V>(toCopyFrom);
+ }
+ return map;
+ }
+ return null;
+ }
+
public Map getInternalState(boolean onlyInternalState)
{
if (onlyInternalState)
Modified: core/trunk/src/main/java/org/jboss/cache/util/FastCopyHashMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/FastCopyHashMap.java 2008-10-03 13:27:23 UTC (rev 6834)
+++ core/trunk/src/main/java/org/jboss/cache/util/FastCopyHashMap.java 2008-10-03 15:12:19 UTC (rev 6835)
@@ -53,7 +53,7 @@
/**
* Same default as HashMap, must be a power of 2
*/
- private static final int DEFAULT_CAPACITY = 16;
+ private static final int DEFAULT_CAPACITY = 8;
/**
* MAX_INT - 1
16 years, 2 months
JBoss Cache SVN: r6834 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-10-03 09:27:23 -0400 (Fri, 03 Oct 2008)
New Revision: 6834
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
Log:
Fixed broken interceptors.
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-10-03 13:24:45 UTC (rev 6833)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-10-03 13:27:23 UTC (rev 6834)
@@ -25,6 +25,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.mvcc.MVCCNodeHelper;
+import org.jboss.cache.mvcc.ReadCommittedNode;
/**
* MVCC specific version of the LegacyDataGravitatorInterceptor
@@ -45,7 +46,8 @@
@Override
protected boolean nodeDoesNotExist(InvocationContext ctx, Fqn fqn)
{
- return ctx.lookUpNode(fqn) == null;
+ ReadCommittedNode node = (ReadCommittedNode) ctx.lookUpNode(fqn);
+ return node == null || node.isNullNode();
}
16 years, 2 months