Differences between revisions 1 and 2
Revision 1 as of 2005-01-21 03:12:40
Size: 1419
Editor: CPE-61-9-201-26
Comment: Migrated page.
Revision 2 as of 2009-09-20 22:00:04
Size: 1419
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Turbine 2.x User's Guide: What Is A Service?

Services are singletons within the Turbine Framework which have pluggable implementation, and are capable of participating in the Turbine startup and shutdown. As Services are Singletons, there is only one instance of each service in the system. Memory or connections are allocated only once and the internal state is common to all requesting clients. A Service that is never used will not allocate resources to itself. A Service can also execute actions upon the system being shutdown, such as closing open connections.

Services are configurable accessing ServletConfig and TurbineResouces.properties at startup. Uses might include setting paths, defaults and similar functionality. They also access RunData on the first Turbine doGet execution to get the environment Turbine is operating within. Services can also initialize themselves before they are requested by the client for the first time.

The Singleton pattern also allows for the Services to be accessed from anywhere within your code, which is were the real power of Services comes in to play. As separate, testable entities, Services should contain all business logic so that screens and actions may become as thin as possible. Further, business and application logic can be separted in an effort to cleanly decouple application components.

Turbine2/UsersGuide/Services (last edited 2009-09-20 22:00:04 by localhost)