webMethods Microsoft Package 9.0 | webMethods Package for Microsoft .NET Documentation | webMethods Package for Microsoft .NET Installation and User’s Documentation | Using Designer with the webMethods Microsoft Package | Managing Class Lifetimes
 
Managing Class Lifetimes
 
Modifying Class Lifetime
The Class Timeout Value
.NET classes running on the CLR can maintain instance data, which are variables containing information used across multiple invocations of methods on the class. A class instance can maintain instance data according to one of four Class Lifetime settings, described in the following table. All .NET services associated with a class have the same lifetime. When you change the class lifetime for a particular .NET service, Designer modifies the lifetimes of all services associated with the same class.
In Designer, you can manage the class lifetime for a particular .NET service in the .NET Properties tab for that service. The Class Lifetime property has the following valid settings:
Lifetime Setting
Description
Global
The webMethods Microsoft Package creates a single instance of the class, or object, which has an unlimited lifetime. The class shares instance data among all sessions. Use this setting where it is appropriate to gather data to be retrieved by multiple users. You can create only one instance of a global object of a given type.
Session
The webMethods Microsoft Package creates a separate object for each user. The object exists until the user session is closed or until the object times out. The default is three minutes. See The Class Timeout Value.
Single-Use
The webMethods Microsoft Package creates and destroys an object each time a .NET service calls a method in the class. Data may be kept during the lifetime of the object.
Static
The .NET service calls a method that does not require any session data to be kept. All methods of the class are static and the webMethods Microsoft Package does not create an object.
Note:
If multiple services are using a given global object or a session object at the same time, those objects need to be thread safe.
Use the Static lifetime setting only for static methods.