You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ackelcn (Jira)" <ji...@apache.org> on 2020/06/24 04:52:00 UTC

[jira] [Updated] (AMQ-7503) Comment code with issue numbers

     [ https://issues.apache.org/jira/browse/AMQ-7503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ackelcn updated AMQ-7503:
-------------------------
    Description: 
When I read the code of activemq, I find some comments with issue numbers. One of them comes from TopicSubscription.java:
{code:java}
public void add(MessageReference node) throws Exception {
   ...
   while (active) {
                        while (matched.isFull()) {
                            if (getContext().getStopping().get()) {
                                LOG.warn("{}: stopped waiting for space in pendingMessage cursor for: {}", toString(), node.getMessageId());
                               getSubscriptionStatistics().getEnqueues().decrement();
                                return;
                            }
                            if (!warnedAboutWait) {
                                LOG.info("{}: Pending message cursor [{}] is full, temp usag ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
                                        new Object[]{
                                                toString(),
                                                matched,
                                                matched.getSystemUsage().getTempUsage().getPercentUsage(),
                                                matched.getSystemUsage().getMemoryUsage().getPercentUsage()
                                        });
                                warnedAboutWait = true;
                            }
                            matchedListMutex.wait(20);
                        }
                        // Temporary storage could be full - so just try to add the message
                        // see https://issues.apache.org/activemq/browse/AMQ-2475
                        if (matched.tryAddMessageLast(node, 10)) {
                            break;
                        }
                    }{code}
These comments are quite useful for other programmers and me to understand the code, but I notice that not all issue numbers are written in code comments. It can be already quite tedious to write them into commit messages :)

 

To handle the problem, I implemented a tool to automatically instrument issue numbers into code comments. I tried my tool on activemq, and the instrumented version is [https://github.com/ackelcn/activemq] 

 

To avoid confusion, if there is already an issue number in code comments, my tool ignored the issue number. All my generated comments start from //IC, so it is easy to find them.

 

Would you please some feedbacks to my tool? Please feel free to merge my generated comments in your code, if you feel that some are useful.

  was:
When I read the code of activemq, I find some comments with issue numbers. One of them comes from TopicSubscription.java:
{code:java}
public void add(MessageReference node) throws Exception {
   ...
   while (active) {
                        while (matched.isFull()) {
                            if (getContext().getStopping().get()) {
                                LOG.warn("{}: stopped waiting for space in pendingMessage cursor for: {}", toString(), node.getMessageId());
                               getSubscriptionStatistics().getEnqueues().decrement();
                                return;
                            }
                            if (!warnedAboutWait) {
                                LOG.info("{}: Pending message cursor [{}] is full, temp usag ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
                                        new Object[]{
                                                toString(),
                                                matched,
                                                matched.getSystemUsage().getTempUsage().getPercentUsage(),
                                                matched.getSystemUsage().getMemoryUsage().getPercentUsage()
                                        });
                                warnedAboutWait = true;
                            }
                            matchedListMutex.wait(20);
                        }
                        // Temporary storage could be full - so just try to add the message
                        // see https://issues.apache.org/activemq/browse/AMQ-2475
                        if (matched.tryAddMessageLast(node, 10)) {
                            break;
                        }
                    }{code}
These comments are quite useful for other programmers and me to understand the code, but I notice that not all issue numbers are written in code comments. It can be already quite tedious to write them into commit messages :)

 

To handle the problem, I implemented a tool to automatically instrument issue numbers into code comments. I tried my tool on activemq, and the instrumented version is [https://github.com/ackelcn/activemqwithissuecomment]

 

To avoid confusion, if there is already an issue number in code comments, my tool ignored the issue number. All my generated comments start from //IC, so it is easy to find them.

 

Would you please some feedbacks to my tool? Please feel free to merge my generated comments in your code, if you feel that some are useful.


> Comment code with issue numbers
> -------------------------------
>
>                 Key: AMQ-7503
>                 URL: https://issues.apache.org/jira/browse/AMQ-7503
>             Project: ActiveMQ
>          Issue Type: Improvement
>            Reporter: ackelcn
>            Priority: Major
>
> When I read the code of activemq, I find some comments with issue numbers. One of them comes from TopicSubscription.java:
> {code:java}
> public void add(MessageReference node) throws Exception {
>    ...
>    while (active) {
>                         while (matched.isFull()) {
>                             if (getContext().getStopping().get()) {
>                                 LOG.warn("{}: stopped waiting for space in pendingMessage cursor for: {}", toString(), node.getMessageId());
>                                getSubscriptionStatistics().getEnqueues().decrement();
>                                 return;
>                             }
>                             if (!warnedAboutWait) {
>                                 LOG.info("{}: Pending message cursor [{}] is full, temp usag ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
>                                         new Object[]{
>                                                 toString(),
>                                                 matched,
>                                                 matched.getSystemUsage().getTempUsage().getPercentUsage(),
>                                                 matched.getSystemUsage().getMemoryUsage().getPercentUsage()
>                                         });
>                                 warnedAboutWait = true;
>                             }
>                             matchedListMutex.wait(20);
>                         }
>                         // Temporary storage could be full - so just try to add the message
>                         // see https://issues.apache.org/activemq/browse/AMQ-2475
>                         if (matched.tryAddMessageLast(node, 10)) {
>                             break;
>                         }
>                     }{code}
> These comments are quite useful for other programmers and me to understand the code, but I notice that not all issue numbers are written in code comments. It can be already quite tedious to write them into commit messages :)
>  
> To handle the problem, I implemented a tool to automatically instrument issue numbers into code comments. I tried my tool on activemq, and the instrumented version is [https://github.com/ackelcn/activemq] 
>  
> To avoid confusion, if there is already an issue number in code comments, my tool ignored the issue number. All my generated comments start from //IC, so it is easy to find them.
>  
> Would you please some feedbacks to my tool? Please feel free to merge my generated comments in your code, if you feel that some are useful.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)