You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2011/08/25 15:10:37 UTC

[jira] [Created] (CAMEL-4381) Simplyfy ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

Simplyfy ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
-----------------------------------------------------------------------------------------------------------

                 Key: CAMEL-4381
                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 2.8.0
            Reporter: Christian Schneider
            Assignee: Christian Schneider
             Fix For: 2.9.0


Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 

Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.

The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

Yes the big F was a typo. I also rather think support -> util is ok. But that means that util may not reference support as we should not have both directions

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

Yes have respect for the existing code.

The state can be stopped + shutdown etc. When a service is shutdown its also stopped.

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

When you do those big refactorings then avoid changing the logic. For example in ServiceHelper you removed the logic which checks if a service is already started in the startService method. That logic should be put back.

Spotting this is hard when you do big refactorings. If you want to change some logic, then do these changes in separate commits.

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

Its fine to have a dependency on util, as that is the purpose of the util package. To have helper/util classes that you can reuse.

I suggest to use the name: Stateful, eg lower case f, as that is the proper name. Stateless, Stateful, etc.
http://en.wikipedia.org/wiki/State_(computer_science)

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

Btw. Do we really need these AtomicBooleans? The state of the service can only be one of those at a time. So I think an integer or a status enum would be better.

So I would like to change that into a ServiceStatus status. The only question is how to make it thread safe but I guess this should work with synchronized.


> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

I have now finished an implementation. org.apache.camel.StateFulService is the interface for services that support start, stop, suspend, resume. So every class that does not need the implementation uses this interface. 

ServiceSupport is moved to org.apache.camel.support a deprecated stub is left in impl. ServiceSupport does not support children.
For this case ChildServiceSupport is used.

Now one thing I struggle with a bit is DefaultTimeOutMap and some related classes. It needs ServiceSupport so if we keep it in util then we have a dependency from util to support. On the other hand currently ChildServiceSupport uses ServiceHelper. So we have a dependency from support to util. 

I see two solutions: 
1) Move DefaulTimeOutMap to support
2) Do not use ServiceHelper in ServiceSupport

In the end it comes down to the question: Should support classes be allowed to use util classes? Then we have to go with 1)

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

LifeCycleAwareService sounds good

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

Maybe name it StatefulService as it is capable of knowing what state the service is in (started, stopped, suspended) etc. Or some other name that indicate this. LifecycleService? LifecyclewareService?


> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

Ah good about F, because if you rename in svn on a windows system, such as F -> f, then that fails. As the file system is case insensitive.

Yeah it would be desirable to not have util depend on support, or any of the other sub packages. But I guess there could be a some tangles in there.

Also we actually have a number of converter classes in .impl.converter and .converter. The @Converter classes ought to be in .converter. The .impl.converter is the default implementation of the type converter registry, and the annotation scanning and the likes.

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

Hi Claus,
the logic for not starting a service twice is still there. I just moved it to ServiceSupport. I was not aware of the logic that resets the state when an exception is thrown. I will add this and also add a test for it.


> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider updated CAMEL-4381:
---------------------------------------

    Summary: Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support  (was: Simplyfy ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support)

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider resolved CAMEL-4381.
----------------------------------------

    Resolution: Fixed

The issue when an exception occurs at starting a service is solved

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider commented on CAMEL-4381:
--------------------------------------------

Honestly I think we have to many states. For example I do not get what the difference between stopped and suspended should be. I have never really seen that many states.

But of course there is the real issue with existing code that might easily break. So I will suggest having a status variable in camel 3.0 but for now it is better to leave it alone.

> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Christian Schneider edited comment on CAMEL-4381 at 8/29/11 5:42 PM:
---------------------------------------------------------------------

I have now finished an implementation. org.apache.camel.StatefulService is the interface for services that support start, stop, suspend, resume. So every class that does not need the implementation uses this interface. 

ServiceSupport is moved to org.apache.camel.support a deprecated stub is left in impl. ServiceSupport does not support children.
For this case ChildServiceSupport is used.

Now one thing I struggle with a bit is DefaultTimeOutMap and some related classes. It needs ServiceSupport so if we keep it in util then we have a dependency from util to support. On the other hand currently ChildServiceSupport uses ServiceHelper. So we have a dependency from support to util. 

I see two solutions: 
1) Move DefaulTimeOutMap to support
2) Do not use ServiceHelper in ServiceSupport

In the end it comes down to the question: Should support classes be allowed to use util classes? Then we have to go with 1)

      was (Author: chris@die-schneider.net):
    I have now finished an implementation. org.apache.camel.StateFulService is the interface for services that support start, stop, suspend, resume. So every class that does not need the implementation uses this interface. 

ServiceSupport is moved to org.apache.camel.support a deprecated stub is left in impl. ServiceSupport does not support children.
For this case ChildServiceSupport is used.

Now one thing I struggle with a bit is DefaultTimeOutMap and some related classes. It needs ServiceSupport so if we keep it in util then we have a dependency from util to support. On the other hand currently ChildServiceSupport uses ServiceHelper. So we have a dependency from support to util. 

I see two solutions: 
1) Move DefaulTimeOutMap to support
2) Do not use ServiceHelper in ServiceSupport

In the end it comes down to the question: Should support classes be allowed to use util classes? Then we have to go with 1)
  
> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4381) Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support

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

Claus Ibsen commented on CAMEL-4381:
------------------------------------

Spotted another issue, in the ServiceSupport. The start/stop methods etc. when an exception is thrown from doStart,doStop, then the state of the service should be "changed back" etc. So if a service is attempted to be started and it fails, then the old logic ensured the state would be as stopped.  Now the logic doesnt do that.
For example the "starting" state would be keept.

now
{code}
    public void start() throws Exception {
        if (isStarting() || isStarted()) {
            // only start service if not already started
            LOG.trace("Service already started");
            return;
        }
        if (starting.compareAndSet(false, true)) {
            LOG.trace("Starting service");
            doStart();
            started.set(true);
            starting.set(false);
            stopping.set(false);
            stopped.set(false);
            suspending.set(false);
            suspended.set(false);
            shutdown.set(false);
            shuttingdown.set(false);
        }
    }
{code}

before:
{code}
   public void start(boolean startChildren) throws Exception {
        if (!started.get()) {
            if (starting.compareAndSet(false, true)) {
                boolean childrenStarted = false;
                Exception ex = null;
                try {
                    if (childServices != null && startChildren) {
                        ServiceHelper.startServices(childServices);
                    }
                    childrenStarted = true;
                    doStart();
                } catch (Exception e) {
                    ex = e;
                } finally {
                    if (ex != null) {
                        try {
                            stop(childrenStarted);
                        } catch (Exception e) {
                            // Ignore exceptions as we want to show the original exception
                        }
                        throw ex;
                    } else {
                        started.set(true);
                        starting.set(false);
                        stopping.set(false);
                        stopped.set(false);
                        suspending.set(false);
                        suspended.set(false);
                        shutdown.set(false);
                        shuttingdown.set(false);
                    }
                }
            }
        }
{code}


> Simplify ServiceSupport and introduce ServiceWithStatus interface to remove tangle between util and support
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4381
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4381
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 2.9.0
>
>
> Currently ServiceSupport and ServiceHelper form a dependency cycle. ServiceSupport calls ServiceHelper to start and stop services and ServiceSupport operate on ServiceSupport classes.
> To solve that I introduce an Interface ServiceWithSupport (open for a better naming). This interface extends Service and has all relevant methods from ServiceSupport. So ServiceHelper can operate on ServiceWithStatus and the tangle goes away. 
> Addtionally I split up ServiceSupport into ServiceSupport which has no children and ChildServiceSupport which has. This is because we seem to have only two classes that actually use the children functionality. The rest of the classes that extend ServiceSupport have no children. So having them all extend the old ServiceSupport introduces a lot of unneeded complexity.
> The change should be fairly compatible. The only possible problem are third party components that use children. As we only had two such components in camel the chance that something breaks is fairly low.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira