Merged HEAD-BUG-FIX to HEAD (4.2)

55504: Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX (4.2)
      55467: Merged V4.1.6 (4.1.6) to V4.1-BUG-FIX (4.1.7)
         55414: Speculative fix to allow retrying to proceed during concurrent node modification
          - I suspect that DB2 choosing a different connection to kick out from the other DBs
          - MNT-9598: RenditionServiceIntegrationTest failing on DB2 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55785 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2013-09-20 20:51:06 +00:00
parent 43b8974563
commit f25a37e97c

View File

@@ -52,6 +52,7 @@ import org.alfresco.repo.rendition.executer.ImageRenderingEngine;
import org.alfresco.repo.rendition.executer.ReformatRenderingEngine; import org.alfresco.repo.rendition.executer.ReformatRenderingEngine;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.coci.CheckOutCheckInService; import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockService; import org.alfresco.service.cmr.lock.LockService;
@@ -544,7 +545,7 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
*/ */
protected abstract class AbstractNodeModifyingRunnable implements Runnable protected abstract class AbstractNodeModifyingRunnable implements Runnable
{ {
protected Throwable modicationException; protected Throwable modificationException;
protected NodeRef nodeRef; protected NodeRef nodeRef;
public AbstractNodeModifyingRunnable(NodeRef nodeRef) public AbstractNodeModifyingRunnable(NodeRef nodeRef)
@@ -552,9 +553,9 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
} }
public Throwable getModicationException() public Throwable getModificationException()
{ {
return modicationException; return modificationException;
} }
protected abstract void modifyNode(NodeRef nodeRef); protected abstract void modifyNode(NodeRef nodeRef);
@@ -562,27 +563,28 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
@Override @Override
public void run() public void run()
{ {
// Try to check out the document while it's rendering RetryingTransactionCallback<Void> txnWork = new RetryingTransactionCallback<Void>()
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
{ @Override
public Void execute() throws Throwable public Void execute() throws Throwable
{ {
// Wait a sufficient time for content transformer to start // Wait a sufficient time for content transformer to start
Thread.sleep(2000); Thread.sleep(2000);
modifyNode(nodeRef);
try return null;
{ }
modifyNode(nodeRef); };
} // MNT-9598: RenditionServiceIntegrationTest failing on DB2
catch (Throwable e) // We have to give the transaction reties a chance i.e. DO NOT ABSORB EXCEPTIONS inside transaction.
{ // Retrying is standard behaviour so absorbing the exception but still testing for it is guaranteeing failure.
// Don't re-throw here or the node modification will just be retried try
modicationException = e; {
} transactionHelper.doInTransaction(txnWork);
}
return null; catch (Exception e)
} {
}); modificationException = e;
}
} }
} }
@@ -649,13 +651,12 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
// and will always succeed after the rendition is complete, but due to the // and will always succeed after the rendition is complete, but due to the
// sleep in AbstractNodeModifyingRunnable isModificationUnblocked will still // sleep in AbstractNodeModifyingRunnable isModificationUnblocked will still
// be false if there was a failure // be false if there was a failure
String message = null; if (nodeModifyingRunnable.getModificationException() != null)
if (nodeModifyingRunnable.getModicationException() != null)
{ {
message = nodeModifyingRunnable.getModicationException().getMessage(); throw new RuntimeException(
"Modification of node during long running rendition failed",
nodeModifyingRunnable.getModificationException());
} }
assertNull("Modification of node during long running rendition failed: " + message,
nodeModifyingRunnable.getModicationException());
} }
/** /**