JBoss Cache SVN: r5288 - in pojo/trunk: src/test/resources and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2008-02-04 22:58:08 -0500 (Mon, 04 Feb 2008)
New Revision: 5288
Added:
pojo/trunk/src/test/resources/META-INF/
pojo/trunk/src/test/resources/META-INF/local-service.xml
pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service.xml
pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service2.xml
pojo/trunk/src/test/resources/META-INF/unit-test-cache-service.xml
pojo/trunk/src/test/resources/log4j.xml
Modified:
pojo/trunk/pom.xml
Log:
Fix dependencies
Copy test configs that were excluded from jbosscache-test.jar
Modified: pojo/trunk/pom.xml
===================================================================
--- pojo/trunk/pom.xml 2008-02-02 14:41:13 UTC (rev 5287)
+++ pojo/trunk/pom.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -37,6 +37,17 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ <version>1.0</version>
+ <optional>true</optional>
+ </dependency>
</dependencies>
<build>
<plugins>
Added: pojo/trunk/src/test/resources/META-INF/local-service.xml
===================================================================
--- pojo/trunk/src/test/resources/META-INF/local-service.xml (rev 0)
+++ pojo/trunk/src/test/resources/META-INF/local-service.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+
+ <!-- Configure the TransactionManager -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ </mbean>
+</server>
Added: pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service.xml
===================================================================
--- pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service.xml (rev 0)
+++ pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties.
+ ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+ -->
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="false"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </attribute>
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <!--
+ PojoCache passivation only allows configuration of global region. If you need to
+ configure multiple regions, you can turn on the marshalling region such that
+ internal JBoss region is stored under the individual region.
+ -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <!-- Cache Loader configuration block -->
+ <attribute name="CacheLoaderConfig">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>true</passivation>
+ <preload>/</preload>
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <!-- same as the old CacheLoaderConfig attribute
+ location=/tmp this can be part of the properties.
+ location=/tmp/JBossCacheFileCacheLoader
+ -->
+ <properties>
+ location=pojoloader
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>true</fetchPersistentState>
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+ </cacheloader>
+
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+</server>
Added: pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service2.xml
===================================================================
--- pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service2.xml (rev 0)
+++ pojo/trunk/src/test/resources/META-INF/pojocache-passivation-service2.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+This configuration is dependent on the JGroups multiplexer being
+registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!-- JGroups protocol stack properties.
+ ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
+ -->
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="false"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </attribute>
+
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <!--
+ PojoCache passivation only allows configuration of global region. If you need to
+ configure multiple regions, you can turn on the marshalling region such that
+ internal JBoss region is stored under the individual region.
+ -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">200000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <!-- Cache Loader configuration block -->
+ <attribute name="CacheLoaderConfig">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>true</passivation>
+ <preload>/</preload>
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <!-- same as the old CacheLoaderConfig attribute
+ location=/tmp this can be part of the properties.
+ location=/tmp/JBossCacheFileCacheLoader
+ -->
+ <properties>
+ location=pojoloader2
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>true</fetchPersistentState>
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+ </cacheloader>
+
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+</server>
Added: pojo/trunk/src/test/resources/META-INF/unit-test-cache-service.xml
===================================================================
--- pojo/trunk/src/test/resources/META-INF/unit-test-cache-service.xml (rev 0)
+++ pojo/trunk/src/test/resources/META-INF/unit-test-cache-service.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -0,0 +1,437 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- This file is not a valid JBoss Cache configuration file !!! -->
+<!-- -->
+<!-- It is used only in unit tests. DO NOT use it for any other purpose! -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+ <!--
+ Isolation level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!--
+ Just used for async repl: use a replication queue
+ -->
+ <attribute name="UseReplQueue">false</attribute>
+
+ <!--
+ Replication interval for replication queue (in ms)
+ -->
+ <attribute name="ReplQueueInterval">0</attribute>
+
+ <!--
+ Max number of elements which trigger replication
+ -->
+ <attribute name="ReplQueueMaxElements">0</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+
+ <!--Uncomment next three statements to enable JGroups multiplexer.
+ This configuration is dependent on the JGroups multiplexer being
+ registered in an MBean server such as JBossAS. -->
+ <!--
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+ -->
+
+ <!--
+ Whether or not to fetch state on joining a cluster
+ NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+ -->
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">15000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">2</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/data">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">5</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <!-- New 1.3.x cache loader config block -->
+ <attribute name="CacheLoaderConfiguration">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>true</passivation>
+ <preload>/</preload>
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <!-- same as the old CacheLoaderConfig attribute
+ location=/tmp this can be part of the properties.
+ -->
+ <properties>
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>true</fetchPersistentState>
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+ </cacheloader>
+
+ </config>
+ </attribute>
+
+ <!--
+ Indicate whether to use region based marshalling or not. Set this to true if you are running under a scoped
+ class loader, e.g., inside an application server. Default is "false".
+ -->
+ <attribute name="UseRegionBasedMarshalling">false</attribute>
+ </mbean>
+
+ <protocol_stacks>
+
+ <stack name="udp"
+ description="Default: IP multicast based stack, with flow control and message bundling">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="true"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="2" shun="true"/>
+ <VERIFY_SUSPECT timeout="250"/>
+ <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
+ <!--<FD timeout="10000" max_tries="5" shun="true"/>-->
+ <!--<VERIFY_SUSPECT timeout="1500"/>-->
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="1000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="1000"/>
+ <FC max_credits="20000000" min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+ <stack name="udp-sync"
+ description="IP multicast based stack, without flow control and without message bundling. This should be used
+ instead of udp if (1) synchronous calls are used and (2) the message volume (rate and size)
+ is not that large. Don't use this configuration if you send messages at a high sustained rate, or you might
+ run out of memory">
+ <config>
+ <UDP mcast_addr="228.10.10.10"
+ mcast_port="45588"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="2"
+ enable_bundling="true"
+ enable_diagnostics="true"
+
+ use_concurrent_stack="true"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="30000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="Run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="4"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="2" shun="true"/>
+ <VERIFY_SUSPECT timeout="250"/>
+ <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
+ <!--<FD timeout="10000" max_tries="5" shun="true"/>-->
+ <!--<VERIFY_SUSPECT timeout="1500"/>-->
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,900,1200"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,900,1200"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="1000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="1000"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+
+ <stack name="tcp"
+ description="TCP based stack, with flow control and message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
+ Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
+ -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]">
+ <config>
+ <TCP start_port="7800"
+ loopback="true"
+ recv_buf_size="20000000"
+ send_buf_size="640000"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ use_send_queues="false"
+ sock_conn_timeout="300"
+ skip_suspected_members="true"
+
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="100000"
+ min_interval="20000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <BARRIER/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <VIEW_SYNC avg_send_interval="60000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="true"
+ view_bundling="true"/>
+ <FC max_credits="2000000"
+ min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+
+
+ <stack name="tcp-sync"
+ description="TCP based stack, without flow control and without message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast). This
+ configuration should be used instead of tcp when (1) synchronous calls are used and (2) the message volume
+ (rate and size) is not that large">
+ <config>
+ <TCP start_port="7800"
+ loopback="true"
+ recv_buf_size="20000000"
+ send_buf_size="640000"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ enable_bundling="true"
+ use_send_queues="false"
+ sock_conn_timeout="300"
+ skip_suspected_members="true"
+
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="25"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="100000"
+ min_interval="20000"/>
+ <FD_SOCK/>
+ <!--
+ Note that this is an atypically short timeout and a small number of retries
+ configured this way to speed up unit testing, since we know all nodes run in the same JVM
+ and hence failure detections will be very quick.
+ -->
+ <FD timeout="1000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <BARRIER/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="400000"/>
+ <VIEW_SYNC avg_send_interval="60000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="true"
+ view_bundling="true"/>
+ <FC max_credits="2000000"
+ min_threshold="0.10"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <!-- <pbcast.STATE_TRANSFER/> -->
+ <pbcast.FLUSH timeout="0"/>
+ </config>
+ </stack>
+ </protocol_stacks>
+
+</server>
Added: pojo/trunk/src/test/resources/log4j.xml
===================================================================
--- pojo/trunk/src/test/resources/log4j.xml (rev 0)
+++ pojo/trunk/src/test/resources/log4j.xml 2008-02-05 03:58:08 UTC (rev 5288)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 5286 2008-02-01 12:13:53Z mircea.markus $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="output/jbosscache.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+ <param name="Threshold" value="DEBUG"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="TRACE"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c{1}] (%t) %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss.cache">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jboss.tm">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--<appender-ref ref="CONSOLE"/>-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
16 years, 10 months
JBoss Cache SVN: r5287 - 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-02-02 09:41:13 -0500 (Sat, 02 Feb 2008)
New Revision: 5287
Modified:
core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
Improved marshaller performance by removing reference counting (now optional)
Modified: core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2008-02-02 14:41:13 UTC (rev 5287)
@@ -706,6 +706,37 @@
</entry>
</row>
+ <row>
+ <entry>
+ <para>UseReferenceCounting</para>
+ </entry>
+
+ <entry>
+ <para>
+ An optional parameter that is used to control how identical objects are marshalled. If reference
+ counting is disabled, they are marshalled again and added to the stream. If reference counting
+ is enabled,
+ they are written once and a reference is written in subsequent instances.
+ </para>
+ <para>
+ By default this is set to<literal>false</literal>. Set this to
+ <literal>true</literal>
+ if you use
+ transactions and have a lot of operations per transaction. Naturally, there is no way to
+ ascertain
+ a definite threshold after which reference counting should be used. It is usually a tradeoff
+ between
+ network speed and larger data streams, and CPU overhead in generating references. It is best to
+ profile
+ with this enabled and disabled to determine which is best, but one thing for certain is that if
+ you do
+ not use transactions, or have transactions with just one or two operations, reference counting
+ ought to
+ be disabled.
+ </para>
+ </entry>
+ </row>
+
</tbody>
</tgroup>
</informaltable>
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -25,10 +25,10 @@
implements Cloneable
{
private static final long serialVersionUID = 5553791890144997466L;
- private int numberOfNotifierThreads = 25;
private Marshaller marshaller;
+
public void setCacheMarshaller(Marshaller instance)
{
marshaller = instance;
@@ -187,6 +187,7 @@
private String marshallerClass;
private ShutdownHookBehavior shutdownHookBehavior = ShutdownHookBehavior.DEFAULT;
private boolean useLazyDeserialization = true;
+ private boolean useReferenceCounting = false;
// ------------------------------------------------------------------------------------------------------------
// SETTERS - MAKE SURE ALL SETTERS PERFORM testImmutability()!!!
@@ -491,6 +492,17 @@
this.useLazyDeserialization = useLazyDeserialization;
}
+ /**
+ * Sets whether reference counting should be used when marshalling remote calls.
+ *
+ * @since 2.1.0
+ */
+ public void setUseReferenceCounting(boolean b)
+ {
+ testImmutability("useReferenceCounting");
+ useReferenceCounting = b;
+ }
+
// ------------------------------------------------------------------------------------------------------------
// GETTERS
// ------------------------------------------------------------------------------------------------------------
@@ -679,16 +691,16 @@
this.marshallerClass = marshallerClass;
}
- public int getNumberOfNotifierThreads()
+ /**
+ * Gets whether reference counting should be used when marshalling remote calls.
+ *
+ * @since 2.1.0
+ */
+ public boolean isUseReferenceCounting()
{
- return numberOfNotifierThreads;
+ return useReferenceCounting;
}
- public void setNumberOfNotifierThreads(int numberOfNotifierThreads)
- {
- this.numberOfNotifierThreads = numberOfNotifierThreads;
- }
-
/**
* Returns a {@link java.net.URL} to a default JGroups configuration file.
*
@@ -762,7 +774,7 @@
if (lockParentForChildInsertRemove != that.lockParentForChildInsertRemove) return false;
- if (numberOfNotifierThreads != that.numberOfNotifierThreads) return false;
+ if (useReferenceCounting != that.useReferenceCounting) return false;
return true;
}
@@ -797,7 +809,7 @@
result = 29 * result + (runtimeConfig != null ? runtimeConfig.hashCode() : 0);
result = 29 * result + (marshallerClass != null ? marshallerClass.hashCode() : 0);
result = 29 * result + (lockParentForChildInsertRemove ? 1 : 0);
- result = 29 * result + numberOfNotifierThreads;
+ result = 29 * result + (useReferenceCounting ? 1 : 0);
return result;
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -45,6 +45,7 @@
private Map<GlobalTransaction, Fqn> transactions = new ConcurrentHashMap<GlobalTransaction, Fqn>(16);
protected Configuration configuration;
protected ClassLoader defaultClassLoader;
+ protected boolean useRefs = false;
@Inject
void injectDependencies(RegionManager regionManager, Configuration configuration, @ComponentName("deployerClassLoader")ClassLoader defaultClassLoader)
@@ -59,6 +60,10 @@
{
this.useRegionBasedMarshalling = configuration.isUseRegionBasedMarshalling();
this.defaultInactive = configuration.isInactiveOnStartup();
+
+ // ensure that if we are using CacheMarshaller200 - i.e., using replication version of 2.0.0 - reference counting is
+ // enabled, since this is always enabled in JBC 2.0.0.
+ this.useRefs = configuration.isUseReferenceCounting() || getClass().equals(CacheMarshaller200.class);
}
protected void initLogger()
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -6,6 +6,7 @@
*/
package org.jboss.cache.marshall;
+import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import static org.jboss.cache.Region.Status;
@@ -130,7 +131,7 @@
}
else
{
- Map<Integer, Object> refMap = new HashMap<Integer, Object>();
+ UnmarshalledReferences refMap = new UnmarshalledReferences();
Object retValue = unmarshallObject(in, defaultClassLoader, refMap);
if (trace) log.trace("Unmarshalled object " + retValue);
return retValue;
@@ -140,7 +141,7 @@
public void objectToObjectStream(Object o, ObjectOutputStream out, Fqn region) throws Exception
{
if (trace) log.trace("Marshalling object " + o);
- Map<Object, Integer> refMap = new HashMap<Object, Integer>();
+ Map<Object, Integer> refMap = useRefs ? new HashMap<Object, Integer>() : null;
ClassLoader toUse = defaultClassLoader;
Thread current = Thread.currentThread();
ClassLoader old = current.getContextClassLoader();
@@ -171,7 +172,7 @@
protected Object objectFromObjectStreamRegionBased(ObjectInputStream in) throws Exception
{
- Map<Integer, Object> refMap = new HashMap<Integer, Object>();
+ UnmarshalledReferences refMap = useRefs ? new UnmarshalledReferences() : null;
Object o = unmarshallObject(in, refMap);
Fqn regionFqn = null;
if (o == null)
@@ -283,7 +284,7 @@
{
out.writeByte(MAGICNUMBER_NULL);
}
- else if (refMap.containsKey(o))// see if this object has been marshalled before.
+ else if (useRefs && refMap.containsKey(o))// see if this object has been marshalled before.
{
out.writeByte(MAGICNUMBER_REF);
writeReference(out, refMap.get(o));
@@ -311,13 +312,13 @@
else if (o instanceof Fqn)
{
out.writeByte(MAGICNUMBER_FQN);
- writeReference(out, createReference(o, refMap));
+ if (useRefs) writeReference(out, createReference(o, refMap));
marshallFqn((Fqn) o, out, refMap);
}
else if (o instanceof GlobalTransaction)
{
out.writeByte(MAGICNUMBER_GTX);
- writeReference(out, createReference(o, refMap));
+ if (useRefs) writeReference(out, createReference(o, refMap));
marshallGlobalTransaction((GlobalTransaction) o, out, refMap);
}
else if (o instanceof IpAddress)
@@ -388,7 +389,7 @@
else if (o instanceof String)
{
out.writeByte(MAGICNUMBER_STRING);
- writeReference(out, createReference(o, refMap));
+ if (useRefs) writeReference(out, createReference(o, refMap));
marshallString((String) o, out);
}
else if (o instanceof NodeDataMarker)
@@ -418,7 +419,7 @@
log.trace("Warning: using object serialization for " + o.getClass());
}
out.writeByte(MAGICNUMBER_SERIALIZABLE);
- writeReference(out, createReference(o, refMap));
+ if (useRefs) writeReference(out, createReference(o, refMap));
out.writeObject(o);
}
else
@@ -514,7 +515,7 @@
// --------- Unmarshalling methods
- private Object unmarshallObject(ObjectInputStream in, ClassLoader loader, Map<Integer, Object> refMap) throws Exception
+ private Object unmarshallObject(ObjectInputStream in, ClassLoader loader, UnmarshalledReferences refMap) throws Exception
{
if (loader == null)
{
@@ -536,26 +537,31 @@
}
}
- private Object unmarshallObject(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ private Object unmarshallObject(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
byte magicNumber = in.readByte();
- Integer reference;
+ Integer reference = 0;
Object retVal;
switch (magicNumber)
{
case MAGICNUMBER_NULL:
return null;
case MAGICNUMBER_REF:
- reference = readReference(in);
- if (!refMap.containsKey(reference))
+ if (useRefs)
{
- throw new IOException("Unable to locate object reference " + reference + " in byte stream!");
+ reference = readReference(in);
+ return refMap.getReferencedObject(reference);
+// if (!refMap.containsKey(reference))
+// {
+// throw new IOException("Unable to locate object reference " + reference + " in byte stream!");
+// }
+// return refMap.get(reference);
}
- return refMap.get(reference);
+ else break;
case MAGICNUMBER_SERIALIZABLE:
- reference = readReference(in);
+ if (useRefs) reference = readReference(in);
retVal = in.readObject();
- refMap.put(reference, retVal);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
return retVal;
case MAGICNUMBER_MARSHALLEDVALUE:
MarshalledValue mv = new MarshalledValue();
@@ -565,14 +571,14 @@
retVal = unmarshallMethodCall(in, refMap);
return retVal;
case MAGICNUMBER_FQN:
- reference = readReference(in);
+ if (useRefs) reference = readReference(in);
retVal = unmarshallFqn(in, refMap);
- refMap.put(reference, retVal);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
return retVal;
case MAGICNUMBER_GTX:
- reference = readReference(in);
+ if (useRefs) reference = readReference(in);
retVal = unmarshallGlobalTransaction(in, refMap);
- refMap.put(reference, retVal);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
return retVal;
case MAGICNUMBER_IPADDRESS:
retVal = unmarshallIpAddress(in);
@@ -603,9 +609,9 @@
case MAGICNUMBER_SHORT:
return in.readShort();
case MAGICNUMBER_STRING:
- reference = readReference(in);
+ if (useRefs) reference = readReference(in);
retVal = unmarshallString(in);
- refMap.put(reference, retVal);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
return retVal;
case MAGICNUMBER_NODEDATA_MARKER:
retVal = new NodeDataMarker();
@@ -628,9 +634,10 @@
}
throw new Exception("Unknown magic number " + magicNumber);
}
+ throw new Exception("Unknown magic number " + magicNumber);
}
- private GravitateResult unmarshallGravitateResult(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ private GravitateResult unmarshallGravitateResult(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Boolean found = (Boolean) unmarshallObject(in, refMap);
if (found)
@@ -651,7 +658,7 @@
return (String) in.readObject();
}
- private MethodCall unmarshallMethodCall(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ private MethodCall unmarshallMethodCall(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
short methodId = in.readShort();
byte numArgs = in.readByte();
@@ -669,7 +676,7 @@
return MethodCallFactory.create(methodId, args);
}
- private GlobalTransaction unmarshallGlobalTransaction(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ private GlobalTransaction unmarshallGlobalTransaction(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
GlobalTransaction gtx = new GlobalTransaction();
long id = in.readLong();
@@ -679,7 +686,7 @@
return gtx;
}
- Fqn unmarshallFqn(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ Fqn unmarshallFqn(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
boolean isRoot = in.readBoolean();
@@ -692,7 +699,7 @@
{
elements.add(unmarshallObject(in, refMap));
}
- fqn = new Fqn(elements);
+ fqn = new Fqn(elements, true);
}
else
{
@@ -708,7 +715,7 @@
return ipAddress;
}
- private List unmarshallArrayList(ObjectInputStream in, Map refMap) throws Exception
+ private List unmarshallArrayList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
int listSize = readUnsignedInt(in);
List list = new ArrayList(listSize);
@@ -716,49 +723,49 @@
return list;
}
- private List unmarshallLinkedList(ObjectInputStream in, Map refMap) throws Exception
+ private List unmarshallLinkedList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
List list = new LinkedList();
populateFromStream(in, refMap, list, readUnsignedInt(in));
return list;
}
- private Map unmarshallHashMap(ObjectInputStream in, Map refMap) throws Exception
+ private Map unmarshallHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Map map = new HashMap();
populateFromStream(in, refMap, map);
return map;
}
- private Map unmarshallMapCopy(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
+ private Map unmarshallMapCopy(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
// read in as a HashMap first
Map m = unmarshallHashMap(in, refMap);
return new MapCopy(m);
}
- private Map unmarshallTreeMap(ObjectInputStream in, Map refMap) throws Exception
+ private Map unmarshallTreeMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Map map = new TreeMap();
populateFromStream(in, refMap, map);
return map;
}
- private Set unmarshallHashSet(ObjectInputStream in, Map refMap) throws Exception
+ private Set unmarshallHashSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Set set = new HashSet();
populateFromStream(in, refMap, set);
return set;
}
- private Set unmarshallTreeSet(ObjectInputStream in, Map refMap) throws Exception
+ private Set unmarshallTreeSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
Set set = new TreeSet();
populateFromStream(in, refMap, set);
return set;
}
- private void populateFromStream(ObjectInputStream in, Map refMap, Map mapToPopulate) throws Exception
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Map mapToPopulate) throws Exception
{
int size = readUnsignedInt(in);
for (int i = 0; i < size; i++)
@@ -767,7 +774,7 @@
}
}
- private void populateFromStream(ObjectInputStream in, Map refMap, Set setToPopulate) throws Exception
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Set setToPopulate) throws Exception
{
int size = readUnsignedInt(in);
for (int i = 0; i < size; i++)
@@ -776,7 +783,7 @@
}
}
- private void populateFromStream(ObjectInputStream in, Map refMap, List listToPopulate, int listSize) throws Exception
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, List listToPopulate, int listSize) throws Exception
{
for (int i = 0; i < listSize; i++)
{
@@ -838,3 +845,48 @@
out.writeLong(i);
}
}
+
+/**
+ * An efficient array-based list of referenced objects, using the reference id as a subscript for the array.
+ */
+class UnmarshalledReferences
+{
+ private ArrayList<Object> referencedObjects = new ArrayList<Object>();
+
+ /**
+ * Retrieves an object referenced by an id
+ *
+ * @param ref reference
+ * @return object
+ */
+ public Object getReferencedObject(int ref)
+ {
+ if (ref >= referencedObjects.size())
+ throw new CacheException("Attempting to look up a ref that hasn't been inserted yet");
+ return referencedObjects.get(ref);
+ }
+
+ /**
+ * Adds a referenced object to the list of references
+ *
+ * @param ref reference id
+ * @param o object
+ */
+ public void putReferencedObject(int ref, Object o)
+ {
+ int sz = referencedObjects.size();
+ // if we are not adding the object to the end of the list, make sure we use a specific position
+ if (ref < sz)
+ {
+ referencedObjects.add(ref, o);
+ return;
+ }
+ else if (ref > sz)
+ {
+ // if we are adding the reference to a position beyond the end of the list, make sure we expand the list first.
+ // this can happen, weirdly enough, since marshallObject() can be called recursively, such as from marshallFqn().
+ for (int i = sz; i < ref; i++) referencedObjects.add(null);
+ }
+ referencedObjects.add(o);
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -16,7 +16,6 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
@@ -55,7 +54,7 @@
assert magic == CacheMarshaller200.MAGICNUMBER_FQN;
// now the chunks of an Fqn
- Fqn f = cm200.unmarshallFqn(ois, new HashMap<Integer, Object>());
+ Fqn f = cm200.unmarshallFqn(ois, new UnmarshalledReferences());
assert f.equals(Fqn.fromString("/hello"));
}
@@ -126,7 +125,7 @@
assert in.readByte() == CacheMarshaller200.MAGICNUMBER_FQN : "The stream should start with an Fqn";
// discard the nest refId short
in.readShort();
- Fqn f = cm200.unmarshallFqn(in, new HashMap<Integer, Object>());
+ Fqn f = cm200.unmarshallFqn(in, new UnmarshalledReferences());
assert region.equals(f) : "Should use the same region for the response as was used for the request!";
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -35,6 +35,7 @@
c.setUseRegionBasedMarshalling(false);
c.setInactiveOnStartup(false);
c.setReplVersionString(currentVersion);
+ //c.setUseReferenceCounting(true);
marshaller = createVAM(c, regionManager);
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -24,6 +24,7 @@
{
Configuration cfg = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
cache = new DefaultCacheFactory().createCache(cfg, false);
+ cfg.setUseReferenceCounting(false);
}
@AfterTest
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-02-01 12:13:53 UTC (rev 5286)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-02-02 14:41:13 UTC (rev 5287)
@@ -36,7 +36,7 @@
/*
Test configuration options
*/
- protected static final long DURATION = 2 * 60 * 1000;
+ protected static final long DURATION = 10 * 60 * 1000;
protected static final int NUM_THREADS = 10;
protected static final int MAX_RANDOM_SLEEP_MILLIS = 100;
protected static final int MAX_DEPTH = 8;
@@ -112,6 +112,9 @@
startup();
warmup();
doTest();
+
+ // wait for user exit
+ System.in.read();
}
/**
16 years, 10 months
JBoss Cache SVN: r5286 - core/trunk/src/test/resources.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-02-01 07:13:53 -0500 (Fri, 01 Feb 2008)
New Revision: 5286
Modified:
core/trunk/src/test/resources/log4j.xml
Log:
increased default log levet to WARN
Modified: core/trunk/src/test/resources/log4j.xml
===================================================================
--- core/trunk/src/test/resources/log4j.xml 2008-02-01 11:16:36 UTC (rev 5285)
+++ core/trunk/src/test/resources/log4j.xml 2008-02-01 12:13:53 UTC (rev 5286)
@@ -23,7 +23,7 @@
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="output/jbosscache.log"/>
- <param name="Append" value="false"/>
+ <param name="Append" value="true"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
@@ -31,7 +31,7 @@
<!-- Rollover at the top of each hour
<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
-->
- <param name="Threshold" value="TRACE"/>
+ <param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
@@ -63,21 +63,9 @@
<!-- ================ -->
<category name="org.jboss.cache">
- <priority value="ERROR"/>
+ <priority value="WARN"/>
</category>
-
- <!--<category name="org.jboss.cache.interceptors.PessimisticLockInterceptor">-->
- <!--<priority value="TRACE"/>-->
- <!--</category>-->
- <!--<category name="org.jboss.cache.interceptors.UnlockInterceptor">-->
- <!--<priority value="TRACE"/>-->
- <!--</category>-->
-
- <category name="org.jboss.cache.eviction">
- <priority value="TRACE"/>
- </category>
-
<category name="org.jboss.tm">
<priority value="WARN"/>
</category>
16 years, 10 months
JBoss Cache SVN: r5285 - core/trunk/src/test/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-02-01 06:16:36 -0500 (Fri, 01 Feb 2008)
New Revision: 5285
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
Log:
fixed tests
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-01-31 18:56:11 UTC (rev 5284)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-02-01 11:16:36 UTC (rev 5285)
@@ -428,7 +428,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false);
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(cache.peek(fqn, false, false));
@@ -505,7 +505,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false);
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(cache.getNode(fqn));
event = region.takeLastEventNode();
16 years, 10 months