JoobContexts, Sessions, and JoobConnections

Each client node has a pool of JADE sessions, providing an interface to the JADE Object Manager and JADE database.

A process thread attaches to an available JADE session by creating a JoobContext object. The thread is detached from the JADE session when the JoobContext object is disposed.

A JoobContext object interacts with a JADE session using a JoobConnection object. JoobConnection objects are typically created and disposed of automatically with their owning JoobContext object. In many scenarios, users will not have to explicitly interact with JoobConnection objects.

The C# JoobSession, JoobNode, and JoobSystem classes are the wrappers for the JADE Object Manager Process, Node, and System classes, respectively. When a JoobContext or a JoobConnection class is created for first time, the JADE Object Manager initialize process occurs and a pool of JADE Object Manager process agents is created (the default value is 10).

When your code gets a new JoobContext (depending on overload), a new JoobConnection is created, which obtains a JADE Object Manager process agent from the pool.

The JoobContext is the primary way of interacting with a process agent; for example, for retrieval of a specific instance, locking, notifications, and so on.

When the JoobContext is disposed of (explicitly or by a using block), the JADE Object Manager process agent is put back in the pool. A JoobContext provides access to the JoobSession object, if needed. It can be obtained with JoobContext.GetSystemVariables().Process to make the ObjectId available, which JoobContext.FindInstance<JoobSession>(ObjectId); can then retrieve. The grace period is the amount of time given to the process running on the node to complete and dispose of any JoobContexts before the node is terminated and the JADE Object Manager starts terminating the process agents. (The TimeSpan wait time is usually in the range 5 through 30 seconds, depending on the size and structure of your system.) For an example, see "Locking", in Chapter 7.

The C# JoobObject class (and all of its subclasses) has an ObjectId property, which is equivalent to the JADE Object Manager objects oid.