Fixed ALF-4682: ActionTrackingService uses cluster-unsafe cache

- Added *full* replication of objects across the cluster for 'executingActionsCache'
 - Changed cache variables to use SimpleCache


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22387 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-09-10 11:58:15 +00:00
parent 43f9c575e9
commit 82955f3ae2
4 changed files with 9 additions and 25 deletions

View File

@@ -118,8 +118,7 @@
<ref bean="actionService" /> <ref bean="actionService" />
</property> </property>
<property name="executingActionsCache"> <property name="executingActionsCache">
<!-- TODO: ALF-4682 ActionTrackingService uses cluster- and transactionally-unsafe cache --> <ref bean="executingActionsCache" />
<ref bean="executingActionsSharedCache" />
</property> </property>
</bean> </bean>

View File

@@ -1074,7 +1074,7 @@
<!-- The cross-transaction shared cache for Executing Actions --> <!-- The cross-transaction shared cache for Executing Actions -->
<bean name="executingActionsSharedCache" class="org.alfresco.repo.cache.EhCacheAdapter"> <bean name="executingActionsCache" class="org.alfresco.repo.cache.EhCacheAdapter">
<property name="cache"> <property name="cache">
<bean class="org.springframework.cache.ehcache.EhCacheFactoryBean" > <bean class="org.springframework.cache.ehcache.EhCacheFactoryBean" >
<property name="cacheManager"> <property name="cacheManager">
@@ -1087,18 +1087,4 @@
</property> </property>
</bean> </bean>
<!-- The transactional cache for Executing Actions -->
<bean name="executingActionsCache" class="org.alfresco.repo.cache.TransactionalCache">
<property name="sharedCache">
<ref bean="executingActionsSharedCache" />
</property>
<property name="name">
<value>org.alfresco.cache.executingActionsTransactionalCache</value>
</property>
<property name="maxCacheSize">
<value>1000</value>
</property>
</bean>
</beans> </beans>

View File

@@ -838,10 +838,10 @@
<cacheEventListenerFactory <cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicatePuts = false, properties="replicatePuts = true,
replicateUpdates = true, replicateUpdates = true,
replicateRemovals = true, replicateRemovals = true,
replicateUpdatesViaCopy = false, replicateUpdatesViaCopy = true,
replicateAsynchronously = false"/> replicateAsynchronously = false"/>
</cache> </cache>

View File

@@ -33,7 +33,7 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.ActionServiceImplTest.CancellableSleepAction; import org.alfresco.repo.action.ActionServiceImplTest.CancellableSleepAction;
import org.alfresco.repo.action.ActionServiceImplTest.SleepActionExecuter; import org.alfresco.repo.action.ActionServiceImplTest.SleepActionExecuter;
import org.alfresco.repo.action.executer.MoveActionExecuter; import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.repo.cache.EhCacheAdapter; import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.jscript.ClasspathScriptLocation; import org.alfresco.repo.jscript.ClasspathScriptLocation;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -69,6 +69,7 @@ public class ActionTrackingServiceImplTest extends TestCase
private NodeRef rootNodeRef; private NodeRef rootNodeRef;
private NodeRef nodeRef; private NodeRef nodeRef;
@SuppressWarnings("unused")
private NodeRef folder; private NodeRef folder;
private NodeService nodeService; private NodeService nodeService;
private ActionService actionService; private ActionService actionService;
@@ -76,7 +77,7 @@ public class ActionTrackingServiceImplTest extends TestCase
private TransactionService transactionService; private TransactionService transactionService;
private RuntimeActionService runtimeActionService; private RuntimeActionService runtimeActionService;
private ActionTrackingService actionTrackingService; private ActionTrackingService actionTrackingService;
private EhCacheAdapter<String, ExecutionDetails> executingActionsCache; private SimpleCache<String, ExecutionDetails> executingActionsCache;
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -87,7 +88,7 @@ public class ActionTrackingServiceImplTest extends TestCase
this.runtimeActionService = (RuntimeActionService)ctx.getBean("actionService"); this.runtimeActionService = (RuntimeActionService)ctx.getBean("actionService");
this.actionTrackingService = (ActionTrackingService)ctx.getBean("actionTrackingService"); this.actionTrackingService = (ActionTrackingService)ctx.getBean("actionTrackingService");
this.transactionService = (TransactionService)ctx.getBean("transactionService"); this.transactionService = (TransactionService)ctx.getBean("transactionService");
this.executingActionsCache = (EhCacheAdapter<String, ExecutionDetails>)ctx.getBean("executingActionsSharedCache"); this.executingActionsCache = (SimpleCache<String, ExecutionDetails>)ctx.getBean("executingActionsCache");
AuthenticationUtil.setRunAsUserSystem(); AuthenticationUtil.setRunAsUserSystem();
@@ -117,9 +118,7 @@ public class ActionTrackingServiceImplTest extends TestCase
txn.commit(); txn.commit();
// Cache should start empty each time // Cache should start empty each time
for(String key : executingActionsCache.getKeys()) { executingActionsCache.clear();
executingActionsCache.remove(key);
}
// Reset the execution instance IDs, so we // Reset the execution instance IDs, so we
// can predict what they'll be // can predict what they'll be