mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged V2.2 to HEAD
8514: Updated clusterd cach example - ACL changes, attributes, AVM and minor fix ups 8522: Fix for AR-1694 8587: Merged V2.1 to V2.2 8575: Fix for AR-2166 "Display of tasks in MyAlfresco dashboard broken when using oracle" 8617: AVMTestRemote - fix test/data 8632: Merged V2.1 to V2.2 8623: Fixed AR-2122: Code re-entry paths through transaction resource interceptor cause data loss 8624: Fixed test associated with session resource management fixes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9169 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -51,13 +51,18 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
* This class supports both interceptor-based calling as well as manual calling.
|
||||
* Long-running processes can call an this manually on every iteration and
|
||||
* get the same behaviour of regular calls to the resouce managers.
|
||||
* <p>
|
||||
* The current thread is marked on first entry and all subsequent nested re-entries
|
||||
* will just get passed down to the underlying delegate invocation method.
|
||||
*
|
||||
* @see org.alfresco.util.resource.MethodResourceManager
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public class TransactionResourceInterceptor implements MethodInterceptor
|
||||
public class SingleEntryTransactionResourceInterceptor implements MethodInterceptor
|
||||
{
|
||||
private ThreadLocal<Boolean> threadLocalReentryCheck;
|
||||
private List<MethodResourceManager> methodResourceManagers;
|
||||
/** Default 10000ms (10s) */
|
||||
private long elapsedTimeBeforeActivationMillis = 10000L;
|
||||
@@ -72,9 +77,10 @@ public class TransactionResourceInterceptor implements MethodInterceptor
|
||||
*/
|
||||
private String resourceKey;
|
||||
|
||||
public TransactionResourceInterceptor()
|
||||
public SingleEntryTransactionResourceInterceptor()
|
||||
{
|
||||
resourceKey = "MethodStats" + super.toString();
|
||||
threadLocalReentryCheck = new ThreadLocal<Boolean>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,12 +121,31 @@ public class TransactionResourceInterceptor implements MethodInterceptor
|
||||
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable
|
||||
{
|
||||
if (methodResourceManagers == null || methodResourceManagers.size() == 0)
|
||||
if (threadLocalReentryCheck.get() == Boolean.TRUE)
|
||||
{
|
||||
// We're already in a wrapped resource, so avoid doing anything
|
||||
return invocation.proceed();
|
||||
}
|
||||
else if (methodResourceManagers == null || methodResourceManagers.size() == 0)
|
||||
{
|
||||
// We just ignore everything
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Mark this thread
|
||||
threadLocalReentryCheck.set(Boolean.TRUE);
|
||||
return invokeInternal(invocation);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Unmark this thread
|
||||
threadLocalReentryCheck.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Object invokeInternal(MethodInvocation invocation) throws Throwable
|
||||
{
|
||||
// Get the txn start time
|
||||
long txnStartTime = AlfrescoTransactionSupport.getTransactionStartTime();
|
||||
if (txnStartTime < 0)
|
Reference in New Issue
Block a user