You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Matvey Aizenshtat (JIRA)" <ji...@apache.org> on 2007/09/21 13:41:23 UTC

[jira] Created: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

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
    Affects Versions: 2.2
         Environment: language specific, all the platforms
            Reporter: Matvey Aizenshtat
            Assignee: Nathan Mittler
            Priority: Minor


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<cms::BytesMessage *>(), 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.


[jira] Updated: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

Posted by "Nathan Mittler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Mittler updated AMQCPP-143:
----------------------------------

    Fix Version/s: 2.2

> 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
>    Affects Versions: 2.2
>         Environment: language specific, all the platforms
>            Reporter: Matvey Aizenshtat
>            Assignee: Nathan Mittler
>            Priority: Minor
>             Fix For: 2.2
>
>
> 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<cms::BytesMessage *>(), 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.


[jira] Resolved: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQCPP-143.
---------------------------------

    Resolution: Fixed

Made the changes in SVN Rev. 582349  Tests all pass.  

Resolved.

> 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<cms::BytesMessage *>(), 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.


[jira] Updated: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

Posted by "Nathan Mittler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Mittler updated AMQCPP-143:
----------------------------------

    Affects Version/s:     (was: 2.2)
        Fix Version/s:     (was: 2.2)
                       2.1.1

> 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: Nathan Mittler
>            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<cms::BytesMessage *>(), 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.


[jira] Commented: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

Posted by "Timothy Bish (JIRA)" <ji...@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<cms::BytesMessage *>(), 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.


[jira] Assigned: (AMQCPP-143) declara BytesMessage::readXXX() methods as 'const'

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish reassigned AMQCPP-143:
-----------------------------------

    Assignee: Timothy Bish  (was: Nathan Mittler)

> 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<cms::BytesMessage *>(), 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.