Automatically destroy @Dependent contextual instances created with Instance<T>
------------------------------------------------------------------------------
Key: OWB-627
URL: https://issues.apache.org/jira/browse/OWB-627
Project: OpenWebBeans
Issue Type: Improvement
Components: Context and Scopes
Affects Versions: 1.1.2
Reporter: Mark Struberg
Assignee: Mark Struberg
Priority: Critical
Fix For: 1.1.3
See https://issues.jboss.org/browse/CDI-139 for the problem.
Consider the following code:
@Dependent
public class MyClass {
...
}
private @Inject Instance<MyClass> inst;
public void doSomething() {
MyClass dings = inst.select(...).get()
}
The problem here is that the @Dependent MyClass doesn't get injected into some
other class, thus it doesn't share any lifecycle. Thus it will never get
destroyed properly, and it's mem will also not get freed.
The proper solution to that (as I explained in CDI-139) is to store T, the
CreationalContext<T> and Contextual<T> which got used to create T in a List and
destroy them properly via a @PreDestroy in Instance<T>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira