Thanks Christian for the response. 

If I understand your response correctly, a single instance of processor will
be shared between thread safe. Isn't that inefficient?

In my specific example, I have a processor RequestProcessor which extracts
the body of the exchange, parses the body into an XML document and examines
element values using XPATH , and does some additional processing.   

RequestProcessor(){

     private DocumentBuilder db;

    public RequestProcessor(){
           db=DobcumentBuilderFactory.newInstance(); // initialize
DocumentBuilder
    }

    public void process(Exchange exchange){
           String body = exchange.getIn().getBody(String.class)
           Document doc = db.parse(body);
           //process the doc. 
    }

}
In the above example, if each HTTP thread is sharing the same
RequestProcessor instance, won't it have performance impact if I have to
synchronize "db.parse(body)" section or a more complex time consuming
section ? 

Is there a way to create a pool of these processors so that each HTTP thread
can use a dedicated process for the duration of a request ? 

Thanks




--
View this message in context: 
http://camel.465427.n5.nabble.com/concurrent-users-with-camel-routes-tp5717888p5717906.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to