Previous Topic Next topic Print topic


Run the MultiRunUnits Demonstration

To run the demonstration:

  1. Open the Web site and browse to the demo files, located in %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\MultiRunUnits by default.
  2. Build the Web site.
  3. Start the Web Service by clicking Debug > Start Without Debugging and then clicking service.asmx.
  4. Start a second Web Service in the same way.
  5. Click AddTwoNumbers in both browsers.
  6. In one browser, enter 1 as the first operand and anything as the second operand.
  7. 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:

  1. The first instance creates a default run unit and sends its data to that run unit and waits.
  2. The second instance uses the default run unit and in doing so, it overwrites the data in the default run unit.
  3. The second instance adds the two numbers and returns the correct result.
  4. 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:

  1. The first instance creates its own run unit and sends its data to that run unit and waits.
  2. The second instance creates another own run unit and sends its data to its own run unit.
  3. The second instance adds the two numbers and returns the correct result.
  4. When the first instance finishes waiting, it uses its own run unit. It adds the correct two numbers and returns the correct result.
Previous Topic Next topic Print topic