To run the demonstration:
- Open the Web site and browse to the demo files, located in
%ProgramFiles(x86)%\Micro Focus\Studio Enterprise Edition x.x\Examples\Visual Studio Integration\MultiRunUnits by default.
- Build the Web site.
- Start the Web Service by clicking
Debug >
Start Without Debugging and then clicking
service.asmx.
- Start a second Web Service in the same way.
- Click
AddTwoNumbers in both browsers.
- In one browser, enter 1 as the first operand and anything as the second operand.
- In the second browser, enter any operands (except 1) in each field.
To see the data being shared incorrectly, enter
False in the
UsingMultiRunUnits field, in both browsers. Click
Invoke in the browser where you entered 1, and then click
Invoke in the second browser. The first result to come back is correct, but the other result is the same as the first, which is wrong. Here's what happens:
- The first instance creates a default run unit and sends its data to that run unit and waits.
- The second instance uses the default run unit and in doing so, it overwrites the data in the default run unit.
- The second instance adds the two numbers and returns the correct result.
- When the first instance finishes waiting, it uses the default run unit and adds the two numbers, which are now those from the second instance. It returns the wrong result, the result for the second instance.
Now repeat the demonstration, but this time enter
True in the first field. The correct results are returned. Here's what happens:
- The first instance creates its own run unit and sends its data to that run unit and waits.
- The second instance creates another own run unit and sends its data to its own run unit.
- The second instance adds the two numbers and returns the correct result.
- When the first instance finishes waiting, it uses its own run unit. It adds the correct two numbers and returns the correct result.