Author: sb Date: Fri Nov 30 18:51:27 2007 New Revision: 6897 Log: - Fix issue #12144: Resuming from synchronization of parallel split fails.
Modified: trunk/Workflow/ChangeLog trunk/Workflow/src/interfaces/node_merge.php trunk/Workflow/src/nodes/control_flow/discriminator.php trunk/Workflow/src/nodes/control_flow/simple_merge.php trunk/Workflow/src/nodes/control_flow/synchronization.php trunk/WorkflowEventLogTiein/tests/data/MultiChoiceSynchronizingMerge.log trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization.log Modified: trunk/Workflow/ChangeLog ============================================================================== --- trunk/Workflow/ChangeLog [iso-8859-1] (original) +++ trunk/Workflow/ChangeLog [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -1,3 +1,6 @@ +- Fixed issue #12144: Resuming from synchronization of parallel split fails. + + 1.1beta1 - Wednesday 28 November 2007 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Modified: trunk/Workflow/src/interfaces/node_merge.php ============================================================================== --- trunk/Workflow/src/interfaces/node_merge.php [iso-8859-1] (original) +++ trunk/Workflow/src/interfaces/node_merge.php [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -48,17 +48,24 @@ { $parentThreadId = $execution->getParentThreadId( $threadId ); - foreach ( $this->state as $oldThreadId ) + if ( $this->state['siblings'] == -1 ) { - if ( $parentThreadId != $execution->getParentThreadId( $oldThreadId ) ) + $this->state['siblings'] = $execution->getNumSiblingThreads( $threadId ); + } + else + { + foreach ( $this->state['threads'] as $oldThreadId ) { - throw new ezcWorkflowExecutionException( - 'Cannot synchronize threads that were started by different branches.' - ); + if ( $parentThreadId != $execution->getParentThreadId( $oldThreadId ) ) + { + throw new ezcWorkflowExecutionException( + 'Cannot synchronize threads that were started by different branches.' + ); + } } } - $this->state[] = $threadId; + $this->state['threads'][] = $threadId; } /** @@ -69,7 +76,7 @@ */ protected function doMerge( ezcWorkflowExecution $execution ) { - foreach ( $this->state as $threadId ) + foreach ( $this->state['threads'] as $threadId ) { $execution->endThread( $threadId ); } @@ -85,7 +92,7 @@ */ protected function initState() { - $this->state = array(); + $this->state = array( 'threads' => array(), 'siblings' => -1 ); } } ?> Modified: trunk/Workflow/src/nodes/control_flow/discriminator.php ============================================================================== --- trunk/Workflow/src/nodes/control_flow/discriminator.php [iso-8859-1] (original) +++ trunk/Workflow/src/nodes/control_flow/discriminator.php [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -58,7 +58,7 @@ $this->prepareActivate( $execution, $threadId ); $this->setThreadId( $execution->getParentThreadId( $threadId ) ); - $numActivated = count( $this->state ); + $numActivated = count( $this->state['threads'] ); if ( $numActivated == 1 ) { Modified: trunk/Workflow/src/nodes/control_flow/simple_merge.php ============================================================================== --- trunk/Workflow/src/nodes/control_flow/simple_merge.php [iso-8859-1] (original) +++ trunk/Workflow/src/nodes/control_flow/simple_merge.php [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -69,9 +69,9 @@ { $parentThreadId = $execution->getParentThreadId( $threadId ); - if ( empty( $this->state ) ) + if ( empty( $this->state['threads'] ) ) { - $this->state[] = $threadId; + $this->state['threads'][] = $threadId; parent::activate( $execution, $activatedFrom, $parentThreadId ); } Modified: trunk/Workflow/src/nodes/control_flow/synchronization.php ============================================================================== --- trunk/Workflow/src/nodes/control_flow/synchronization.php [iso-8859-1] (original) +++ trunk/Workflow/src/nodes/control_flow/synchronization.php [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -39,13 +39,7 @@ public function activate( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, $threadId = 0 ) { $this->prepareActivate( $execution, $threadId ); - - $parentThreadId = $execution->getParentThreadId( $threadId ); - - if ( count( $this->state ) == $execution->getNumSiblingThreads( $threadId ) ) - { - parent::activate( $execution, $activatedFrom, $parentThreadId ); - } + parent::activate( $execution, $activatedFrom, $execution->getParentThreadId( $threadId ) ); } /** @@ -56,7 +50,14 @@ */ public function execute( ezcWorkflowExecution $execution ) { - return $this->doMerge( $execution ); + if ( count( $this->state['threads'] ) == $this->state['siblings'] ) + { + return $this->doMerge( $execution ); + } + else + { + return false; + } } } ?> Modified: trunk/WorkflowEventLogTiein/tests/data/MultiChoiceSynchronizingMerge.log ============================================================================== --- trunk/WorkflowEventLogTiein/tests/data/MultiChoiceSynchronizingMerge.log [iso-8859-1] (original) +++ trunk/WorkflowEventLogTiein/tests/data/MultiChoiceSynchronizingMerge.log [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -14,9 +14,9 @@ MMM DD HH:MM:SS [Debug] [default] [default] Started thread #3 (3 sibling(s)) for execution #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Activated node #8(ezcWorkflowNodeAction) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #3(ezcWorkflowNodeMultiChoice) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). +MMM DD HH:MM:SS [Debug] [default] [default] Activated node #5(ezcWorkflowNodeSynchronizingMerge) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #4(ezcWorkflowNodeAction) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #7(ezcWorkflowNodeAction) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). -MMM DD HH:MM:SS [Debug] [default] [default] Activated node #5(ezcWorkflowNodeSynchronizingMerge) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #8(ezcWorkflowNodeAction) for instance #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #1 for execution #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #2 for execution #1 of workflow "MultiChoiceSynchronizingMerge" (version 1). Modified: trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization.log ============================================================================== --- trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization.log [iso-8859-1] (original) +++ trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization.log [iso-8859-1] Fri Nov 30 18:51:27 2007 @@ -10,9 +10,9 @@ MMM DD HH:MM:SS [Debug] [default] [default] Started thread #3 (3 sibling(s)) for execution #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Activated node #7(ezcWorkflowNodeAction) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). +MMM DD HH:MM:SS [Debug] [default] [default] Activated node #4(ezcWorkflowNodeSynchronization) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #3(ezcWorkflowNodeAction) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #6(ezcWorkflowNodeAction) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). -MMM DD HH:MM:SS [Debug] [default] [default] Activated node #4(ezcWorkflowNodeSynchronization) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Executed node #7(ezcWorkflowNodeAction) for instance #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #1 for execution #1 of workflow "ParallelSplitSynchronization" (version 1). MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #2 for execution #1 of workflow "ParallelSplitSynchronization" (version 1). -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components