You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raul Kripalani (Created) (JIRA)" <ji...@apache.org> on 2012/01/25 19:38:40 UTC

[jira] [Created] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

doStop() is called on Services which haven't been started when route autoStart=false
------------------------------------------------------------------------------------

                 Key: CAMEL-4941
                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.9.0
            Reporter: Raul Kripalani
            Assignee: Raul Kripalani
            Priority: Minor


While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 

This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 

During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.

The stop routine will then proceed to call doStop on the service, which is erroneous.

To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:

{code:java}
            // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
            if (!(service.isStarted() || service.isStarting() || 
                    service.isStopped() || service.isStopping() || 
                    service.isSuspended() || service.isSuspending())) 
            {
                return true;
            }
{code}

--
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

        

[jira] [Commented] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194707#comment-13194707 ] 

Claus Ibsen commented on CAMEL-4941:
------------------------------------

I have polished the javadoc to explain the behavior of the doStop method.
                
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>             Fix For: 2.10.0
>
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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

        

[jira] [Updated] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4941:
----------------------------------

    Patch Info: Patch Available
    
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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

        

[jira] [Commented] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194700#comment-13194700 ] 

Claus Ibsen commented on CAMEL-4941:
------------------------------------

You should build your components so they are resilient for doStop calls.

For example when Camel is shutting down it will stop and shutdown all its services, routes, components, and whatnot.
                
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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

        

[jira] [Issue Comment Edited] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Claus Ibsen (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194701#comment-13194701 ] 

Claus Ibsen edited comment on CAMEL-4941 at 1/27/12 1:33 PM:
-------------------------------------------------------------

We should not change behavior of this. This has been the behavior always with Camel.
                
      was (Author: davsclaus):
    We should change behavior of this. This has been the behavior always with Camel.
                  
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>             Fix For: 2.10.0
>
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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

        

[jira] [Updated] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4941:
----------------------------------

    Attachment: ServiceHelperHandleUninitialized.patch

Patch attached.
                
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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

        

[jira] [Resolved] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4941.
--------------------------------

       Resolution: Won't Fix
    Fix Version/s: 2.10.0

We should change behavior of this. This has been the behavior always with Camel.
                
> doStop() is called on Services which haven't been started when route autoStart=false
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4941
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>            Priority: Minor
>             Fix For: 2.10.0
>
>         Attachments: ServiceHelperHandleUninitialized.patch
>
>
> While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. 
> This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. 
> During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended.
> The stop routine will then proceed to call doStop on the service, which is erroneous.
> To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method:
> {code:java}
>             // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped
>             if (!(service.isStarted() || service.isStarting() || 
>                     service.isStopped() || service.isStopping() || 
>                     service.isSuspended() || service.isSuspending())) 
>             {
>                 return true;
>             }
> {code}

--
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