Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342131

Summary: LifeCycleAdapterFactory violates scope of ApplicationContext
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fr.appel
Version: unspecified   
Target Milestone: 1.4 RC1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 337787, 341761    
Attachments:
Description Flags
Partial fix none

Description Rüdiger Herrmann CLA 2011-04-07 06:20:54 EDT
The LifeCycleAdapterFactory class buffers 'Known' adapter in static fields (displayAdapter and widgetAdapters). On the other hand, LifeCycleAdapterFactory is added to the AdapterFactoryRegistry whose instance is per RWTContext.
If I am not mistaken, the static fields of the LifeCycleAdapterFactory breaks the isolation of the RWTContext. Assuming that e.g. the widgetAdapters map is filled, all RWTContexts would see the same instances from the adapter factory.
Comment 1 Rüdiger Herrmann CLA 2011-04-07 07:11:38 EDT
... I am working on a patch - the test case is with what I am currently struggling (create a new session within the test)
Comment 2 Rüdiger Herrmann CLA 2011-04-07 09:01:41 EDT
Created attachment 192729 [details]
Partial fix

The patch converts the static fields to member fields and thus solves the problem that LifeCycleAdapterFactory may mix adapters from different RWTContexts.
Hovever, it introduces a new problem: as adapter factories have session scope, now each session has its own set of LifeCycleAdapter (LifeCycleAdapter_Test#testXXXFromDifferentSessions fail)
A possible solution to this problem would be to let the LifeCycleAdapterFactory use a a per-RWTContext buffer to store already known lifecycle adapters.
Comment 3 Rüdiger Herrmann CLA 2011-04-08 10:43:29 EDT
My current thinking is to let the AdapterFactory have application scope (i.e. make AdapterManagerImpl application scoped). See bug 342302.
Comment 4 Rüdiger Herrmann CLA 2011-05-03 05:40:45 EDT
Resolved with closing bug 342302.