Producer - Add scope for singleton to allow using non singleton producers to 
address thread safety
--------------------------------------------------------------------------------------------------

                 Key: CAMEL-1644
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1644
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 2.0-M1
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 2.0.0


See CAMEL-1641 that is a bug reported about the FTP producer not being thread 
safe for concurrent usage.

To address this we should consider supporting Producers to implement 
{{IsSingleton}} and return {{false}} to indicate that a producer should not be 
cached in the {{ProducerCache}}.

We should also introduce a {{ProducerCallback}} to allow safely usages of a 
producer and letting Camel handle the correct resource management to
- find the producer (singletons)
- add to cache if needed
- or create it
- start it
- invoke the callback
- stop it for non singletons
etc.

In the future we can support a pool of non singleton producers as well and with 
this callback users of this producer can safely use it without worrying how to 
get it from a pool and how to safely return it back without leaking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to