For primitive and singleton, addEventRegistration simply uses reflectiont o look up the adder method for the named event set and invokes it.
For threaded and pooled its more complicated. The *first* time the service is constructed, the service model will store the sources and event sets. After the service implementation is constructed, it will construct a proxy that implements all the necessary event listener methods and delegates them to the thread-specific instance. This event listener proxy is similar to the proxy that implements the service implementation; it invokes a method on the ServiceModel that provides the CSI for the current thread (creating it if necessary). Subsequently, the service model will ignore the addEventRegistration() methods, because the proxy already exists and is in place as a listener. Its a little baroque but I think it is the right path. On Thu, 28 Oct 2004 10:14:49 +0200, Knut Wannheden <[EMAIL PROTECTED]> wrote: > On Wed, 27 Oct 2004 08:05:05 -0400, Howard Lewis Ship <[EMAIL PROTECTED]> > wrote: > > As I've been thinking about getting events to work propertly for > > threaded and pooled services, I've realized that the ServiceModel > > should be involved in event registration. I.e. > > > > void addEventRegistration(Object source, String eventSetName) > > > > Sounds good. Would this be a new method on the ServiceModel > interface? Who would be responsible for invoking it? > > > The service model would then be responsible for registering the core > > service implementation with the given source and even set after it is > > created. For primtive/singleton it will simply perform the > > registrations. For threaded/pooled it will create a proxy (the first > > time) that obtains the CSI and delegates to it. When we implement > > prototype, it will log an error and ignore the event registration > > (prototype services are to ephemeral for service registrations). > > > > Didn't quite understand how this would work with the threaded and > pooled models... > > --knut > -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator, Jakarta Tapestry Creator, Jakarta HiveMind http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
