public class AbstractCacheUnitThreadTest extends HybrisJUnit4Test
AbstractCacheUnit and Cache behavior, especially in multi-threaded mode.jaloSession| Constructor and Description |
|---|
AbstractCacheUnitThreadTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testExclusiveComputation()
Tests whether
AbstractCacheUnit.compute() is really working exclusively when
Cache.isForceExclusiveComputation() is switched on. |
void |
testExclusiveUnitAddToCache()
Tests whether
Cache.getOrAddUnit(AbstractCacheUnit) is ensuring that only one unit per key is being added
even if multiple threads are trying that at the same time. |
void |
testMultiThreadedAccessAndMemory()
Tests multiple threads accessing
AbstractCacheUnit and implicitely Cache, without testing for
correctness! Instead it compares the memory before access, after filling up and after clearing the cache. |
establishJaloSession, finish, getOrCreateCurrency, getOrCreateLanguage, init, intenseChecksActivated, takeJaloSessionpublic void testMultiThreadedAccessAndMemory()
throws java.lang.InterruptedException
AbstractCacheUnit and implicitely Cache, without testing for
correctness! Instead it compares the memory before access, after filling up and after clearing the cache. The test
will fail if after clear the memory gain is higher than a allowed gain (atm 50 bytes per thread, which is 5000 bytes
for 100 threads).java.lang.InterruptedExceptionpublic void testExclusiveUnitAddToCache()
throws java.lang.InterruptedException
Cache.getOrAddUnit(AbstractCacheUnit) is ensuring that only one unit per key is being added
even if multiple threads are trying that at the same time. To enforce potential errors the test runs several turns of
all threads trying to add a unit with the same key per turn.java.lang.InterruptedExceptionpublic void testExclusiveComputation()
throws java.lang.InterruptedException
AbstractCacheUnit.compute() is really working exclusively when
Cache.isForceExclusiveComputation() is switched on. To test this we let many threads try to access the cache
using one unit per thread having the same key.java.lang.InterruptedExceptionCopyright © 2018 SAP SE. All Rights Reserved.