Return-Path: Delivered-To: apmail-servicemix-dev-archive@www.apache.org Received: (qmail 61706 invoked from network); 9 Jan 2008 15:44:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jan 2008 15:44:08 -0000 Received: (qmail 78044 invoked by uid 500); 9 Jan 2008 15:43:57 -0000 Delivered-To: apmail-servicemix-dev-archive@servicemix.apache.org Received: (qmail 78023 invoked by uid 500); 9 Jan 2008 15:43:56 -0000 Mailing-List: contact dev-help@servicemix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@servicemix.apache.org Delivered-To: mailing list dev@servicemix.apache.org Received: (qmail 78014 invoked by uid 99); 9 Jan 2008 15:43:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2008 07:43:56 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2008 15:43:52 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EDC4771423B for ; Wed, 9 Jan 2008 07:43:43 -0800 (PST) Message-ID: <5025243.1199893423969.JavaMail.jira@brutus> Date: Wed, 9 Jan 2008 07:43:43 -0800 (PST) From: "Ryan Bohn (JIRA)" To: dev@servicemix.apache.org Subject: [jira] Commented: (SM-1136) PreDestroy being called for each exchange when it's not configured that way. MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/SM-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41003#action_41003 ] Ryan Bohn commented on SM-1136: ------------------------------- Any word on when this patch will be incorporated into ServiceMix? > PreDestroy being called for each exchange when it's not configured that way. > ---------------------------------------------------------------------------- > > Key: SM-1136 > URL: https://issues.apache.org/activemq/browse/SM-1136 > Project: ServiceMix > Issue Type: Bug > Components: servicemix-bean > Affects Versions: 3.2 > Reporter: Ryan Bohn > Priority: Critical > Attachments: fixPreDestroy.patch > > > I have a sender bean and a receiver bean, both configured using According to the documentation: > Attention: The Bean Endpoint schema allows to set a Bean or a Bean Name. The Bean will create a single instance of the POJO per endpoint whereas the Bean Name will create an instance per request (message exchange). > I have in my xbean.xml: > > xmlns:example="http://servicemix.apache.org/example"> > > > > > > > > > > The receiver simply implements MessageExchangeListener. > The PostConstruct and PreDestroy only gets called once on the sender > The PostConstruct only gets called once on the receiver > However, the PreDestroy gets called on the receiver for each request. > I noticed in BeanEndpoint, there is the following method: > protected void checkEndOfRequest(Request request, Object corId) { > if (request.getExchange().getStatus() != ExchangeStatus.ACTIVE) { > ReflectionUtils.callLifecycleMethod(request.getBean(), PreDestroy.class); > //request.setBean(null); > //request.setExchange(null); > requests.remove(corId); > } > } > It doesn't look like this class pays any attention to whether the bean is supposed to be a single instance of an instance-per-request, which is probably the cause of the problem. > If you need me to attach an example, please let me know. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.