You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Maurice Betzel <m....@gaston-schul.com> on 2022/07/08 07:39:38 UTC

Karaf Cellar DOSGi, throw exception if remote results is NULL

Good morning,

In the Karaf Cellar DOSGi module the RemoteServiceInvocationHandler polls the remote results from a result queue in Command getResult() returning a map. If this poll times out after 30 secs NULL gest returned to the caller. Would it not be a better idea to raise a
RemoteServiceInvocationException if results is NULL so the caller can differentiate between a service returning NULL and a failed invocation?
Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
Maurice Betzel

Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian Forwarders Association which have been published under nr. 0090237 in the "Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is available free of charge upon request.
Toutes nos opérations se font sur base des Conditions Générales des Expéditeurs de Belgique. Le texte en a été publié dans l' Annexe au Moniteur Belge du 24 juin 2005 sous le n° 0090237. Ce texte sera vous envoyé gratuitment sur demande.
Email confidentiality notice:
This email and any files transmitted with it are confidential and intended only for the use of the recipient. If you have received this email in error please notify its sender.


RE: Karaf Cellar DOSGi, throw exception if remote results is NULL

Posted by Maurice Betzel <m....@gaston-schul.com>.
Nah, CancellationException seem more appropriate:

throw new CancellationException("CELLAR DOSGI: no remote service execution results for " + serviceClass + " due to time out");

Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
Maurice Betzel
Principal Software Engineer
Gaston Schul Group
Department ICT
Kazernestraat 10
5928 NL Venlo

Phone: +31 77 32 460 26
Mobile Phone: +31 6 10 37 58 03
Website: www.gaston-schul.com<https://www.gaston-schul.com/>

[cid:image001.jpg@01D892CA.35C0DA70]

________________________________

[cid:image002.jpg@01D892CA.35C0DA70]



From: Maurice Betzel
Sent: 08 July 2022 12:16
To: user@karaf.apache.org
Subject: RE: Karaf Cellar DOSGi, throw exception if remote results is NULL

Hi JBO,

I just did a test run with this setup but throwing a RemoteServiceInvocationException results in a client side  UndeclaredThrowableException, so I used the runtime exception NullPointer, as that is what we actually get from the poll method:

Class RemoteServiceInvocationHandler line 78:

throw new NullPointerException("CELLAR DOSGI: no remote service execution results for " + endpointId + " due to time out");
Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
Maurice Betzel

Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian Forwarders Association which have been published under nr. 0090237 in the "Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is available free of charge upon request.
Toutes nos opérations se font sur base des Conditions Générales des Expéditeurs de Belgique. Le texte en a été publié dans l' Annexe au Moniteur Belge du 24 juin 2005 sous le n° 0090237. Ce texte sera vous envoyé gratuitment sur demande.
Email confidentiality notice:
This email and any files transmitted with it are confidential and intended only for the use of the recipient. If you have received this email in error please notify its sender.


RE: Karaf Cellar DOSGi, throw exception if remote results is NULL

Posted by Maurice Betzel <m....@gaston-schul.com>.
Hi JBO,

I just did a test run with this setup but throwing a RemoteServiceInvocationException results in a client side  UndeclaredThrowableException, so I used the runtime exception NullPointer, as that is what we actually get from the poll method:

Class RemoteServiceInvocationHandler line 78:

throw new NullPointerException("CELLAR DOSGI: no remote service execution results for " + endpointId + " due to time out");
Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
Maurice Betzel

Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian Forwarders Association which have been published under nr. 0090237 in the "Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is available free of charge upon request.
Toutes nos opérations se font sur base des Conditions Générales des Expéditeurs de Belgique. Le texte en a été publié dans l' Annexe au Moniteur Belge du 24 juin 2005 sous le n° 0090237. Ce texte sera vous envoyé gratuitment sur demande.
Email confidentiality notice:
This email and any files transmitted with it are confidential and intended only for the use of the recipient. If you have received this email in error please notify its sender.


Re: Karaf Cellar DOSGi, throw exception if remote results is NULL

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Maurice,

yes, it makes sense to me.

Regards
JB

On Fri, Jul 8, 2022 at 9:39 AM Maurice Betzel <m....@gaston-schul.com>
wrote:

> Good morning,
>
>
>
> In the Karaf Cellar DOSGi module the RemoteServiceInvocationHandler polls
> the remote results from a result queue in Command getResult() returning a
> map. If this poll times out after 30 secs NULL gest returned to the caller.
> Would it not be a better idea to raise a
>
> RemoteServiceInvocationException if results is NULL so the caller can
> differentiate between a service returning NULL and a failed invocation?
>
> Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
>
> Maurice Betzel
>
> Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der
> Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch
> Staatsblad dd. 24 juni 2005 onder nr. 0090237. De tekst van deze
> voorwaarden wordt op uw verzoek gratis toegezonden.
> All our transactions are subject to the General Conditions of the Belgian
> Forwarders Association which have been published under nr. 0090237 in the
> "Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is
> available free of charge upon request.
> Toutes nos opérations se font sur base des Conditions Générales des
> Expéditeurs de Belgique. Le texte en a été publié dans l' Annexe au
> Moniteur Belge du 24 juin 2005 sous le n° 0090237. Ce texte sera vous
> envoyé gratuitment sur demande.
> Email confidentiality notice:
> This email and any files transmitted with it are confidential and intended
> only for the use of the recipient. If you have received this email in error
> please notify its sender.
>