Hi Servicemix-guys,

I am facing some memoryleak problems when using servicemix-bean.

Use case is as followed :

Client --> Http Consumer SU --> Bean SU --> Camel SU --> Http Provider Su
--> External Service

onMessageExchange() function code:

    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        try {
        if (exchange.getStatus() != ExchangeStatus.ACTIVE){
            return;
        }
       
        NormalizedMessage message = exchange.getMessage("in");
       
        Set<Principal> principals =
message.getSecuritySubject().getPrincipals();
        String roleString = "";
        Iterator<Principal> principalIterator = principals.iterator();
        while (principalIterator.hasNext()) {
            Principal element = (Principal) principalIterator.next();
            roleString += element.getName();
            if(principalIterator.hasNext()) {
                roleString += ",";
            }
        }
               
        ClientFactory factory = (ClientFactory) new
InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
        ServiceMixClient client = factory.createClient();       
        Destination destination =
client.createDestination(getValidateService());
        InOut inOutExchange = destination.createInOutExchange();
        inOutExchange.setProperty("org.apache.servicemix.correlationId",
exchange.getProperty("org.apache.servicemix.correlationId"));
        NormalizedMessage inMessage = inOutExchange.getInMessage();
        inMessage.setProperty("userPrincipals",roleString);
        inMessage.setContent(message.getContent());
        client.sendSync(inOutExchange);
       
        NormalizedMessage outMessage = inOutExchange.getOutMessage();
        inOutExchange.setStatus(ExchangeStatus.DONE);
        exchange.setMessage(outMessage,"out");
        channel.send(exchange);
       
        } catch (Exception e) {
            logger.error("Error in processing message ",e);
        }       
  }

It works fine but the problem is that if I send a lot of parallel requests
at a time then it create number of threads and also increases memory
dramatically but never decrease even at the end of the request (observed
using jconsole).

So, that it seams to be some thing is missing in my above code.Can some body
help me on this.
Please ......

Sandeep.

-- 
View this message in context: 
http://www.nabble.com/Memory-leak-problem-with-servicemix-bean-tp19091115p19091115.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to