Service reference life cycle [message #1226998] |
Fri, 03 January 2014 08:56 |
Patrick Mackinlay Messages: 10 Registered: December 2013 |
Junior Member |
|
|
Based on the standard Scout SDK pattern, my application currently has a server service for each client form. In most cases, these forms communicate with my persistence service, which handles the internal details of interacting with the data store (the data store is not SQL based, so I'm not able to use the standard SQL support). This means that each of these form handling services need a reference to the persistence service in order to do anything with it, and of course the same is true of any other services which need to interact with each other.
My question goes to the correct way to obtain the needed service reference, with respect to the service life cycle on the server. Essentially, I can see two basic options:
- Grab a reference to the dependency the first time it's needed, and hold on to it indefinitely, or
- Obtain a reference to the dependency within each service operation that requires it, and allow it to be released when the operation is completed
Which of these two options is more correct or preferred? Is there any practical impact one way or the other on a Scout application (e.g. impact on the ability to load/unload bundles at runtime, performance, or garbage collection, etc.)?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02878 seconds