-
Notifications
You must be signed in to change notification settings - Fork 1
Instanciation Control
rfernandes edited this page Mar 9, 2013
·
1 revision
The instanciation control mecanism defines the strategy used over the instance of the object that performs the operation execution. The same programming model is used with either */RPC-SOAP and REST webservices.
For each request a new instance os the class that provides it is created.
A single instance is used to answer multiple requests. This instance is construct as soon as the application server is up.
Similar to singleton, but the instance is created only upon the first call of a operation it provides.
To define the instantiation strategy define the InstantiationStrategyType typedef within the target class to one of the types in answer::instanciation. As an example we could define the calculator example as a singleton by declarating:
class MyService{
public:
CalculatorResponse calculator(const CalculatorRequest &request);
typedef answer::instanciation::LazySingleton InstantiationStrategyType;
};