Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 97716 invoked from network); 3 Oct 2007 22:15:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 22:15:22 -0000 Received: (qmail 55330 invoked by uid 500); 3 Oct 2007 22:15:11 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 55294 invoked by uid 500); 3 Oct 2007 22:15:11 -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 55285 invoked by uid 99); 3 Oct 2007 22:15:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 15:15:11 -0700 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, 03 Oct 2007 22:15:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6D370714168 for ; Wed, 3 Oct 2007 15:14:23 -0700 (PDT) Message-ID: <15784539.1191449663443.JavaMail.jira@brutus> Date: Wed, 3 Oct 2007 15:14:23 -0700 (PDT) From: "Timothy Bish (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const' In-Reply-To: <10724675.1190374883801.JavaMail.jira@brutus> 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/AMQCPP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40251 ] Timothy Bish commented on AMQCPP-143: ------------------------------------- After looking at this and the discussion on nabble I think we should go the route of making the read methods const and making the stream mutable. The reason for this is that the onMessage callback needs to keep the message const so that the caller can't make any changes to the payload as we will save the message off when a session is transactional for instance. We don't want the receiver to change the message in that case since we would then redeliver something that's not what was originally sent if a rollback is done. Since the stream is really just an internal cache of where the read methods are at in the payload I think its ok to make it mutable. Comments? > declara BytesMessage::readXXX() methods as 'const' > --------------------------------------------------- > > Key: AMQCPP-143 > URL: https://issues.apache.org/activemq/browse/AMQCPP-143 > Project: ActiveMQ C++ Client > Issue Type: Improvement > Components: CMS Impl > Environment: language specific, all the platforms > Reporter: Matvey Aizenshtat > Assignee: Timothy Bish > Priority: Minor > Fix For: 2.1.1 > > > BytesMessage readXXX() methods (readBytes() etc) aren't 'const' since the internal stream state is changed. > But if only the stream pointer is updated, I suppose we could have another solution here, i.e. > declare inputStream field as 'mutable': > mutable io::ByteArrayInputStream inputStream; > In that case we could keep read methods const. > I am requesting for that because at the moment such non-const API forces app level either always deal with non-const objects or make const_cast(), that's not good. > See also: > http://www.nabble.com/BytesMessage-methods-tf3833767s2354.html#a10853672 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.