Author: struberg
Date: Fri Aug 24 10:18:19 2018
New Revision: 1838809
URL: http://svn.apache.org/viewvc?rev=1838809&view=rev
Log:
OWB-1254 properly fire BeforeDestroyed events in WebContextsService
Modified:
openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Modified:
openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java?rev=1838809&r1=1838808&r2=1838809&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
(original)
+++
openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Fri Aug 24 10:18:19 2018
@@ -411,7 +411,6 @@ public class WebContextsService extends
if (context.getPropagatedSessionContext() != null)
{
SessionContext sessionContext =
context.getPropagatedSessionContext();
- sessionContext.destroy();
Object payload = null;
if (context.getServletRequest() != null)
@@ -425,6 +424,11 @@ public class WebContextsService extends
}
webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+ payload != null ? payload : new Object(),
BeforeDestroyedLiteral.INSTANCE_SESSION_SCOPED);
+
+ sessionContext.destroy();
+
+ webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
payload != null ? payload : new Object(),
DestroyedLiteral.INSTANCE_SESSION_SCOPED);
}
@@ -558,7 +562,11 @@ public class WebContextsService extends
|| requestContext.getServletRequest().getSession(false) == null
|| sessionIsExpiring)
{
+ webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+ session != null ? session : new Object(),
BeforeDestroyedLiteral.INSTANCE_SESSION_SCOPED);
+
context.destroy();
+
webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
session != null ? session : new Object(),
DestroyedLiteral.INSTANCE_SESSION_SCOPED);
@@ -675,9 +683,13 @@ public class WebContextsService extends
{
if (singletonContext != null)
{
+ Object payload = endObject != null ? endObject : new Object();
+ webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+ payload, BeforeDestroyedLiteral.INSTANCE_SINGLETON_SCOPED);
+
singletonContext.destroy();
+
singletonContext = null;
- Object payload = endObject != null ? endObject : new Object();
webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
payload, DestroyedLiteral.INSTANCE_SINGLETON_SCOPED);
}