A [JSup application], to support multi user, is divided into two different domains: * '''Shared''': the common part, ''system part'' of the application; in other words it is the part that does not depend of the user and that must work without a connected user (see [JSup execution modes]). A single instance of the shared domain is created for a JSup application. * '''User''': the user specific part of the application. For every user that connects to the JSup application a private instance of the User domain is created, with logic and [JSup tag|tag] values independent from the other users. For each domain, a [JSup Code|code] valid for the entire domain can be defined: * '''On startup''': a [JavaCode|JavaCode] that will be executed at the start of the domain (at the application startup, in the case of the shared domain, at the user connection in the case of the user domain). * '''While active''': a [JavaCode|JavaCode] that runs periodically while the domain is active (deprecated, better to use ''Triggered/timed'' code). * '''On shutdown''': a [JavaCode|JavaCode] that will be executed when the domain is stopped (at the application shutdown in the case of the shared domain, when the user disconnects in the case of the user domain). * '''Condition''': code associated with a condition (a [JSup Code|code] that returns true/false), for that condition you can specify what to do when the condition becomes true, while the condition is true (with execution period indicated), when the condition becomes false and while the condition is false (with indicated execution period). * '''Triggered / Timed''': code that can be executed either when the value of one or more tags changes (or is forced), or periodically every given milliseconds, or it can be scheduled at the application level (in edit mode) or it can be made available for the [JSup scheduler|scheduling] by the user (at runtime). These various modes of execution are not mutually exclusive. * '''JavaCode function''': functions written in [JavaCode|JavaCode] that can accept parameters, return a value (and even throw exceptions) and that can be called from JavaCode of the same domain (but the ''JavaCode functions'' of the ''Shared'' domain can also be made available for the ''User'' domain) or even from [JSup Math code|Math code]. They can also be called by [JSup Math code|Math code] embedded in strings, for example alarm descriptions or IOHook#Programmatically calculated items|calculated Tag I/O items]. * '''Key code''': available only int the ''User'' domain, they allow you to associate (globally throughout the application and not for a single [JSup graphic windows|window]) the pressure of a key (or a combination of keys) to the execution of a code ([JavaCode|JavaCode] typically. * '''JavaCode common''': A code written in pure Java that allows you to define global static fields or even static methods, although it is better, when possible, to use ''JavaCode functions'' for this purpose. == Shared domain == The shared domain includes: * ''shared'' '''[JSup tag|tags]''' of the variable database: ''Tools / Tag database''; * the '''communication''' with external devices (for the shared [JSup tag|tags] for where [IOHook|I/O hooks] have been defined); * the ''shared'' '''logic''': ''File / Application properties / Edit SHARED code''; * the [JSup alarm system|'''alarm''' handling]; * the variable, alarm and event '''historian''': see [JSup historian]; * the ''shared'' instance of the [JSup scheduler]; * critical section handling (used from [JavaCode] to synchronize the access to some resources or operations from different users and shared login). == User domain == Every connected user has its own private ''user domain'' instance that is independent from the other user's ''user domain''. So when a user writes a ''user'' [JSup tag|tags], the value of the same [JSup tag|tags] in the other user domains is not affected. The ''user domain'' includes: * the ''user'' '''[JSup tag|tags]''' of variable database: ''Tools / Tag database''; * the ''user'' '''logic''': ''File / Application properties / Edit USER code''; * the [JSup graphic windows|graphic '''windows'''] with their own logic: ''Window / Window properties''; * the ''user'' instance of the [JSup scheduler] (which can be used, but is unusual).