You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/03/02 21:26:18 UTC

[jira] [Commented] (CAMEL-9657) Problems with DefaultCamelContext constructor calling Container.Instance.manage()

    [ https://issues.apache.org/jira/browse/CAMEL-9657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15176398#comment-15176398 ] 

ASF GitHub Bot commented on CAMEL-9657:
---------------------------------------

GitHub user jamesnetherton opened a pull request:

    https://github.com/apache/camel/pull/881

    [CAMEL-9657] Move container management of camel contexts to start method

    Also ignore CDI proxied camel contexts when invoking contextCreated()
    from CamelContextTrackerRegistry

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jamesnetherton/camel CAMEL-9657

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/881.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #881
    
----
commit c03ae5e260781a530311fdfb83eeaf5907772d5f
Author: James Netherton <ja...@gmail.com>
Date:   2016-03-01T20:51:05Z

    [CAMEL-9657] Move container management of camel contexts to start method
    
    Also ignore CDI proxied camel contexts when invoking contextCreated()
    from CamelContextTrackerRegistry

----


> Problems with DefaultCamelContext constructor calling Container.Instance.manage() 
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-9657
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9657
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: James Netherton
>
> [This code|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java#L300] can cause problems when Camel runs in a container (like WildFly) with CDI.
> The code assumes that the camel context will get started and stopped at some point during its lifecycle, which then triggers an [unmanage|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java#L3151] from the Container instance object. 
> With CDI, this scenario may not happen. Especially when CDI proxies are created for @Injecting camel contexts into beans. The camel context in this scenario is never started or stopped, resulting in this [map of contexts|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/spi/Container.java#L51] filling up with redundant objects.  
> Not sure what the best way of dealing with this is. It'd be nice to remove the Container.manage code from the DefaultCamelContext default constructor or implement Container in such a way that clients can override its behaviour. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)