You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2015/04/09 08:38:12 UTC
[jira] [Commented] (FELIX-4847) Make TemporalServiceDependency
always available (and/or allow it to be optional)
[ https://issues.apache.org/jira/browse/FELIX-4847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14486830#comment-14486830 ]
Pierre De Rop commented on FELIX-4847:
--------------------------------------
Hello Tuomas,
I'm not sure I understand the use case, can you provide a sort of pseudo code which describes the usecase, or even a bndtools unit test ?
in the latest release, we removed the interface but you can still create a timed (and required) service dependency using the following method in the DependencyManager class, or the DependencyActivatorBase class:
{code}
public ServiceDependency createTemporalServiceDependency(long timeout);
{code}
So, as you said in your 1) point, the returned dependency will (unless there is a bug) always remain available even if the target dependency becomes unavailable.
Regarding the second point, I'm not sure I understand why we should support optionality for temporal dependencies ? Indeed, if a dependency is optional, you will be unbound from it when the dependency goes away (not a problem since it's an optional dependency) or you can use a null object pattern and when the dependency is not available, then a null object will replace the actual missing dependency.
but may be there is a bug somwhere ? so that would be great if you could provide a test case for all this.
thank you.
> Make TemporalServiceDependency always available (and/or allow it to be optional)
> --------------------------------------------------------------------------------
>
> Key: FELIX-4847
> URL: https://issues.apache.org/jira/browse/FELIX-4847
> Project: Felix
> Issue Type: Wish
> Components: Dependency Manager
> Affects Versions: dependencymanager-3.2.0
> Reporter: Tuomas Kiviaho
>
> I wanted to use temporal service to wait for CM update thread to finish what it's doing (because the spec doesn't have a non-parallel version).
> Everything worked fine until JUnit test rule said that the component isn't ready yet. I was merely checking that every required dependency was also available and to my surprise the temporal service was marked unavailable until the CM had completed what it was doing.
> 1) Shouldn't temporal service be always available externally via available property and keep track on the actual state only internally? This approach might not be backwards compatible.
> 2) Could temporal service be allowed to be marked as optional. This would suit my use case, but it feels like a 'golden hammer' approach because it alters component's state machine behavior a bit which in turn can be harmful for other use cases.
> As a workaround I'd have to differentiate the dependencies somehow from each other, but I see that the 4.x has removed the dedicated interface that I was thinking of relying upon to.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)