Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Gloop Concurrent Icon

Concurrent

The Concurrent Step is used to run parts of your Gloop code in separate threads. It behaves differently depending on whether your service is being debugged and whether the Asynchronous property of the step is true or false.

When Gloop is debugging a service, nothing happens concurrently. This is to make debugging Gloop Services easier.

When Gloop is running (not debugging) and Asynchronous is false, then all children of the step will run in separate threads, but the Concurrent Step will wait for all of its children to complete. This is particularly useful if you have some long running parts in your code. A good example of this is an integration need to make multiple HTTP or database calls. By putting them under a Concurrent Step, they can all run at the same time, and Gloop will continue once they're all done. Output variables from the steps that are run concurrently in this mode are accessible in steps after the Concurrent Step (since the Concurrent Step waits for them all to complete). The last exception that is thrown (if any are thrown at all) in any of the children will be caught, and the Concurrent Step will re-throw it.

A sample Gloop Service using a Concurrent Step

A sample Gloop Service using a Concurrent Step

In the example code above, Gloop will execute lines 4-7 in separate threads, and then continue to line 9 after all the steps in lines 4-7 have completed.

When Gloop is running (not debugging) and Asynchronous is true, then all children of the step will run in sequence in a separate thread, and the Concurrent Step will not wait for all of its children to complete. Outputs from the children of the Concurrent Step cannot be used (since Gloop doesn't wait for them to complete). Exceptions that are thrown by any of the children of the Concurrent Step are logged, but not thrown.

A sample Gloop Service using an asynchronous Concurrent Step

A sample Gloop Service using an asynchronous Concurrent Step

In the example code above, Gloop will execute lines 4-7 in a separate thread, and then continue to line 9 instantly.

Asynchronous badge icon

When a Concurrent Step has an Asynchronous value of true, the icon will have a small green thread badge The asynchronous Concurrent Step badge