That is a nice piece of explanation. Should be part of the documentation, if it is not already.
Regards, Pierre Sent from my iPhone > On 31 aug. 2014, at 11:56, Jacopo Cappellato > <jacopo.cappell...@hotwaxmedia.com> wrote: > > >> On Aug 31, 2014, at 11:36 AM, Jacopo Cappellato >> <jacopo.cappell...@hotwaxmedia.com> wrote: >> >> a) what is the original concern of DispatchContext and of GenericDispatcher > > This comes from this old but still interesting document: > http://ofbiz.apache.org/docs/services.html > > ======================================== > *Service Dispatcher* > > The Service Dispatcher handles dispatching services to the appropriate > Service Engine where it is then invoked. There is exactly one > ServiceDispatcher for each Entity Delegator. If there are multiple delegators > in an application there will also be multiple dispatchers. The > ServiceDispatcher is accessed via a LocalDispatcher. There can be many > LocalDispatchers associated with a ServiceDispatcher. Each LocalDispatcher is > uniquely named and contains its own list of service definitions. When > creating an instance of a LocalDispatcher, a DispatchContext is also created > and passed to the ServiceEngine. > > A LocalDispatcher is associated with an application. Applications never talk > directly to the ServiceDispatcher. The LocalDispatcher contains an API for > invoking services, which are routed through the ServiceDispather. However, > applications may be running in different threads than the actual > ServiceDispatcher, so it is left to the LocalDispatcher to keep a > DispatchContext which among other things keeps a reference to the > applications classloader. > > *Dispatch Context* > > The DispatchContext is created by the LocalDispatcher upon instantiation. > This is the runtime dispatcher context. It contains necessary information to > process services for each dispatcher. This context contains the reference to > each of the service definition files, the classloader which should be used > for invocation, a reference to the delegator and its dispatcher along with a > 'bag' of user defined attributes. This context is passed on to each service > when invoked and is used by the dispatcher to determine the service's model. > > ======================================== > > Jacopo