camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hadrian Zbarcea <>
Subject [DISCUSS] Exchange copy api cleanup
Date Wed, 08 Jul 2009 22:14:00 GMT
Currently the Exchange has the following 4 apis that I think can be  
consolidated into 1 or 2 methods:

    Exchange newInstance();
    Exchange copy();
    Exchange newCopy(boolean handoverOnCompletion);
    void copyFrom(Exchange source);

I think both copyFrom(Exchange) and newInstance() could easily be  
replaced by copy().  The usage pattern is:
     Exchange e = source.newInstance();
which is as good as
     Exchange e = source.copy();

I believe newCopy(which is kinda ugly and only used in 4 places) can  
be consolidated with copy(), but I'd have to take a closer look.  Its  
usage is not really consistent with the javadoc description (only used  
by wiretap, seda and ThreadsProcessor, not all of the components that  
do async messaging).  Looking at the implementation in  
DefaultExchange, setting the CORRELATION_ID is already done by copy()  
and in 2 out of 4 calls it's invoked with handoverOnCompletion set to  

I can't really see what the different semantic abstractions these  
methods represent (in spite of the javadoc comments) and I'd like this  
api cleanup to be done in 2.0 if you guys agree.


View raw message