Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342131 - LifeCycleAdapterFactory violates scope of ApplicationContext
Summary: LifeCycleAdapterFactory violates scope of ApplicationContext
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.4 RC1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 337787 341761
  Show dependency tree
 
Reported: 2011-04-07 06:20 EDT by Rüdiger Herrmann CLA
Modified: 2011-05-03 05:40 EDT (History)
1 user (show)

See Also:


Attachments
Partial fix (10.42 KB, patch)
2011-04-07 09:01 EDT, Rüdiger Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.