Edgewall Software

Changes between Version 24 and Version 25 of TracDev/ComponentArchitecture


Ignore:
Timestamp:
Nov 21, 2010, 7:43:05 PM (13 years ago)
Author:
Sebastian Krysmanski <sebastian@…>
Comment:

Clarified that components are singletons within a component manager - not within a process

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/ComponentArchitecture

    v24 v25  
    181181First of all, let's repeat the basic rules for components:
    182182
    183   ''Components are singletons. They should be '''stateless'''.''
    184 
    185 This means each component only exists once (within a single process). It's designed to be reused for multiple - possibly concurrent - web request. So it can't (read: should not) store information from one request in its class members and reuse this information in the next request.
     183  ''There is only '''one active instance''' of any component per component manager. They should be '''stateless'''.''
     184
     185This means that within the same component manager instance (usually `trac.env.Environment()`) components can be considered singletons. Components need to be implemented to be reused for multiple - possibly concurrent - web request. So they can't (read: should not) store information from one request in their class members and reuse this information in the next request.
    186186
    187187Now, the following list describes the stages a component goes through until it's ready to be used: