[HHH-3585] Move to JBoss Cache 3
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16098 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
d55bde6ecc
commit
81f2726bc2
|
@ -13,8 +13,8 @@
|
|||
<artifactId>hibernate-jbosscache2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Hibernate JBossCache2.x Integration</name>
|
||||
<description>Integration of Hibernate with JBossCache (based on JBossCache2.x APIs)</description>
|
||||
<name>Hibernate JBossCache3.x Integration</name>
|
||||
<description>Integration of Hibernate with JBossCache 3 (based on JBossCache2.x+ APIs)</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jboss.cache</groupId>
|
||||
<artifactId>jbosscache-core</artifactId>
|
||||
<version>2.2.0.GA</version>
|
||||
<version>3.0.3.GA</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
|
|
|
@ -76,14 +76,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -109,7 +112,6 @@
|
|||
</cache-config>
|
||||
|
||||
|
||||
|
||||
<!-- A config appropriate for entity/collection caching that
|
||||
uses pessimistic locking -->
|
||||
<cache-config name="pessimistic-entity">
|
||||
|
@ -168,6 +170,93 @@
|
|||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
<attribute name="wakeUpIntervalSeconds">5</attribute>
|
||||
<!-- Name of the DEFAULT eviction policy class. -->
|
||||
<attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
||||
<!-- Cache wide default -->
|
||||
<region name="/_default_">
|
||||
<!-- Evict LRU node once we have more than this number of nodes -->
|
||||
<attribute name="maxNodes">10000</attribute>
|
||||
<!-- And, evict any node that hasn't been accessed in this many seconds -->
|
||||
<attribute name="timeToLiveSeconds">1000</attribute>
|
||||
<!-- Don't evict a node that's been accessed within this many seconds.
|
||||
Set this to a value greater than your max expected transaction length. -->
|
||||
<attribute name="minTimeToLiveSeconds">120</attribute>
|
||||
</region>
|
||||
<!-- Don't ever evict modification timestamps -->
|
||||
<region name="/TS" policyClass="org.jboss.cache.eviction.NullEvictionPolicy"/>
|
||||
</config>
|
||||
</attribute>
|
||||
|
||||
</cache-config>
|
||||
|
||||
<!-- A config appropriate for entity/collection caching that
|
||||
uses mvcc locking -->
|
||||
<cache-config name="mvcc-entity">
|
||||
|
||||
<!-- Node locking scheme -->
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!--
|
||||
READ_COMMITTED is as strong as necessary for most
|
||||
2nd Level Cache use cases.
|
||||
-->
|
||||
<attribute name="IsolationLevel">READ_COMMITTED</attribute>
|
||||
|
||||
<!-- Mode of communication with peer caches.
|
||||
|
||||
INVALIDATION_SYNC is highly recommended as the mode for use
|
||||
with entity and collection caches.
|
||||
-->
|
||||
<attribute name="CacheMode">INVALIDATION_SYNC</attribute>
|
||||
|
||||
<!-- Name of cluster. Needs to be the same for all members, in order
|
||||
to find each other -->
|
||||
<attribute name="ClusterName">mvcc-entity</attribute>
|
||||
|
||||
<!-- Use a UDP (multicast) based stack. A udp-sync stack might be
|
||||
slightly better (no JGroups FC) but we stick with udp to
|
||||
help ensure this cache and others like timestamps-cache
|
||||
that require FC can use the same underlying JGroups resources. -->
|
||||
<attribute name="MultiplexerStack">udp</attribute>
|
||||
|
||||
<!-- Whether or not to fetch state on joining a cluster. -->
|
||||
<attribute name="FetchInMemoryState">false</attribute>
|
||||
|
||||
<!--
|
||||
The max amount of time (in milliseconds) we wait until the
|
||||
state (ie. the contents of the cache) are retrieved from
|
||||
existing members at startup. Ignored if FetchInMemoryState=false.
|
||||
-->
|
||||
<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>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
|
@ -245,14 +334,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -278,6 +370,92 @@
|
|||
</cache-config>
|
||||
|
||||
|
||||
<!-- Same as "mvcc-entity" but here we use REPEATABLE_READ
|
||||
instead of READ_COMMITTED. REPEATABLE_READ is only useful if the
|
||||
application evicts/clears entities from the Hibernate Session and
|
||||
then expects to repeatably re-read them in the same transaction.
|
||||
Otherwise, the Session's internal cache provides a repeatable-read
|
||||
semantic. Before choosing this config, carefully read the docs
|
||||
and make sure you really need REPEATABLE_READ.
|
||||
-->
|
||||
<cache-config name="mvcc-entity-repeatable">
|
||||
|
||||
<!-- Node locking scheme -->
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!-- Here we use REPEATABLE_READ. -->
|
||||
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
|
||||
|
||||
<!-- Mode of communication with peer caches.
|
||||
|
||||
INVALIDATION_SYNC is highly recommended as the mode for use
|
||||
with entity and collection caches.
|
||||
-->
|
||||
<attribute name="CacheMode">INVALIDATION_SYNC</attribute>
|
||||
|
||||
<!-- Name of cluster. Needs to be the same for all members, in order
|
||||
to find each other -->
|
||||
<attribute name="ClusterName">mvcc-entity-rr</attribute>
|
||||
|
||||
<!-- Use a UDP (multicast) based stack. A udp-sync stack might be
|
||||
slightly better (no JGroups FC) but we stick with udp to
|
||||
help ensure this cache and others like timestamps-cache
|
||||
that require FC can use the same underlying JGroups resources. -->
|
||||
<attribute name="MultiplexerStack">udp</attribute>
|
||||
|
||||
<!-- Whether or not to fetch state on joining a cluster. -->
|
||||
<attribute name="FetchInMemoryState">false</attribute>
|
||||
|
||||
<!--
|
||||
The max amount of time (in milliseconds) we wait until the
|
||||
state (ie. the contents of the cache) are retrieved from
|
||||
existing members at startup. Ignored if FetchInMemoryState=false.
|
||||
-->
|
||||
<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>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
<attribute name="wakeUpIntervalSeconds">5</attribute>
|
||||
<!-- Name of the DEFAULT eviction policy class. -->
|
||||
<attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
||||
<!-- Cache wide default -->
|
||||
<region name="/_default_">
|
||||
<!-- Evict LRU node once we have more than this number of nodes -->
|
||||
<attribute name="maxNodes">10000</attribute>
|
||||
<!-- And, evict any node that hasn't been accessed in this many seconds -->
|
||||
<attribute name="timeToLiveSeconds">1000</attribute>
|
||||
<!-- Don't evict a node that's been accessed within this many seconds.
|
||||
Set this to a value greater than your max expected transaction length. -->
|
||||
<attribute name="minTimeToLiveSeconds">120</attribute>
|
||||
</region>
|
||||
<!-- Don't ever evict modification timestamps -->
|
||||
<region name="/TS" policyClass="org.jboss.cache.eviction.NullEvictionPolicy"/>
|
||||
</config>
|
||||
</attribute>
|
||||
|
||||
</cache-config>
|
||||
|
||||
<!-- A config appropriate for query caching. Does not replicate
|
||||
queries. DO NOT STORE TIMESTAMPS IN THIS CACHE.
|
||||
|
@ -365,14 +543,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
Indicate whether to use 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">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
<!--
|
||||
Indicate whether to use 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">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -406,7 +587,7 @@
|
|||
<cache-config name="timestamps-cache">
|
||||
|
||||
<!-- Node locking scheme -->
|
||||
<attribute name="NodeLockingScheme">PESSIMISTIC</attribute>
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!--
|
||||
READ_COMMITTED is as strong as necessary.
|
||||
|
@ -442,14 +623,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
Indicate whether to use 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">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
<!--
|
||||
Indicate whether to use 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">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -485,7 +669,7 @@
|
|||
|
||||
<!-- Node locking scheme:
|
||||
OPTIMISTIC
|
||||
PESSIMISTIC (default)
|
||||
MVCC (default)
|
||||
-->
|
||||
<attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
|
||||
|
||||
|
@ -526,13 +710,16 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Indicate whether to use 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">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -613,14 +800,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -645,7 +835,95 @@
|
|||
|
||||
</cache-config>
|
||||
|
||||
<!-- A config appropriate for a cache that's shared for
|
||||
entity, collection, query and timestamp caching. Not an advised
|
||||
configuration, since it requires cache mode REPL_SYNC, which is the
|
||||
least efficient mode. Also requires a full state transfer at startup,
|
||||
which can be expensive. Uses mvcc locking.
|
||||
-->
|
||||
<cache-config name="mvcc-shared">
|
||||
|
||||
<!-- TransactionManager configuration not required for Hibernate!
|
||||
Hibernate will plug in its own transaction manager integration.
|
||||
-->
|
||||
|
||||
<!-- Node locking scheme -->
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!--
|
||||
READ_COMMITTED is as strong as necessary for most
|
||||
2nd Level Cache use cases.
|
||||
-->
|
||||
<attribute name="IsolationLevel">READ_COMMITTED</attribute>
|
||||
|
||||
<!-- Must use REPL since used for timestamp caching.
|
||||
Must use SYNC to maintain cache coherency for entities.
|
||||
-->
|
||||
<attribute name="CacheMode">REPL_SYNC</attribute>
|
||||
<attribute name="SyncCommitPhase">true</attribute>
|
||||
|
||||
<!-- Name of cluster. Needs to be the same for all members, in order
|
||||
to find each other -->
|
||||
<attribute name="ClusterName">mvcc-shared</attribute>
|
||||
|
||||
<!-- Use a UDP (multicast) based stack. Need JGroups flow control (FC)
|
||||
because timestamp communication will not require a synchronous response.
|
||||
-->
|
||||
<attribute name="MultiplexerStack">udp</attribute>
|
||||
|
||||
<!-- Used for timestamps, so must fetch state. -->
|
||||
<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 at startup.
|
||||
-->
|
||||
<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>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
<attribute name="wakeUpIntervalSeconds">5</attribute>
|
||||
<!-- Name of the DEFAULT eviction policy class. -->
|
||||
<attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
||||
<!-- Cache wide default -->
|
||||
<region name="/_default_">
|
||||
<!-- Evict LRU node once we have more than this number of nodes -->
|
||||
<attribute name="maxNodes">10000</attribute>
|
||||
<!-- And, evict any node that hasn't been accessed in this many seconds -->
|
||||
<attribute name="timeToLiveSeconds">1000</attribute>
|
||||
<!-- Don't evict a node that's been accessed within this many seconds.
|
||||
Set this to a value greater than your max expected transaction length. -->
|
||||
<attribute name="minTimeToLiveSeconds">120</attribute>
|
||||
</region>
|
||||
<!-- Don't ever evict modification timestamps -->
|
||||
<region name="/TS" policyClass="org.jboss.cache.eviction.NullEvictionPolicy"/>
|
||||
</config>
|
||||
</attribute>
|
||||
|
||||
</cache-config>
|
||||
|
||||
<!-- Same as "pessimistic-shared" but here we use REPEATABLE_READ
|
||||
instead of READ_COMMITTED. REPEATABLE_READ is only useful if the
|
||||
|
@ -700,14 +978,17 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
|
@ -732,4 +1013,92 @@
|
|||
|
||||
</cache-config>
|
||||
|
||||
<!-- Same as "mvcc-shared" but here we use REPEATABLE_READ
|
||||
instead of READ_COMMITTED. REPEATABLE_READ is only useful if the
|
||||
application evicts/clears entities from the Hibernate Session and
|
||||
then expects to repeatably re-read them in the same transaction.
|
||||
Otherwise, the Session's internal cache provides a repeatable-read
|
||||
semantic. Before choosing this config, carefully read the docs
|
||||
and make sure you really need REPEATABLE_READ.
|
||||
-->
|
||||
<cache-config name="mvcc-shared-repeatable">
|
||||
|
||||
<!-- TransactionManager configuration not required for Hibernate!
|
||||
Hibernate will plug in its own transaction manager integration.
|
||||
-->
|
||||
|
||||
<!-- Node locking scheme -->
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!-- Here we use REPEATABLE_READ. -->
|
||||
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
|
||||
|
||||
<!-- Must use REPL since used for timestamp caching.
|
||||
Must use SYNC to maintain cache coherency for entities.
|
||||
-->
|
||||
<attribute name="CacheMode">REPL_SYNC</attribute>
|
||||
<attribute name="SyncCommitPhase">true</attribute>
|
||||
|
||||
<!-- Name of cluster. Needs to be the same for all members, in order
|
||||
to find each other -->
|
||||
<attribute name="ClusterName">mvcc-shared-rr</attribute>
|
||||
|
||||
<!-- Use a UDP (multicast) based stack. Need JGroups flow control (FC)
|
||||
because timestamp communication will not require a synchronous response.
|
||||
-->
|
||||
<attribute name="MultiplexerStack">udp</attribute>
|
||||
|
||||
<!-- Used for timestamps, so must fetch state. -->
|
||||
<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 at startup.
|
||||
-->
|
||||
<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>
|
||||
|
||||
<!--
|
||||
Indicate whether to use marshalling or not. Set this to true if you
|
||||
are running under a scoped class loader, e.g., inside an application
|
||||
server.
|
||||
-->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Eviction policy configurations. -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
<attribute name="wakeUpIntervalSeconds">5</attribute>
|
||||
<!-- Name of the DEFAULT eviction policy class. -->
|
||||
<attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
||||
<!-- Cache wide default -->
|
||||
<region name="/_default_">
|
||||
<!-- Evict LRU node once we have more than this number of nodes -->
|
||||
<attribute name="maxNodes">10000</attribute>
|
||||
<!-- And, evict any node that hasn't been accessed in this many seconds -->
|
||||
<attribute name="timeToLiveSeconds">1000</attribute>
|
||||
<!-- Don't evict a node that's been accessed within this many seconds.
|
||||
Set this to a value greater than your max expected transaction length. -->
|
||||
<attribute name="minTimeToLiveSeconds">120</attribute>
|
||||
</region>
|
||||
<!-- Don't ever evict modification timestamps -->
|
||||
<region name="/TS" policyClass="org.jboss.cache.eviction.NullEvictionPolicy"/>
|
||||
</config>
|
||||
</attribute>
|
||||
|
||||
</cache-config>
|
||||
</cache-configs>
|
||||
|
|
|
@ -67,7 +67,7 @@ public abstract class AbstractRegionImplTestCase extends AbstractJBossCacheTestC
|
|||
public void testActivationDeactivation() throws Exception {
|
||||
|
||||
// Set up a cache to monitor affects of starting the region
|
||||
Cache remoteCache = new DefaultCacheFactory().createCache(SharedCacheInstanceManager.DEFAULT_CACHE_RESOURCE, false);
|
||||
Cache remoteCache = DefaultCacheFactory.getInstance().createCache(SharedCacheInstanceManager.DEFAULT_CACHE_RESOURCE, false);
|
||||
|
||||
// This test assumes replication; verify that's correct
|
||||
assertEquals("Cache is REPL_SYNC", "REPL_SYNC", remoteCache.getConfiguration().getCacheModeString());
|
||||
|
|
|
@ -171,9 +171,12 @@ public abstract class AbstractCollectionRegionAccessStrategyTestCase extends Abs
|
|||
node2Failure = null;
|
||||
}
|
||||
|
||||
protected static Configuration createConfiguration(String configName) {
|
||||
protected static Configuration createConfiguration(String configName, String configResource) {
|
||||
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
|
||||
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
|
||||
if (configResource != null) {
|
||||
cfg.setProperty(MultiplexingCacheInstanceManager.CACHE_FACTORY_RESOURCE_PROP, configResource);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
@ -185,6 +188,11 @@ public abstract class AbstractCollectionRegionAccessStrategyTestCase extends Abs
|
|||
return optimistic;
|
||||
}
|
||||
|
||||
public boolean isBlockingReads()
|
||||
{
|
||||
return !isUsingOptimisticLocking();
|
||||
}
|
||||
|
||||
protected boolean isUsingInvalidation() {
|
||||
return invalidation;
|
||||
}
|
||||
|
@ -546,12 +554,18 @@ public abstract class AbstractCollectionRegionAccessStrategyTestCase extends Abs
|
|||
|
||||
private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
|
||||
|
||||
private String configName;
|
||||
private final String configResource;
|
||||
private final String configName;
|
||||
private String preferIPv4Stack;
|
||||
|
||||
public AccessStrategyTestSetup(Test test, String configName) {
|
||||
this(test, configName, null);
|
||||
}
|
||||
|
||||
public AccessStrategyTestSetup(Test test, String configName, String configResource) {
|
||||
super(test);
|
||||
this.configName = configName;
|
||||
this.configResource = configResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -562,11 +576,11 @@ public abstract class AbstractCollectionRegionAccessStrategyTestCase extends Abs
|
|||
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
|
||||
System.setProperty(PREFER_IPV4STACK, "true");
|
||||
|
||||
localCfg = createConfiguration(configName);
|
||||
localCfg = createConfiguration(configName, configResource);
|
||||
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
|
||||
localCache = localRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
|
||||
|
||||
remoteCfg = createConfiguration(configName);
|
||||
remoteCfg = createConfiguration(configName, configResource);
|
||||
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
|
||||
remoteCache = remoteRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.collection;
|
||||
|
||||
import org.hibernate.test.util.CacheTestUtil;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Tests TRANSACTIONAL access when pessimistic locking and invalidation are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccInvalidatedTransactionalTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
|
||||
return getTestSetup(suite, "mvcc-entity");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertTrue("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
assertTrue("Synchronous mode", isSynchronous());
|
||||
}
|
||||
|
||||
// Known failures
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.collection;
|
||||
|
||||
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
|
||||
|
||||
/**
|
||||
* Tests for the "extra API" in EntityRegionAccessStrategy; in this
|
||||
* version using pessimistic locking with READ_ONLY access.
|
||||
* <p>
|
||||
* By "extra API" we mean those methods that are superfluous to the
|
||||
* function of the JBC integration, where the impl is a no-op or a static
|
||||
* false return value, UnsupportedOperationException, etc.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
|
||||
|
||||
private static CollectionRegionAccessStrategy localAccessStrategy;
|
||||
|
||||
/**
|
||||
* Create a new PessimisticAccessStrategyExtraAPITestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReadOnlyExtraAPITestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCacheConfigName() {
|
||||
return "mvcc-entity";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
|
||||
return localAccessStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
|
||||
localAccessStrategy = strategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.collection;
|
||||
|
||||
import org.hibernate.test.util.CacheTestUtil;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Tests READ_ONLY access when pessimistic locking and invalidation are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReadOnlyTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
|
||||
return getTestSetup(suite, "mvcc-entity");
|
||||
}
|
||||
|
||||
// Known failures
|
||||
|
||||
// Overrides
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertTrue("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.collection;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
/**
|
||||
* Tests TRANSACTIONAL access when pessimistic locking and replication are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReplicatedTransactionalTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
assertTrue("Synchronous mode", isSynchronous());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.collection;
|
||||
|
||||
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
|
||||
|
||||
/**
|
||||
* Tests for the "extra API" in EntityRegionAccessStrategy; in this base
|
||||
* version using Optimistic locking with TRANSACTIONAL access.
|
||||
* <p>
|
||||
* By "extra API" we mean those methods that are superfluous to the
|
||||
* function of the JBC integration, where the impl is a no-op or a static
|
||||
* false return value, UnsupportedOperationException, etc.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
|
||||
|
||||
private static CollectionRegionAccessStrategy localAccessStrategy;
|
||||
|
||||
/**
|
||||
* Create a new PessimisticAccessStrategyExtraAPITestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccTransactionalExtraAPITestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCacheConfigName() {
|
||||
return "mvcc-entity";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
|
||||
return localAccessStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
|
||||
localAccessStrategy = strategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
|
||||
}
|
|
@ -95,12 +95,20 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
|
||||
|
||||
public static Test getTestSetup(Class testClass, String configName) {
|
||||
TestSuite suite = new TestSuite(testClass);
|
||||
return new AccessStrategyTestSetup(suite, configName);
|
||||
return getTestSetup(testClass, configName, null);
|
||||
}
|
||||
|
||||
public static Test getTestSetup(Test test, String configName) {
|
||||
return new AccessStrategyTestSetup(test, configName);
|
||||
return getTestSetup(test, configName, null);
|
||||
}
|
||||
|
||||
public static Test getTestSetup(Class testClass, String configName, String configResource) {
|
||||
TestSuite suite = new TestSuite(testClass);
|
||||
return new AccessStrategyTestSetup(suite, configName, configResource);
|
||||
}
|
||||
|
||||
public static Test getTestSetup(Test test, String configName, String configResource) {
|
||||
return new AccessStrategyTestSetup(test, configName, configResource);
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,9 +177,12 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
node2Failure = null;
|
||||
}
|
||||
|
||||
protected static Configuration createConfiguration(String configName) {
|
||||
protected static Configuration createConfiguration(String configName, String configResource) {
|
||||
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
|
||||
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
|
||||
if (configResource != null) {
|
||||
cfg.setProperty(MultiplexingCacheInstanceManager.CACHE_FACTORY_RESOURCE_PROP, configResource);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
@ -419,7 +430,7 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
BatchModeTransactionManager.getInstance().begin();
|
||||
|
||||
readLatch.await();
|
||||
Object expected = isUsingOptimisticLocking() ? null : VALUE1;
|
||||
Object expected = !isBlockingReads() ? null : VALUE1;
|
||||
|
||||
assertEquals("Correct initial value", expected, localAccessStrategy.get(KEY, txTimestamp));
|
||||
|
||||
|
@ -446,7 +457,7 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
inserter.start();
|
||||
reader.start();
|
||||
|
||||
if (isUsingOptimisticLocking())
|
||||
if (! isBlockingReads())
|
||||
assertTrue("Threads completed", completionLatch.await(1, TimeUnit.SECONDS));
|
||||
else {
|
||||
// Reader should be blocking for lock
|
||||
|
@ -463,6 +474,11 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
assertEquals("Correct node2 value", expected, remoteAccessStrategy.get(KEY, txTimestamp));
|
||||
}
|
||||
|
||||
public boolean isBlockingReads()
|
||||
{
|
||||
return !isUsingOptimisticLocking();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link TransactionalAccess#update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)}.
|
||||
*/
|
||||
|
@ -525,7 +541,7 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
// This will block w/ pessimistic locking and then
|
||||
// read the new value; w/ optimistic it shouldn't
|
||||
// block and will read the old value
|
||||
Object expected = isUsingOptimisticLocking() ? VALUE1 : VALUE2;
|
||||
Object expected = !isBlockingReads() ? VALUE1 : VALUE2;
|
||||
assertEquals("Correct value", expected, localAccessStrategy.get(KEY, txTimestamp));
|
||||
|
||||
BatchModeTransactionManager.getInstance().commit();
|
||||
|
@ -551,7 +567,7 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
updater.start();
|
||||
reader.start();
|
||||
|
||||
if (isUsingOptimisticLocking())
|
||||
if (! isBlockingReads())
|
||||
// Should complete promptly
|
||||
assertTrue(completionLatch.await(1, TimeUnit.SECONDS));
|
||||
else {
|
||||
|
@ -755,12 +771,18 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
|
||||
private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
|
||||
|
||||
private String configName;
|
||||
private final String configResource;
|
||||
private final String configName;
|
||||
private String preferIPv4Stack;
|
||||
|
||||
public AccessStrategyTestSetup(Test test, String configName) {
|
||||
this(test, configName, null);
|
||||
}
|
||||
|
||||
public AccessStrategyTestSetup(Test test, String configName, String configResource) {
|
||||
super(test);
|
||||
this.configName = configName;
|
||||
this.configResource = configResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -779,11 +801,11 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
|
|||
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
|
||||
System.setProperty(PREFER_IPV4STACK, "true");
|
||||
|
||||
localCfg = createConfiguration(configName);
|
||||
localCfg = createConfiguration(configName, configResource);
|
||||
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
|
||||
localCache = localRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
|
||||
|
||||
remoteCfg = createConfiguration(configName);
|
||||
remoteCfg = createConfiguration(configName, configResource);
|
||||
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
|
||||
remoteCache = remoteRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.entity;
|
||||
|
||||
import org.hibernate.test.util.CacheTestUtil;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Tests TRANSACTIONAL access when MVCC locking and invalidation are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccInvalidatedTransactionalTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
|
||||
return getTestSetup(suite, "mvcc-entity");
|
||||
}
|
||||
|
||||
// Known failures
|
||||
|
||||
// Overrides
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertTrue("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
assertTrue("Synchronous mode", isSynchronous());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockingReads() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.entity;
|
||||
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
|
||||
/**
|
||||
* Tests for the "extra API" in EntityRegionAccessStrategy; in this
|
||||
* version using pessimistic locking with READ_ONLY access.
|
||||
* <p>
|
||||
* By "extra API" we mean those methods that are superfluous to the
|
||||
* function of the JBC integration, where the impl is a no-op or a static
|
||||
* false return value, UnsupportedOperationException, etc.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
|
||||
|
||||
private static EntityRegionAccessStrategy localAccessStrategy;
|
||||
|
||||
/**
|
||||
* Create a new PessimisticAccessStrategyExtraAPITestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReadOnlyExtraAPITestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCacheConfigName() {
|
||||
return "mvcc-entity";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EntityRegionAccessStrategy getEntityAccessStrategy() {
|
||||
return localAccessStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
|
||||
localAccessStrategy = strategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
}
|
68
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
vendored
Normal file
68
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.entity;
|
||||
|
||||
import org.hibernate.test.util.CacheTestUtil;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Tests READ_ONLY access when pessimistic locking and invalidation are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReadOnlyTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
|
||||
return getTestSetup(suite, "mvcc-entity");
|
||||
}
|
||||
|
||||
// Known failures
|
||||
|
||||
// Overrides
|
||||
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertTrue("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockingReads() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.entity;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
/**
|
||||
* Tests TRANSACTIONAL access when pessimistic locking and replication are used.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
|
||||
|
||||
/**
|
||||
* Create a new PessimisticTransactionalAccessTestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccReplicatedTransactionalTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Invalidation", isUsingInvalidation());
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
assertTrue("Synchronous mode", isSynchronous());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockingReads() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.entity;
|
||||
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
|
||||
/**
|
||||
* Tests for the "extra API" in EntityRegionAccessStrategy; in this base
|
||||
* version using Optimistic locking with TRANSACTIONAL access.
|
||||
* <p>
|
||||
* By "extra API" we mean those methods that are superfluous to the
|
||||
* function of the JBC integration, where the impl is a no-op or a static
|
||||
* false return value, UnsupportedOperationException, etc.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
|
||||
|
||||
private static EntityRegionAccessStrategy localAccessStrategy;
|
||||
|
||||
/**
|
||||
* Create a new PessimisticAccessStrategyExtraAPITestCase.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MvccTransactionalExtraAPITestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCacheConfigName() {
|
||||
return "mvcc-entity";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EntityRegionAccessStrategy getEntityAccessStrategy() {
|
||||
return localAccessStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
|
||||
localAccessStrategy = strategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCacheConfiguration() {
|
||||
assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.functional;
|
||||
|
||||
|
||||
/**
|
||||
* Executes the superclass tests, but with Hibernate and JBoss Cache
|
||||
* configured for optimistic locking.
|
||||
*
|
||||
* @author Brian Stansberry
|
||||
*/
|
||||
public class MVCCEntityReplicationTest extends PessimisticEntityReplicationTest
|
||||
{
|
||||
|
||||
public MVCCEntityReplicationTest(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityCacheConfigName()
|
||||
{
|
||||
return "mvcc-shared";
|
||||
}
|
||||
|
||||
}
|
64
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
vendored
Normal file
64
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.test.cache.jbc2.functional;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.hibernate.cache.RegionFactory;
|
||||
import org.hibernate.cache.jbc2.JBossCacheRegionFactory;
|
||||
import org.hibernate.cache.jbc2.builder.SharedCacheInstanceManager;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
|
||||
|
||||
/**
|
||||
* Basic functional test of a pessimistic locking entity + query cache.
|
||||
*
|
||||
* @author Brian Stansberry
|
||||
*/
|
||||
public class MVCCJBossCacheTest extends AbstractQueryCacheFunctionalTestCase {
|
||||
|
||||
private static final String JBC_CONFIG = "org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml";
|
||||
|
||||
public MVCCJBossCacheTest(String x) {
|
||||
super(x);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new FunctionalTestClassTestSuite(MVCCJBossCacheTest.class);
|
||||
}
|
||||
|
||||
protected Class<? extends RegionFactory> getCacheRegionFactory() {
|
||||
return JBossCacheRegionFactory.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply any region-factory specific configurations.
|
||||
*
|
||||
* @param the Configuration to update.
|
||||
*/
|
||||
protected void configureCacheFactory(Configuration cfg) {
|
||||
cfg.setProperty(SharedCacheInstanceManager.CACHE_RESOURCE_PROP, JBC_CONFIG);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, v. 2.1. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details. You should have received a
|
||||
* copy of the GNU Lesser General Public License, v.2.1 along with this
|
||||
* distribution; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Red Hat Author(s): Brian Stansberry
|
||||
*/
|
||||
|
||||
package org.hibernate.test.cache.jbc2.functional;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
|
||||
|
||||
/**
|
||||
* A SessionRefreshTest that uses an OPTIMISTIC cache config.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MVCCSessionRefreshTest extends PessimisticSessionRefreshTest
|
||||
{
|
||||
|
||||
private static final String CACHE_CONFIG = "mvcc-entity";
|
||||
|
||||
/**
|
||||
* Create a new OptimisticSessionRefreshTest.
|
||||
*
|
||||
* @param x
|
||||
*/
|
||||
public MVCCSessionRefreshTest(String x)
|
||||
{
|
||||
super(x);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite(MVCCSessionRefreshTest.class);
|
||||
String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
|
||||
return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityCacheConfigName() {
|
||||
return CACHE_CONFIG;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* JBoss, Home of Professional Open Source.
|
||||
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
|
||||
* as indicated by the @author tags. See the copyright.txt file in the
|
||||
* distribution for a full listing of individual contributors.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this software; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
*/
|
||||
|
||||
package org.hibernate.test.cache.jbc2.functional.bulk;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.hibernate.test.cache.jbc2.collection.OptimisticInvalidatedTransactionalTestCase;
|
||||
import org.hibernate.test.util.CacheTestUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Optimistic version of BulkOperationsUnitTestCase.
|
||||
*
|
||||
* @author Brian Stansberry
|
||||
*
|
||||
*/
|
||||
public class MVCCBulkOperationsTest
|
||||
extends PessimisticBulkOperationsTest
|
||||
{
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
return CacheTestUtil.createFailureExpectedSuite(MVCCBulkOperationsTest.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public MVCCBulkOperationsTest(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityCacheConfigName()
|
||||
{
|
||||
return "mvcc-entity";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, v. 2.1. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details. You should have received a
|
||||
* copy of the GNU Lesser General Public License, v.2.1 along with this
|
||||
* distribution; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Red Hat Author(s): Brian Stansberry
|
||||
*/
|
||||
|
||||
package org.hibernate.test.cache.jbc2.functional.classloader;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
|
||||
|
||||
/**
|
||||
* Optimistic locking version of IsolatedClassLoaderTest.
|
||||
*
|
||||
* @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class MVCCIsolatedClassLoaderTest extends PessimisticIsolatedClassLoaderTest
|
||||
{
|
||||
private static final String CACHE_CONFIG = "mvcc-shared";
|
||||
|
||||
/**
|
||||
* Create a new OptimisticIsolatedClassLoaderTest.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MVCCIsolatedClassLoaderTest(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite(MVCCIsolatedClassLoaderTest.class);
|
||||
String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
|
||||
return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
|
||||
}
|
||||
|
||||
protected String getEntityCacheConfigName() {
|
||||
return CACHE_CONFIG;
|
||||
}
|
||||
|
||||
}
|
145
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml
vendored
Normal file
145
cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- -->
|
||||
<!-- Sample TreeCache Service Configuration -->
|
||||
<!-- -->
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<server>
|
||||
|
||||
<classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- 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>
|
||||
|
||||
<!--
|
||||
Node locking scheme:
|
||||
OPTIMISTIC
|
||||
PESSIMISTIC
|
||||
MVCC (default)
|
||||
-->
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!--
|
||||
TransactionManager configuration not required for Hibernate!
|
||||
Hibernate will plug in its own transaction manager integration.
|
||||
-->
|
||||
|
||||
<attribute name="IsolationLevel">READ_COMMITTED</attribute>
|
||||
|
||||
<!--
|
||||
Valid modes are LOCAL
|
||||
REPL_ASYNC
|
||||
REPL_SYNC
|
||||
-->
|
||||
<attribute name="CacheMode">LOCAL</attribute>
|
||||
|
||||
<!-- Name of cluster. Needs to be the same for all clusters, in order
|
||||
to find each other
|
||||
-->
|
||||
<attribute name="ClusterName">TreeCache-Cluster</attribute>
|
||||
|
||||
<attribute name="ClusterConfig">
|
||||
<config>
|
||||
<!-- UDP: if you have a multihomed machine,
|
||||
set the bind_addr attribute to the appropriate NIC IP address -->
|
||||
<!-- UDP: On Windows machines, because of the media sense feature
|
||||
being broken with multicast (even after disabling media sense)
|
||||
set the loopback attribute to true -->
|
||||
<UDP mcast_addr="228.1.2.3" mcast_port="45566"
|
||||
ip_ttl="64" ip_mcast="true"
|
||||
mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
|
||||
ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
|
||||
loopback="false"/>
|
||||
<PING timeout="2000" num_initial_members="3"/>
|
||||
<MERGE2 min_interval="10000" max_interval="20000"/>
|
||||
<FD shun="true"/>
|
||||
<VERIFY_SUSPECT timeout="1500"/>
|
||||
<pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"/>
|
||||
<pbcast.STABLE desired_avg_gossip="20000"/>
|
||||
<UNICAST timeout="600,1200,2400" min_threshold="10"/>
|
||||
<FRAG frag_size="8192"/>
|
||||
<pbcast.GMS join_timeout="5000" shun="true" print_local_addr="true"/>
|
||||
<pbcast.STATE_TRANSFER/>
|
||||
</config>
|
||||
</attribute>
|
||||
|
||||
<!-- Must be true if any entity deployment uses a scoped classloader -->
|
||||
<attribute name="UseRegionBasedMarshalling">true</attribute>
|
||||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!--
|
||||
The max amount of time (in milliseconds) we wait until the
|
||||
initial 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>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Specific eviction policy configurations. This is LRU -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
<attribute name="wakeUpIntervalSeconds">5</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>
|
||||
<!-- Don't ever evict modification timestamps -->
|
||||
<region name="/TS">
|
||||
<attribute name="maxNodes">0</attribute>
|
||||
<attribute name="timeToLiveSeconds">0</attribute>
|
||||
</region>
|
||||
</config>
|
||||
</attribute>
|
||||
</mbean>
|
||||
|
||||
|
||||
</server>
|
|
@ -56,7 +56,8 @@
|
|||
<!--
|
||||
Node locking scheme:
|
||||
OPTIMISTIC
|
||||
PESSIMISTIC (default)
|
||||
PESSIMISTIC
|
||||
MVCC (default)
|
||||
-->
|
||||
<attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
|
||||
|
||||
|
@ -137,6 +138,9 @@
|
|||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Specific eviction policy configurations. This is LRU -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
|
|
|
@ -45,6 +45,15 @@
|
|||
<depends>jboss:service=Naming</depends>
|
||||
<depends>jboss:service=TransactionManager</depends>
|
||||
|
||||
|
||||
<!--
|
||||
Node locking scheme:
|
||||
OPTIMISTIC
|
||||
PESSIMISTIC
|
||||
MVCC (default)
|
||||
-->
|
||||
<attribute name="NodeLockingScheme">PESSIMISTIC</attribute>
|
||||
|
||||
<!--
|
||||
TransactionManager configuration not required for Hibernate!
|
||||
Hibernate will plug in its own transaction manager integration.
|
||||
|
@ -110,6 +119,9 @@
|
|||
<!-- Max number of milliseconds to wait for a lock acquisition -->
|
||||
<attribute name="LockAcquisitionTimeout">15000</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Specific eviction policy configurations. This is LRU -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
|
|
|
@ -95,6 +95,10 @@ public class QueryRegionImplTestCase extends AbstractGeneralDataRegionTestCase {
|
|||
putDoesNotBlockGetTest("pessimistic-shared");
|
||||
}
|
||||
|
||||
public void testPutDoesNotBlockGetMVCC() throws Exception {
|
||||
putDoesNotBlockGetTest("mvcc-shared");
|
||||
}
|
||||
|
||||
private void putDoesNotBlockGetTest(String configName) throws Exception {
|
||||
|
||||
Configuration cfg = createConfiguration(configName);
|
||||
|
@ -190,6 +194,10 @@ public class QueryRegionImplTestCase extends AbstractGeneralDataRegionTestCase {
|
|||
getDoesNotBlockPutTest("pessimistic-shared-repeatable");
|
||||
}
|
||||
|
||||
public void testGetDoesNotBlockPutMVCC() throws Exception {
|
||||
getDoesNotBlockPutTest("mvcc-shared");
|
||||
}
|
||||
|
||||
private void getDoesNotBlockPutTest(String configName) throws Exception {
|
||||
|
||||
Configuration cfg = createConfiguration(configName);
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
|
||||
<!-- Node locking scheme:
|
||||
OPTIMISTIC
|
||||
PESSIMISTIC (default)
|
||||
MVCC (default)
|
||||
-->
|
||||
<attribute name="NodeLockingScheme">PESSIMISTIC</attribute>
|
||||
<attribute name="NodeLockingScheme">MVCC</attribute>
|
||||
|
||||
<!--
|
||||
READ_COMMITTED is as strong as necessary for most 2nd Level Cache usage.
|
||||
|
@ -108,6 +108,9 @@
|
|||
<!-- Must match the value of "useRegionBasedMarshalling" -->
|
||||
<attribute name="InactiveOnStartup">true</attribute>
|
||||
|
||||
<!-- For now. disable asynchronous RPC marshalling/sending -->
|
||||
<attribute name="SerializationExecutorPoolSize">0</attribute>
|
||||
|
||||
<!-- Specific eviction policy configurations. This is LRU -->
|
||||
<attribute name="EvictionPolicyConfig">
|
||||
<config>
|
||||
|
|
Loading…
Reference in New Issue