You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2009/01/30 08:47:59 UTC

[jira] Commented: (FELIX-900) WebConsole does not register servlet when HttpService already registered

    [ https://issues.apache.org/jira/browse/FELIX-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12668770#action_12668770 ] 

Felix Meschberger commented on FELIX-900:
-----------------------------------------

The OsgiManager works correctly, due to the implementation of the ServiceTracker, which is the base class opf the HttpServiceTracker: When the service tracker is opened, it grabs all registered matching services and calls the addingService method. It also then registers as a ServiceListener.

The consequence is, that the addingService method is always called for all services, regardless of whether the services were registered before or after the ServiceTracker was opened. This is in fact one of the nice things about the ServiceTracker: You don't have to care about finding existing services and listening for service changes, just get what is there and get updates with the same mechanism.

Do you experience concrete issues, which make you wonder, that there is a bug ?

> WebConsole does not register servlet when HttpService already registered
> ------------------------------------------------------------------------
>
>                 Key: FELIX-900
>                 URL: https://issues.apache.org/jira/browse/FELIX-900
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>    Affects Versions: webconsole-1.2.2
>            Reporter: Thomas Diesler
>
> Looking at 
>     public OsgiManager( BundleContext bundleContext )
>     {
>         this.bundleContext = bundleContext;
>         this.log = new Logger( bundleContext );
>         updateConfiguration( null );
>         try
>         {
>             this.configurationListener = ConfigurationListener.create( this );
>         }
>         catch ( Throwable t )
>         {
>             // might be caused by CM not available
>         }
>         // get at the HttpService first, this should initialize
>         // the OSGi Manager and start the initial setup
>         httpServiceTracker = new HttpServiceTracker( this );
>         httpServiceTracker.open();
>     }
> it seems that the manager servlet is only registered when the HttpService comes *after* the webconsole service
>         public Object addingService( ServiceReference reference )
>         {
>             Object operation = super.addingService( reference );
>             if ( operation instanceof HttpService )
>             {
>                 osgiManager.bindHttpService( ( HttpService ) operation );
>             }
>             return operation;
>         }
> Unless I miss something, the OsgiManager should probably check for HttpService and register it's servlet when the OsgiManager is activated
>     public void start( BundleContext bundleContext )
>     {
>         osgiManager = new OsgiManager( bundleContext );
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.