Roman created FELIX-5858:
----------------------------

             Summary: Additional server configured through OSGi factory 
configurations starts and stops immediately
                 Key: FELIX-5858
                 URL: https://issues.apache.org/jira/browse/FELIX-5858
             Project: Felix
          Issue Type: Bug
          Components: HTTP Service
    Affects Versions: http.jetty-4.0.0
            Reporter: Roman


When I disable a default server specifying a negative port and configure an 
additional server  through OSGi factory configurations i get a server started 
and immediately stopped:
{code:java}
2018-05-18 08:15:11.149:INFO:oejsh.ContextHandler:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started 
o.e.j.s.ServletContextHandler@4aefeb72{/,null,AVAILABLE}
2018-05-18 08:15:11.150:INFO:oejs.Server:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started 
@1448ms
2018-05-18 08:15:11.150:INFO:oejs.session:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): node0 
Scavenging every 660000ms
2018-05-18 08:15:11.194:INFO:oejs.AbstractConnector:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started 
ServerConnector@6dfbaedd{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2018-05-18 08:15:11.240:INFO:oejus.SslContextFactory:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): 
x509=X509@17c0c47f(budget,h=[],w=[]) for 
SslContextFactory@4d9ec6f9[provider=null,keyStore=bundleresource://4.fwk1864230087/etc/keystore/keystore,trustStore=null]
2018-05-18 08:15:11.517:INFO:oejs.AbstractConnector:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started 
ServerConnector@feb016f{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
2018-05-18 08:15:12.102:INFO:oejs.AbstractConnector:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped 
ServerConnector@6dfbaedd{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2018-05-18 08:15:12.104:INFO:oejs.AbstractConnector:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped 
ServerConnector@feb016f{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
2018-05-18 08:15:12.104:INFO:oejs.session:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): node0 
Stopped scavenging
2018-05-18 08:15:12.105:INFO:oejsh.ContextHandler:CM Configuration Updater 
(ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped 
o.e.j.s.ServletContextHandler@4aefeb72{/,null,UNAVAILABLE}

{code}
Checking code of Jetty activator I see, that it stops factory on ungetting it.
{code:java}
final Dictionary<String, Object> factoryProps = new Hashtable<>();
factoryProps.put(Constants.SERVICE_PID, JettyService.PID);
factoryProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
factoryProps.put(Constants.SERVICE_DESCRIPTION, "Managed Service Factory for 
the Jetty Http Service");
this.jettyServiceFactoryReg = 
this.getBundleContext().registerService("org.osgi.service.cm.ManagedServiceFactory",
new ServiceFactory()
{

@Override
public Object getService(final Bundle bundle,
final ServiceRegistration registration)
{
return new JettyManagedServiceFactory(getBundleContext());
}

@Override
public void ungetService(final Bundle bundle,
final ServiceRegistration registration,
final Object service)
{
((JettyManagedServiceFactory)service).stop();
}
}, factoryProps);

{code}
It should not happen actually, because it shutdowns the server.

Please fix it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to