Skip to content

Commit d6e8494

Browse files
corrected bug wrt incoming flows and gateways executing without proper conditions being met.
1 parent 46c6614 commit d6e8494

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
lines changed

BpmEngine.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
<TargetFrameworks>netstandard2.0;net452;net20</TargetFrameworks>
55
<RootNamespace>Org.Reddragonit.BpmEngine</RootNamespace>
66
<PackageId>Org.Reddragonit.BpmEngine</PackageId>
7-
<Version>1.9.9</Version>
7+
<Version>1.9.10</Version>
88
<Authors>Roger Castaldo</Authors>
99
<Description>A BPMN Engine written in .net. The engine attempts to read in a bpmn notation xml document defining both the process(s) as well as the diagrams. From here you can then load/unload the state, render the diagram in its current state or animated into a gif. Using the delegates for a process, you intercept and handle task and condition checking by reading additional xml held within flow and task objects.</Description>
1010
<PackageProjectUrl>https://github.com/roger-castaldo/BPMEngine</PackageProjectUrl>
1111
<PackageLicenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</PackageLicenseUrl>
1212
<RepositoryUrl>https://github.com/roger-castaldo/BPMEngine</RepositoryUrl>
1313
<PackageTags>BPMN</PackageTags>
14-
<PackageReleaseNotes>updated package to use a single control thread for the time delays in all business processes instead of multiple threads per process</PackageReleaseNotes>
15-
<AssemblyVersion>1.9.9.0</AssemblyVersion>
16-
<FileVersion>1.9.9.0</FileVersion>
14+
<PackageReleaseNotes>updated to correct bug wrt not dealing with gateways properly for the incoming paths.</PackageReleaseNotes>
15+
<AssemblyVersion>1.9.10.0</AssemblyVersion>
16+
<FileVersion>1.9.10.0</FileVersion>
1717
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1818
</PropertyGroup>
1919

BusinessProcess.cs

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,30 +1149,38 @@ private void _ProcessElement(string sourceID,IElement elem)
11491149
}
11501150
}
11511151
}
1152+
bool gatewayComplete = false;
11521153
lock (_state)
11531154
{
1154-
_state.Path.StartGateway(gw, sourceID);
1155-
}
1156-
if (_onGatewayStarted != null)
1157-
_onGatewayStarted(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state,this));
1158-
string[] outgoings = null;
1159-
try
1160-
{
1161-
outgoings = gw.EvaulateOutgoingPaths(def, _isFlowValid, new ProcessVariablesContainer(elem.id, _state,this));
1162-
}
1163-
catch (Exception e)
1164-
{
1165-
WriteLogException(new StackFrame(1, true), DateTime.Now, e);
1166-
if (_onGatewayError != null)
1167-
_onGatewayError(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state,this));
1168-
outgoings = null;
1155+
if (gw.IsIncomingFlowComplete(sourceID, _state.Path))
1156+
{
1157+
gatewayComplete = true;
1158+
_state.Path.StartGateway(gw, sourceID);
1159+
}
11691160
}
1170-
lock (_state)
1161+
if (gatewayComplete)
11711162
{
1172-
if (outgoings == null)
1173-
_state.Path.FailGateway(gw);
1174-
else
1175-
_state.Path.SuccessGateway(gw, outgoings);
1163+
if (_onGatewayStarted != null)
1164+
_onGatewayStarted(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state, this));
1165+
string[] outgoings = null;
1166+
try
1167+
{
1168+
outgoings = gw.EvaulateOutgoingPaths(def, _isFlowValid, new ProcessVariablesContainer(elem.id, _state, this));
1169+
}
1170+
catch (Exception e)
1171+
{
1172+
WriteLogException(new StackFrame(1, true), DateTime.Now, e);
1173+
if (_onGatewayError != null)
1174+
_onGatewayError(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state, this));
1175+
outgoings = null;
1176+
}
1177+
lock (_state)
1178+
{
1179+
if (outgoings == null)
1180+
_state.Path.FailGateway(gw);
1181+
else
1182+
_state.Path.SuccessGateway(gw, outgoings);
1183+
}
11761184
}
11771185
}
11781186
else if (elem is AEvent)

Utility.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static Utility()
3434
_backgroundMREEvent = new ManualResetEvent(true);
3535
_suspendedEvents = new List<sProcessSuspendEvent>();
3636
_backgroundSuspendThread = new Thread(new ThreadStart(_BackgroundSuspendStart));
37+
_backgroundSuspendThread.Name = "Background Suspend Thread";
3738
_backgroundSuspendThread.IsBackground = true;
3839
_backgroundSuspendThread.Start();
3940
_xmlConstructors = new Dictionary<Type, ConstructorInfo>();

0 commit comments

Comments
 (0)