[JBoss JIRA] Created: (CDI-139) Support for unmanaged instances
by Joshua Davis (JIRA)
Support for unmanaged instances
-------------------------------
Key: CDI-139
URL: https://issues.jboss.org/browse/CDI-139
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Beans
Affects Versions: 1.0
Reporter: Joshua Davis
Allow the creation of unmanaged instances. The CDI context will not keep track of these instances and the application will be responsible for cleaning them up. This is a fairly typical usage of other DI frameworks such as Guice and PicoContainer.
Currently, if an ApplicationScoped object injects an {{Instance<T>}} interface, CDI will manage all instances returned by the {{get()}} method as dependents of the application scoped object. Those instances will be kept in memory by the CDI implementation and will only be GC'd when the application scoped object is destroyed (at the end of the application). This may look like a memory leak to the user (see WELD-920).
>From P. Muir on WELD-920
{quote}
We can describe instances which are attached (as the CDI 1.0 spec requires) as "managed" instances, and those which the user takes responsibility for cleaning up themselves as "unmanaged" instances. In CDI 1.1 I would like to add support for unmanaged instances (the impl will just hand these over and forget about them) and also to allow the app to request an unmanaged instance is cleaned up. Please can someone file a CDI issue for this?
Weld could certainly be more friendly and more proactively discard instances. Ideas:
1) Analyse the dependent instance graph, and if there are no @PreDestroy/@Disposer callbacks on in the graph, do not store the dependent instance for cleanup (this would be a good general optimization
(2) Add a config option to allow instances created from Instance to be held only as long as the app holds a reference, and if the app doesn't hold a reference for it's lifetime, then Weld would not do any cleanup (Weld would hold a weak ref).
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] (CDI-239) Define Extension notification rules for shared libraries
by Mark Struberg (JIRA)
Mark Struberg created CDI-239:
---------------------------------
Summary: Define Extension notification rules for shared libraries
Key: CDI-239
URL: https://issues.jboss.org/browse/CDI-239
Project: CDI Specification Issues
Issue Type: Clarification
Components: Portable Extensions
Affects Versions: 1.1.EDR1
Reporter: Mark Struberg
Consider an EAR file with a shared xy.JAR file in the EARs ./lib folder with an
@EnterpriseApplicationScoped class X
and a
@RequestScoped class Y
The EAR also contains 2 web applications WebAppA and WebAppB.
WebAppA has ExtensionA in it's WEB-INF/classes and WebAppB has ExtensionB in it's classes both with a public void met(@Observes ProcessAnnotatedType pat) and each modifying the AnnotatedType.
What should happen here? Will there be 2 Bean<T> for X and 2 for Y? (one Bean for each WebApp)? or will X and Y not trigger a ProcessAnnotatedType for the extensions defined in the webapps (but only for Extensions defined in the shared ear lib)?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] (CDI-218) Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes a bean archive
by Dan Allen (JIRA)
Dan Allen created CDI-218:
-----------------------------
Summary: Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes a bean archive
Key: CDI-218
URL: https://issues.jboss.org/browse/CDI-218
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Packaging and Deployment
Reporter: Dan Allen
Priority: Minor
Chapter 12.1 specifies that beans.xml must be in the WEB-INF directory of a web archive to activate the WEB-INF/classes directory of that war as a bean archive (and thus make java:comp/BeanManager visible to the web app).
However, many developers find this location both confusing and inconvenient at times. The instinct of many developers is to put the beans.xml in WEB-INF/classes/META-INF since that follows the convention that applies to library jars.
Obviously, we cannot break backwards compatibility. Therefore, this issue proposes to honor either location in the war:
- WEB-INF/beans.xml
- WEB-INF/classes/META-INF/beans.xml
If both files are present, the WEB-INF/beans.xml should take precedence and a warning is recommended. (Merging them is not likely the behavior that a developer would want).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] (CDI-225) Clarify whether bean discovery MAY or MUST NOT include class loading
by Harald Wellmann (JIRA)
Harald Wellmann created CDI-225:
-----------------------------------
Summary: Clarify whether bean discovery MAY or MUST NOT include class loading
Key: CDI-225
URL: https://issues.jboss.org/browse/CDI-225
Project: CDI Specification Issues
Issue Type: Clarification
Components: Resolution
Affects Versions: 1.1.EDR1
Reporter: Harald Wellmann
The CDI 1.0 spec and also the current 1.1 draft is rather vague about the issue of class loading vs. class file byte code scanning for bean discovery.
By default, I would assume the term "class" in a specification to refer to a loaded class, unless explicitly stated otherwise. A feature like Seam Solder's
{code}
@Requires(OptionalDependency.class)
public class OptionalBean
{code}
will necessarily break if the CDI container loads OptionalBean during bean discovery - when OptionalDepencency is not available, OptionalBean cannot be loaded, and the CDI container won't even see the @Requires annotation.
See also http://seamframework.org/Seam3/Compatibility, Section Overzealous class scanner.
The way I read the CDI spec, GlassFish is fully spec compliant (but maybe not very efficient) in loading bean archive classes for the purpose of discovery.
@Requires is also spec compliant, but not portable because it tacitly assumes that classes get scanned but not loaded.
So if scanning in place of loading has been a tacit assumption of the CDI 1.0 authors all the time, it should be made explicit in CDI 1.1. Otherwise, if loading is also a valid option, this should be clearly stated so that extension authors will not rely on accidental features of a given CDI implementation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] (CDI-229) introduce @OverridesAttribute for @StereoType
by Mark Struberg (JIRA)
Mark Struberg created CDI-229:
---------------------------------
Summary: introduce @OverridesAttribute for @StereoType
Key: CDI-229
URL: https://issues.jboss.org/browse/CDI-229
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Beans
Affects Versions: 1.1.EDR1
Reporter: Mark Struberg
We recently had a thread on the DeltaSpike list about using StereoTypes in real world applications: http://markmail.org/thread/uqozhsix2znwiebn
------
Imagine the following Stereotype for my Services (I spare out the standard
stuff)
@StereoType @Secured @Transactional @ApplicationScoped public @interface @Service {}
The problem here is that there is no way to 'propagate' any rolesAllowed from
@Service to @Secured, etc.
What I'd like to have is something like ... public @interface @Service {
String[] rolesAllowed(); TransactionAttributeType transactionType();
}
where the rolesAllowed() would get propagated to the @Secured meta-annotation
and transactionType() to the @Transactional
-----------
Gerhard Petracek now pointed me to a cool feature which is used in JSR-303 BVAL: @OverridesAttribute
http://docs.oracle.com/javaee/6/api/javax/validation/OverridesAttribute.html
We should ping the BVAL EG for the details. There are quite a few little tricks and side effects to consider.
On the implementation side, we could e.g. pick the @StereoType annotation and automatically propagate those values to the AnnotatedType which get's passed to the Extensions
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months