[seam-commits] Seam SVN: r10907 - in branches/enterprise/JBPAPP_4_3_FP01: examples/todo/resources and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed May 13 09:08:35 EDT 2009


Author: manaRH
Date: 2009-05-13 09:08:35 -0400 (Wed, 13 May 2009)
New Revision: 10907

Modified:
   branches/enterprise/JBPAPP_4_3_FP01/build/core.pom.xml
   branches/enterprise/JBPAPP_4_3_FP01/build/root.pom.xml
   branches/enterprise/JBPAPP_4_3_FP01/build/ui.pom.xml
   branches/enterprise/JBPAPP_4_3_FP01/examples/todo/resources/jbpm.cfg.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ManagedJbpmContext.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ProcessInstance.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/TaskInstance.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/contexts/Contexts.java
Log:
JBPAPP-1883

Modified: branches/enterprise/JBPAPP_4_3_FP01/build/core.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/build/core.pom.xml	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/build/core.pom.xml	2009-05-13 13:08:35 UTC (rev 10907)
@@ -242,7 +242,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jbpm</groupId>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-jpdl</artifactId>
       <optional>true</optional>
     </dependency>

Modified: branches/enterprise/JBPAPP_4_3_FP01/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/build/root.pom.xml	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/build/root.pom.xml	2009-05-13 13:08:35 UTC (rev 10907)
@@ -247,9 +247,9 @@
 			</dependency>
 
 			<dependency>
-				<groupId>org.jbpm</groupId>
+				<groupId>org.jbpm.jbpm3</groupId>
 				<artifactId>jbpm-jpdl</artifactId>
-				<version>3.2.2.GA_SOA-P</version>
+				<version>3.2.5.SP5</version>
 			</dependency>
 
 			<dependency>

Modified: branches/enterprise/JBPAPP_4_3_FP01/build/ui.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/build/ui.pom.xml	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/build/ui.pom.xml	2009-05-13 13:08:35 UTC (rev 10907)
@@ -105,7 +105,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jbpm</groupId>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-jpdl</artifactId>
       <optional>true</optional>
       <exclusions>

Modified: branches/enterprise/JBPAPP_4_3_FP01/examples/todo/resources/jbpm.cfg.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/examples/todo/resources/jbpm.cfg.xml	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/examples/todo/resources/jbpm.cfg.xml	2009-05-13 13:08:35 UTC (rev 10907)
@@ -3,8 +3,9 @@
   <jbpm-context>
     <service name="persistence">
        <factory>
-          <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
+          <bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
              <field name="isTransactionEnabled"><false/></field>
+             <field name="isCurrentSessionEnabled"><true/></field>             
           </bean>
        </factory>
     </service>

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ManagedJbpmContext.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ManagedJbpmContext.java	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ManagedJbpmContext.java	2009-05-13 13:08:35 UTC (rev 10907)
@@ -83,6 +83,12 @@
          throw new IllegalStateException("JbpmContext may only be used inside a transaction");
       }
       
+      if (jbpmContext == null)
+      {
+         log.debug( "recreating seam managed jBPM context" );
+         jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext() ;
+      }
+       
       if ( !synchronizationRegistered && !Lifecycle.isDestroying() && transaction.isActive() )
       {
          jbpmContext.getSession().isOpen();
@@ -100,7 +106,7 @@
    
    public void beforeCompletion()
    {
-      log.debug( "flushing seam managed jBPM context" );
+      log.debug( "closing seam managed jBPM context" );
       /*org.jbpm.graph.exe.ProcessInstance processInstance = ProcessInstance.instance();
       if (processInstance!=null)
       {
@@ -113,47 +119,41 @@
          //destroyed, flush here:
          Contexts.getBusinessProcessContext().flush();
       }
-      jbpmContext.getSession().flush();
-      log.debug( "done flushing seam managed jBPM context" );
+      closeContext();
+      log.debug( "closed seam managed jBPM context" );
    }
    
    public void afterCompletion(int status) 
    {
       synchronizationRegistered = false;
-      if ( !Contexts.isEventContextActive() )
-      {
-         //in calls to MDBs and remote calls to SBs, the 
-         //transaction doesn't commit until after contexts
-         //are destroyed, so wait until the transaction
-         //completes before closing the session
-         //on the other hand, if we still have an active
-         //event context, leave it open
-         closeContext();
-      }
    }
    
    @Destroy
    public void destroy()
    {
-      if ( !synchronizationRegistered )
-      {
+//      if ( !synchronizationRegistered )
+//      {
          //in requests that come through SeamPhaseListener,
          //there can be multiple transactions per request,
          //but they are all completed by the time contexts
-         //are dstroyed
+         //are destroyed
          //so wait until the end of the request to close
          //the session
          //on the other hand, if we are still waiting for
          //the transaction to commit, leave it open
          closeContext();
-      }
+//      }
    }
 
    private void closeContext()
    {
-      log.debug( "destroying seam managed jBPM context" );
-      jbpmContext.close();
-      log.debug( "done destroying seam managed jBPM context" );
+      if (jbpmContext != null)
+      {
+         log.debug( "destroying seam managed jBPM context" );
+         jbpmContext.close();
+         log.debug( "done destroying seam managed jBPM context" );
+         jbpmContext = null;
+      }
    }
       
    public static JbpmContext instance()

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ProcessInstance.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ProcessInstance.java	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/ProcessInstance.java	2009-05-13 13:08:35 UTC (rev 10907)
@@ -16,7 +16,6 @@
 import org.jboss.seam.annotations.Unwrap;
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
 import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.util.Work;
 
 /**
  * A Seam component that allows injection of the current
@@ -36,26 +35,16 @@
    {
       if ( !Contexts.isConversationContextActive() ) return null;
       
-      return new Work<org.jbpm.graph.exe.ProcessInstance>()
+      Long processId = BusinessProcess.instance().getProcessId();
+      if (processId!=null)
       {
-         
-         @Override
-         protected org.jbpm.graph.exe.ProcessInstance work() throws Exception
-         {         
-            Long processId = BusinessProcess.instance().getProcessId();
-            if (processId!=null)
-            {
-               //TODO: do we need to cache this??
-               return ManagedJbpmContext.instance().getProcessInstanceForUpdate(processId);
-            }
-            else
-            {
-               return null;
-            }
-         }
-         
-      }.workInTransaction();
-      
+         //TODO: do we need to cache this??
+         return ManagedJbpmContext.instance().getProcessInstanceForUpdate(processId);
+      }
+      else
+      {
+         return null;
+      }
    }
    
    public static org.jbpm.graph.exe.ProcessInstance instance()

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/TaskInstance.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/TaskInstance.java	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/bpm/TaskInstance.java	2009-05-13 13:08:35 UTC (rev 10907)
@@ -36,25 +36,16 @@
    {
       if ( !Contexts.isConversationContextActive() ) return null;
       
-      return new Work<org.jbpm.taskmgmt.exe.TaskInstance>()
+      Long taskId = BusinessProcess.instance().getTaskId();
+      if (taskId!=null)
       {
-         
-         @Override
-         protected org.jbpm.taskmgmt.exe.TaskInstance work() throws Exception
-         {         
-            Long taskId = BusinessProcess.instance().getTaskId();
-            if (taskId!=null)
-            {
-               //TODO: do we need to cache this??
-               return ManagedJbpmContext.instance().getTaskInstanceForUpdate(taskId);
-            }
-            else
-            {
-               return null;
-            }
-         }
-         
-      }.workInTransaction();
+         //TODO: do we need to cache this??
+         return ManagedJbpmContext.instance().getTaskInstanceForUpdate(taskId);
+      }
+      else
+      {
+         return null;
+      }
    }
    
    public static org.jbpm.taskmgmt.exe.TaskInstance instance()

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/contexts/Contexts.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/contexts/Contexts.java	2009-05-13 08:55:13 UTC (rev 10906)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/contexts/Contexts.java	2009-05-13 13:08:35 UTC (rev 10907)
@@ -18,6 +18,7 @@
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.transaction.Transaction;
+import org.jboss.seam.util.Work;
 import org.jboss.seam.web.Session;
 
 /**
@@ -344,17 +345,32 @@
             
             //TODO: it would be nice if BP context spanned redirects along with the conversation
             //      this would also require changes to BusinessProcessContext
-            boolean destroyBusinessProcessContext = !Init.instance().isJbpmInstalled() ||
-                  !BusinessProcess.instance().hasActiveProcess();
-            if (destroyBusinessProcessContext)
+            try
             {
-               //TODO: note that this occurs from Lifecycle.endRequest(), after
-               //      the Seam-managed txn was committed, but Contexts.destroy()
-               //      calls BusinessProcessContext.getNames(), which hits the
-               //      database!
-               log.debug("destroying business process context");
-               destroy( getBusinessProcessContext() );
+               new Work<Object>()
+               {
+                  @Override
+                  protected Object work() throws Exception
+                  {
+                     boolean destroyBusinessProcessContext = !Init.instance().isJbpmInstalled() ||
+                           !BusinessProcess.instance().hasActiveProcess();
+                     if (destroyBusinessProcessContext)
+                     {
+                        //TODO: note that this occurs from Lifecycle.endRequest(), after
+                        //      the Seam-managed txn was committed, but Contexts.destroy()
+                        //      calls BusinessProcessContext.getNames(), which hits the
+                        //      database!
+                        log.debug("destroying business process context");
+                        destroy( getBusinessProcessContext() );
+                     }
+                     return null;
+                  }
+               }.workInTransaction();
             }
+            catch (final Exception ex)
+            {
+               log.warn("Exception destroying context ", ex);
+            }
          }
    
          if ( !Manager.instance().isLongRunningConversation() )




More information about the seam-commits mailing list