wildfly/wildfly — pull request #5357 by pferraro (2013-10-25 23:53:59+00:00)
Title: WFLY-2298 Redesign @Stateful EJB clustering

The new implementation also addresses:
WFLY-8 [PassivateTask] null: java.lang.NullPointerException
WFLY-821 Infinite loop on ejb passivation

This PR addresses the flaws identified in WFLY-2298 in the following ways:

Bean operations only require a single Infinispan transaction. This should result in an approximate 4x increase in throughput for replicated SFSBs.
Access to a SFSB is guarded by a pessimistic lock obtained during Cache.get() and not released until Cache.release()/discard().
The new implementation uses an Infinispan cache instance per deployment unit (encompassing any sub-deployments) to store both beans and bean groups (instead of a cache instance per bean type, and a single, global cache instance for bean groups). Access to all beans in the group is isolated by a single transaction. Because each deployment unit uses a separate cache instance, undeployment won't cause classloader leaks (since the cache instance is destroyed on undeploy), and the lifecycle of group caches are fully managed by the MSC.
@Clustered is no longer required to replicate the state of a SFSB - removing the dual functionality of the annotation. Replication is now the default behavior of a SFSB when using an HA profile. Replication can be disabled per bean via @Stateful(passivationCapable=false) - or globally via the cache-ref attribute. The @Cache annotation is still respected - so any SFSB can still choose to be associated with a specific cache by name.
Passivation now only happens lazily, as needed to maintain the configured max-size of the cache.
The old is replaced by a local Infinispan-based cache using Infinispan 6.0's SingleFileStore, the implementation of which is faster than the existing FilePersistentObjectStore implementation.
This PR also consolidates/re-enables a number of ejb tests in the clustering testsuite.
It adds test cases to validate the passivatability of allowed non-transient field types in accordance with section 4.2.1 of the EJB spec.