I think you forgot to set and send the DONE status at the end of your
processing,
      MessageUtil.transferToOut(syncExchange.getMessage("out"), exchange);
      channel.send(exchange);
      client.done(syncExchange);

On Fri, Mar 7, 2008 at 1:29 PM, Fabrice Landrodie
<[EMAIL PROTECTED]> wrote:
>
>  Hello,
>
>  I am facing some memoryleak problems when using MessageExchange and
>  servicemix-bean.
>
>  My use case is as followed :
>
>  http client --> BC Http Su --> smx-bean Su --> smx-bean Su
>
>  The request send by http client is routed to the first smx-bean Su. In
>  onMessageExchange() function, I create a new MessageExchange that I sent to
>  the second smx-bean Su using sendSync() in InOut mep. The answer is the
>  placed into the Out of the first Exchange and send back to the BC http.
>
>  It works well but the problem is that if I send a lot of request, memory
>  increases but never decrease at the end of the treatment. If I set a big
>  size for the xml body of the request, the memory increases faster and an
>  OutOfMemory exception is raised. So it seems the memory leak is relative to
>  the size of the message.
>
>  I think it could be a problem of MessageExchance that are never dereferenced
>  so that the garbage collector does not free them.
>
>  I use a profiler to try to analyze where the memory is leak, and it seems
>  this is in a lot of int[] and char[] objects ....
>
>
>  Can someone help me on this problem ? Maybe, I do not code the good way for
>  sending message from a bean to another one.
>
>  Thank you for your help,
>  Fabrice
>
>  
> --------------------------------------------------------------------------------------
>  Here is the code of the first smx-bean SU with the onMessageExchange :
>
>  public class MyBean implements MessageExchangeListener {
>
>         private static ServiceMixClient client = null;
>
>         @Resource
>         private DeliveryChannel channel;
>         @Resource
>         private ComponentContext context;
>
>         public void onMessageExchange (MessageExchange exchange ) throws
>  MessagingException {
>
>                 if ( client == null ) {
>                         client = new ServiceMixClientFacade(context);
>                 }
>
>                 if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
>
>                         if (exchange instanceof InOut == true) {
>
>                                 Destination destination;
>                                 destination
>  client.createDestination("endpoint:http://myNameSpace/MyService/MyEndpoint";);
>                                 // Create New MessageExchange
>                                 InOut syncExchange = 
> destination.createInOutExchange();
>                                 QName qOperation = new QName("myOp");
>                                 exchange.setOperation(qOperation);
>
>                                 // Get object of In Message
>                                 NormalizedMessage request = 
> syncExchange.getInMessage();
>                                 // Set the content of new In exchange with
>  th In coming from our caller
>                                 
> request.setContent(exchange.getMessage("in").getContent());
>
>                                 // Send the new exchange and wait for the
>  anwer
>                                 client.sendSync(syncExchange);
>
>                                 // Set the out of the syncExchange into the
>  out of the current exchange and send back the current exchange
>                                 
> MessageUtil.transferToOut(syncExchange.getMessage("out"), exchange);
>                                 channel.send(exchange);
>
>                         }
>         }
>  }
>  --
>  View this message in context: 
> http://www.nabble.com/Servicemix-bean-MemoryLeak-tp15891209s12049p15891209.html
>  Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Reply via email to