<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: OSGi Service Locator</title>
	<atom:link href="http://basepatterns.org/2009/09/osgi-service-locator/feed/" rel="self" type="application/rss+xml" />
	<link>http://basepatterns.org/2009/09/osgi-service-locator/</link>
	<description>Trends in software design</description>
	<lastBuildDate>Tue, 06 Oct 2009 22:37:18 +1100</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: fortuna</title>
		<link>http://basepatterns.org/2009/09/osgi-service-locator/comment-page-1/#comment-27</link>
		<dc:creator>fortuna</dc:creator>
		<pubDate>Tue, 06 Oct 2009 22:37:18 +0000</pubDate>
		<guid isPermaLink="false">http://basepatterns.org/?p=74#comment-27</guid>
		<description>&lt;a href=&quot;#comment-21&quot; rel=&quot;nofollow&quot;&gt;@Costin Leau&lt;/a&gt; 

Hi Costin,

Thanks I probably should have made the point that the &lt;em&gt;Service Locator&lt;/em&gt; pattern is possibly the least desirable mechanism for retrieving service references in an OSGi context, due to the dynamic nature of service availability that you mention.

Sometimes however (particularly when dealing with legacy code and third-party libraries), approaches such as the &lt;a href=&quot;http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf&quot; rel=&quot;nofollow&quot;&gt;whiteboard pattern&lt;/a&gt; and/or &lt;em&gt;Dependency Injection&lt;/em&gt; may not be applicable. In such cases a Service Locator may be considered (albeit with caution!).

regards,
ben
</description>
		<content:encoded><![CDATA[<p><a href="#comment-21" rel="nofollow">@Costin Leau</a> </p>
<p>Hi Costin,</p>
<p>Thanks I probably should have made the point that the <em>Service Locator</em> pattern is possibly the least desirable mechanism for retrieving service references in an OSGi context, due to the dynamic nature of service availability that you mention.</p>
<p>Sometimes however (particularly when dealing with legacy code and third-party libraries), approaches such as the <a href="http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf" rel="nofollow">whiteboard pattern</a> and/or <em>Dependency Injection</em> may not be applicable. In such cases a Service Locator may be considered (albeit with caution!).</p>
<p>regards,<br />
ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Costin Leau</title>
		<link>http://basepatterns.org/2009/09/osgi-service-locator/comment-page-1/#comment-21</link>
		<dc:creator>Costin Leau</dc:creator>
		<pubDate>Wed, 30 Sep 2009 17:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://basepatterns.org/?p=74#comment-21</guid>
		<description>One thing to add - one must not forget about the OSGi dynamics: a service can be unregistered at any time so ideally, on each call, the client would locate the service, invoke the methods needed and then discard the instance.
Otherwise, if the service gets unregistered, any further invocations will lead to unpredictable behaviour.

There are frameworks that handle this case (among other features) in a non invasive fashion (using dependency injection) - I&#039;ll mention the ones I know best, namely Spring DM and OSGi Blueprint Services.

Cheers,
Costin Leau
Lead, Spring Dynamic Modules
</description>
		<content:encoded><![CDATA[<p>One thing to add &#8211; one must not forget about the OSGi dynamics: a service can be unregistered at any time so ideally, on each call, the client would locate the service, invoke the methods needed and then discard the instance.<br />
Otherwise, if the service gets unregistered, any further invocations will lead to unpredictable behaviour.</p>
<p>There are frameworks that handle this case (among other features) in a non invasive fashion (using dependency injection) &#8211; I&#8217;ll mention the ones I know best, namely Spring DM and OSGi Blueprint Services.</p>
<p>Cheers,<br />
Costin Leau<br />
Lead, Spring Dynamic Modules</p>
]]></content:encoded>
	</item>
</channel>
</rss>
