cancel
Showing results for 
Search instead for 
Did you mean: 

ActionExecuter and transaction

zomurn
Champ in-the-making
Champ in-the-making
Hello,

I coded an action executer which does a heavy process : move thousands of documents from one folder to another.
I'd like to know how this process run "transactionaly speaking".
I know that the fileFolderService.move() is executed inside a REQUIRED transaction (creates if no one is existing otherwise do the job inside the existing one)
I know that the ActionExecuter Interface is executed itself inside a similar transaction : it is coded like this in alfresco API.
Consequently, I suppose that my heavy process remains all in memory or cached in a file on hard disk.
At the end of the method executeImpl() of my custom action executer, no logs appears anymore so.
But In fact, a heavy underneath process is running : the commit of the transaction which can be long.

So How do I know how much time the commit take ? Because I stopped the server believing that the heavy process was ended (through logs) but in fact no.
And a big error stack trace appears when shuting down the server : cache is not alive !

14:14:48,711 User:System INFO  [james.imapserver.JamesServerContext] Closing com.opsera.omm.james.imapserver.JamesServerContext@14aad5eb: display name [com.opsera.omm.james.imapserver.JamesServerContext@14aad5eb]; startup date [Sat Feb 20 12:30:10 CET 2010]; parent: org.alfresco.config.JBossEnabledWebApplicationContext@5289e2f1
14:14:48,966  ERROR [quartz.core.JobRunShell] Job DEFAULT.ftsIndexerJobDetail threw an unhandled Exception:
java.lang.IllegalStateException: The org.alfresco.cache.uriToModelsCache Cache is not alive.
   at net.sf.ehcache.Cache.checkStatus(Cache.java:1588)
   at net.sf.ehcache.Cache.get(Cache.java:774)
   at net.sf.ehcache.Cache.get(Cache.java:755)
   at org.alfresco.repo.cache.EhCacheAdapter.get(EhCacheAdapter.java:87)
   at org.alfresco.repo.cache.TransactionalCache.get(TransactionalCache.java:348)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getUriToModels(DictionaryDAOImpl.java:977)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getModelsForUri(DictionaryDAOImpl.java:377)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getProperty(DictionaryDAOImpl.java:644)
   at org.alfresco.repo.dictionary.DictionaryComponent.getProperty(DictionaryComponent.java:345)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.indexProperty(ADMLuceneIndexerImpl.java:800)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.createDocuments(ADMLuceneIndexerImpl.java:605)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.updateFullTextSearch(ADMLuceneIndexerImpl.java:1540)
   at org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl.index(FullTextSearchIndexerImpl.java:188)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy33.index(Unknown Source)
   at org.alfresco.repo.search.impl.lucene.fts.FTSIndexerJob.execute(FTSIndexerJob.java:52)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
14:14:48,967  ERROR [quartz.core.ErrorLogger] Job (DEFAULT.ftsIndexerJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.IllegalStateException: The org.alfresco.cache.uriToModelsCache Cache is not alive.]
   at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: java.lang.IllegalStateException: The org.alfresco.cache.uriToModelsCache Cache is not alive.
   at net.sf.ehcache.Cache.checkStatus(Cache.java:1588)
   at net.sf.ehcache.Cache.get(Cache.java:774)
   at net.sf.ehcache.Cache.get(Cache.java:755)
   at org.alfresco.repo.cache.EhCacheAdapter.get(EhCacheAdapter.java:87)
   at org.alfresco.repo.cache.TransactionalCache.get(TransactionalCache.java:348)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getUriToModels(DictionaryDAOImpl.java:977)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getModelsForUri(DictionaryDAOImpl.java:377)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.getProperty(DictionaryDAOImpl.java:644)
   at org.alfresco.repo.dictionary.DictionaryComponent.getProperty(DictionaryComponent.java:345)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.indexProperty(ADMLuceneIndexerImpl.java:800)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.createDocuments(ADMLuceneIndexerImpl.java:605)
   at org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl.updateFullTextSearch(ADMLuceneIndexerImpl.java:1540)
   at org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl.index(FullTextSearchIndexerImpl.java:188)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy33.index(Unknown Source)
   at org.alfresco.repo.search.impl.lucene.fts.FTSIndexerJob.execute(FTSIndexerJob.java:52)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   … 1 more
This error comes from ehCache (hibernate ?)

After that, my DB was corrupted, I needed to restore.
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
Transactionally speaking the ActionExecutor will execute the action within your current transaction context.   Except for the case where the action is being executed asynchronously in which case the async action will be in its own transaction which will start after the current transaction commits.

There may also be further work, like indexing, which follow your successful action.   The exception below is from the indexer.

zomurn
Champ in-the-making
Champ in-the-making
OK, so after my heaving process, how do we know the amount of time the indexer takes ?
1hour ? 1night ?
I can't stay on the production site for so long….
I need to have an approximation, like the copy/paste from an OS Smiley Happy.