You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2009/02/22 15:22:14 UTC

svn commit: r746706 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java

Author: skitching
Date: Sun Feb 22 14:22:13 2009
New Revision: 746706

URL: http://svn.apache.org/viewvc?rev=746706&view=rev
Log:
Fix ORCHESTRA-34 : NullPointerException on timeout of ConversationContext. The ConversationWiperThread does not run inside a request, and therefore had no FrameworkAdapter, but removeAndInvalidateConversationContext tries to check the conversationContext query param. Fix this by setting up a LocalFrameworkAdapter instance for the ConversationWiperThread.

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java?rev=746706&r1=746705&r2=746706&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationWiperThread.java Sun Feb 22 14:22:13 2009
@@ -24,6 +24,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.myfaces.orchestra.conversation.basic.LogConversationMessager;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.local.LocalFrameworkAdapter;
+
 /**
  * The ConversationWiperThread will trigger the conversation timeout check.
  * <p>
@@ -93,6 +97,13 @@
 
     private void _run()
     {
+        // Set up a custom FrameworkAdapter for this thread, so other orchestra code used by this
+        // thread which expects one to exist will not throw NullPointerException.
+        FrameworkAdapter fa = new LocalFrameworkAdapter();
+        ConversationMessager conversationMessager = new LogConversationMessager();
+        fa.setConversationMessager(conversationMessager);
+        FrameworkAdapter.setCurrentInstance(fa);
+
         while (!isInterrupted())
         {
             ConversationManager[] managersArray;