fixed SPRNET-1158
This commit is contained in:
@@ -87,6 +87,30 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the current call is executed under control of an AOP proxy.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Will be <cref lang="null"/> unless the
|
||||
/// <see cref="Spring.Aop.Framework.ProxyConfig.ExposeProxy"/> property
|
||||
/// on the controlling proxy has been set to <see langword="true"/>.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// The default value for the
|
||||
/// <see cref="Spring.Aop.Framework.ProxyConfig.ExposeProxy"/> property
|
||||
/// is <see langword="false"/>, for performance reasons.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
public static bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
Stack proxyStack = LogicalThreadContext.GetData(CURRENTPROXY_SLOTNAME) as Stack;
|
||||
return (proxyStack != null && proxyStack.Count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current AOP proxy.
|
||||
/// </summary>
|
||||
|
||||
@@ -85,6 +85,16 @@ namespace Spring.Aop.Framework
|
||||
AopContext.PopProxy();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsActiveMatchesStackState()
|
||||
{
|
||||
Assert.IsFalse(AopContext.IsActive);
|
||||
AopContext.PushProxy("Foo");
|
||||
Assert.IsTrue(AopContext.IsActive);
|
||||
AopContext.PopProxy();
|
||||
Assert.IsFalse(AopContext.IsActive);
|
||||
}
|
||||
|
||||
#region CurrentProxyIsThreadSafe
|
||||
|
||||
[Test(Description = "http://opensource.atlassian.com/projects/spring/browse/SPRNET-341")]
|
||||
|
||||
Reference in New Issue
Block a user