|
87 | 87 | * @author Kai Kreuzer - introduced bounded thread pool and http service streaming server
|
88 | 88 | * @author Victor Toni - consolidated transport abstraction into one interface
|
89 | 89 | * @author Wouter Born - conditionally enable component based on autoEnable configuration value
|
| 90 | + * @author Laurent Garnier - do not release the OSGi HttpService |
90 | 91 | */
|
91 | 92 | @Component(configurationPid = "org.jupnp", configurationPolicy = ConfigurationPolicy.REQUIRE, enabled = false)
|
92 | 93 | public class OSGiUpnpServiceConfiguration implements UpnpServiceConfiguration {
|
@@ -122,9 +123,6 @@ public class OSGiUpnpServiceConfiguration implements UpnpServiceConfiguration {
|
122 | 123 |
|
123 | 124 | protected BundleContext context;
|
124 | 125 |
|
125 |
| - @SuppressWarnings("rawtypes") |
126 |
| - protected ServiceReference httpServiceReference; |
127 |
| - |
128 | 126 | @SuppressWarnings("rawtypes")
|
129 | 127 | protected TransportConfiguration transportConfiguration;
|
130 | 128 |
|
@@ -180,18 +178,13 @@ protected void activate(BundleContext context, Map<String, Object> configProps)
|
180 | 178 |
|
181 | 179 | namespace = createNamespace();
|
182 | 180 |
|
183 |
| - logger.debug("{} activated", this); |
| 181 | + logger.debug("OSGiUpnpServiceConfiguration {} activated", this); |
184 | 182 | }
|
185 | 183 |
|
186 | 184 | @Deactivate
|
187 | 185 | protected void deactivate() {
|
188 |
| - if (httpServiceReference != null) { |
189 |
| - context.ungetService(httpServiceReference); |
190 |
| - } |
191 |
| - |
192 | 186 | shutdown();
|
193 |
| - |
194 |
| - logger.debug("{} deactivated", this); |
| 187 | + logger.debug("OSGiUpnpServiceConfiguration {} deactivated", this); |
195 | 188 | }
|
196 | 189 |
|
197 | 190 | @Override
|
@@ -240,22 +233,18 @@ public StreamServer createStreamServer(NetworkAddressFactory networkAddressFacto
|
240 | 233 | ServiceReference serviceReference = context.getServiceReference(HttpService.class.getName());
|
241 | 234 |
|
242 | 235 | if (serviceReference != null) {
|
243 |
| - |
244 |
| - if (httpServiceReference != null) { |
245 |
| - context.ungetService(httpServiceReference); |
246 |
| - } |
247 |
| - |
248 |
| - httpServiceReference = serviceReference; |
249 |
| - |
250 | 236 | HttpService httpService = (HttpService) context.getService(serviceReference);
|
251 | 237 |
|
252 | 238 | if (httpService != null) {
|
| 239 | + logger.debug("createStreamServer using OSGi HttpService (port {})", |
| 240 | + httpProxyPort != -1 ? httpProxyPort : callbackURI.getBasePath().getPort()); |
253 | 241 | return new ServletStreamServerImpl(new ServletStreamServerConfigurationImpl(
|
254 | 242 | HttpServiceServletContainerAdapter.getInstance(httpService, context),
|
255 | 243 | httpProxyPort != -1 ? httpProxyPort : callbackURI.getBasePath().getPort()));
|
256 | 244 | }
|
257 | 245 | }
|
258 | 246 |
|
| 247 | + logger.debug("createStreamServer (port {})", networkAddressFactory.getStreamListenPort()); |
259 | 248 | return transportConfiguration.createStreamServer(networkAddressFactory.getStreamListenPort());
|
260 | 249 | }
|
261 | 250 |
|
|
0 commit comments