[cdi-dev] [JBoss JIRA] (CDI-540) Clarify CDI container initialization in Java SE

Tomas Remes (JIRA) issues at jboss.org
Wed Jul 15 08:45:04 EDT 2015

    [ https://issues.jboss.org/browse/CDI-540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089675#comment-13089675 ] 

Tomas Remes commented on CDI-540:

I fully agree with this. Why developer needs to ask {{CDIProvider}} whether {{CDI}} is initialized? And what does it mean actually? I think {{CDIProvider.isInitialized()}} method would make more sense as method on {{CDI}} and named like {{isRunning}} (since we have shutdown method). 

> Clarify CDI container initialization in Java SE
> -----------------------------------------------
>                 Key: CDI-540
>                 URL: https://issues.jboss.org/browse/CDI-540
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Java SE Integration
>    Affects Versions: 2.0-EDR1
>            Reporter: Martin Kouba
> {{CDIProvider.isInitialized()}} javadoc should be clarified. I believe the spec should be more specific and define what it means for a CDIProvider to be initialized. E.g. _"a {{CDIProvider}} is initialized if at least one CDI container was started and is still running"_.
> {{CDI.shutdown()}} currently must throw an {{IllegalStateException}} if the container is already stopped (actually, the javadoc is missing this piece of information). However, there is no way how to find out whether a CDI container is running or not. {{CDIProvider.isInitialized()}} would be usable if multiple running containers were forbidden (which I hope will not be). Also it wouldn't make sense to ask an instance of {{CDIProvider}} whether a concrete {{CDI}} instance is running...

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list