openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1806334 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
Date Sat, 26 Aug 2017 21:41:36 GMT
Author: struberg
Date: Sat Aug 26 21:41:36 2017
New Revision: 1806334

URL: http://svn.apache.org/viewvc?rev=1806334&view=rev
Log:
OWB-1211 fire BeforeDestroyed event

txs to johndament for the report and initial patch!
Applied with improvements.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java?rev=1806334&r1=1806333&r2=1806334&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
Sat Aug 26 21:41:36 2017
@@ -31,6 +31,7 @@ import javax.enterprise.context.SessionS
 import javax.enterprise.context.spi.Context;
 import javax.inject.Singleton;
 
+import org.apache.webbeans.annotation.BeforeDestroyedLiteral;
 import org.apache.webbeans.annotation.DestroyedLiteral;
 import org.apache.webbeans.annotation.InitializedLiteral;
 import org.apache.webbeans.config.WebBeansContext;
@@ -370,6 +371,9 @@ public class DefaultContextsService exte
     {
         if(applicationContext != null && !applicationContext.isDestroyed())
         {
+            webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+                    new Object(), BeforeDestroyedLiteral.INSTANCE_APPLICATION_SCOPED);
+
             applicationContext.destroy();
 
             // this is needed to get rid of ApplicationScoped beans which are cached inside
the proxies...
@@ -402,7 +406,8 @@ public class DefaultContextsService exte
             conversationContext.remove();
         }
 
-
+        webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+                new Object(), BeforeDestroyedLiteral.INSTANCE_REQUEST_SCOPED);
         if(requestContext.get() != null)
         {
             requestContext.get().destroy();   
@@ -418,6 +423,8 @@ public class DefaultContextsService exte
     
     private void stopSessionContext()
     {
+        webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+                new Object(), BeforeDestroyedLiteral.INSTANCE_SESSION_SCOPED);
         if(sessionContext.get() != null)
         {
             sessionContext.get().destroy();   
@@ -433,6 +440,8 @@ public class DefaultContextsService exte
     
     private void stopSingletonContext()
     {
+        webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+            new Object(), BeforeDestroyedLiteral.INSTANCE_SINGLETON_SCOPED);
         if(singletonContext.get() != null)
         {
             singletonContext.get().destroy();   



Mime
View raw message