You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/01/12 18:48:47 UTC
svn commit: r898439 - in
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
context/AbstractContext.java conversation/ConversationManager.java
Author: struberg
Date: Tue Jan 12 17:48:47 2010
New Revision: 898439
URL: http://svn.apache.org/viewvc?rev=898439&view=rev
Log:
OWB-224 destroy() our @ConversationScoped contextual instances on a Conversation timeout, if the session closes and if the app server stops
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java?rev=898439&r1=898438&r2=898439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java Tue Jan 12 17:48:47 2010
@@ -220,7 +220,6 @@
//Destroy instance
destroyInstance((Contextual<Object>) component, instance, cc);
-
}
//Clear cache
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java?rev=898439&r1=898438&r2=898439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java Tue Jan 12 17:48:47 2010
@@ -41,7 +41,7 @@
private Map<Conversation, ConversationContext> conversations = new ConcurrentHashMap<Conversation, ConversationContext>();
/**
- * Creates new conversation maanger
+ * Creates new conversation manager
*/
public ConversationManager()
{
@@ -118,7 +118,6 @@
}
return null;
-
}
/**
@@ -138,6 +137,10 @@
conv = (ConversationImpl) it.next();
if (conv.getSessionId().equals(sessionId))
{
+ ConversationContext ctx = getConversationContext(conv);
+ if (ctx != null) {
+ ctx.destroy();
+ }
it.remove();
}
}
@@ -175,6 +178,10 @@
{
if ((System.currentTimeMillis() - conv.getActiveTime()) > timeout)
{
+ ConversationContext ctx = getConversationContext(conv);
+ if (ctx != null) {
+ ctx.destroy();
+ }
it.remove();
}
}
@@ -186,9 +193,18 @@
*/
public void destroyAllConversations()
{
- if (conversations != null)
+ synchronized(conversations)
{
- conversations.clear();
+ if (conversations != null)
+ {
+ Map<Conversation, ConversationContext> oldConversations = conversations;
+ conversations = new ConcurrentHashMap<Conversation, ConversationContext>();
+
+ for (ConversationContext ctx : oldConversations.values()) {
+ ctx.destroy();
+ }
+ conversations.clear();
+ }
}
}
}