Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B31649918 for ; Fri, 2 Mar 2012 13:23:27 +0000 (UTC) Received: (qmail 60749 invoked by uid 500); 2 Mar 2012 13:23:27 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 60675 invoked by uid 500); 2 Mar 2012 13:23:27 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 60667 invoked by uid 99); 2 Mar 2012 13:23:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 13:23:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 13:23:26 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2973451CE for ; Fri, 2 Mar 2012 13:23:06 +0000 (UTC) Date: Fri, 2 Mar 2012 13:23:06 +0000 (UTC) From: "Torsten Mielke (Resolved) (JIRA)" To: dev@activemq.apache.org Message-ID: <1695768511.11836.1330694586171.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1631955220.11169.1330678558041.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (AMQ-3752) Repeated call to PooledConnection.setClientID() with the same clientId should not raise a IllegalStateException("Setting clientID on a used Connection is not allowed") MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AMQ-3752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Torsten Mielke resolved AMQ-3752. --------------------------------- Resolution: Fixed > Repeated call to PooledConnection.setClientID() with the same clientId should not raise a IllegalStateException("Setting clientID on a used Connection is not allowed") > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: AMQ-3752 > URL: https://issues.apache.org/jira/browse/AMQ-3752 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.5.1 > Reporter: Torsten Mielke > Assignee: Torsten Mielke > Labels: PooledConnectionFactory > Fix For: 5.6.0 > > Attachments: AMQ-3752.patch > > > Calling ActiveMQConnection.setClientID() twice currently raises an IllegalStateException: > {code:title=ActiveMQConnection.java} > public void setClientID(String newClientID) throws JMSException { > checkClosedOrFailed(); > if (this.isConnectionInfoSentToBroker) { > throw new IllegalStateException("Setting clientID on a used Connection is not allowed"); > } > > this.info.setClientId(newClientID); > this.userSpecifiedClientID = true; > ensureConnectionInfoSent(); > } > {code} > This successfully prevents from overriding clientID on an already started connection. > However in the case of using a Camel JMS endpoint with durable subscriptions, transactions and configuring for a PooledConnectionFactory, this current behavior causes problems. > Due to the durable sub a clientID needs to be set on the connection. This happens at startup of the JMS consumer by calling ActiveMQConnection.setClientID(). > If you stop the Camel route, the connection will be released back to the pool with the clientID remaining. > If you restart the Camel route, it will setup a new Spring DMLC and reinitialize the connection with the configured clientId. A new connection is obtained from the pool and setClientID() is invoked on that connection. This will raise the above Exception. > If we try to set the same clientID on the PooledConnection again, we should simply ignore the call rather than raising an exception.This allows the camel-jms consumer to be restarted. > Without a fix, its impossible restart a Camel route that uses camel-jms with durable subscriptions and the PooledConnectionFactory. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira