Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF7C51030B for ; Tue, 26 May 2015 21:16:03 +0000 (UTC) Received: (qmail 27375 invoked by uid 500); 26 May 2015 21:15:51 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 27224 invoked by uid 500); 26 May 2015 21:15:51 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 27085 invoked by uid 99); 26 May 2015 21:15:50 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 May 2015 21:15:50 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id B3491AC0C43 for ; Tue, 26 May 2015 21:15:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r952775 [5/14] - in /websites/staging/felix/trunk/content: ./ apidocs/ apidocs/dependencymanager.runtime/4.0.0/ apidocs/dependencymanager.runtime/r1/ apidocs/dependencymanager.runtime/r1/org/ apidocs/dependencymanager.runtime/r1/org/apache/... Date: Tue, 26 May 2015 21:15:49 -0000 To: commits@felix.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150526211550.B3491AC0C43@hades.apache.org> Added: websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentDependencyDeclaration.html ============================================================================== --- websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentDependencyDeclaration.html (added) +++ websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentDependencyDeclaration.html Tue May 26 21:15:48 2015 @@ -0,0 +1,424 @@ + + + + + +ComponentDependencyDeclaration + + + + + + + + + + + +
+
org.apache.felix.dm
+

Interface ComponentDependencyDeclaration

+
+
+
+
    +
  • +
    +
    All Known Subinterfaces:
    +
    BundleDependency, ConfigurationDependency, ResourceDependency, ServiceDependency
    +
    +
    +
    All Known Implementing Classes:
    +
    AbstractDependency
    +
    +
    +
    +
    public interface ComponentDependencyDeclaration
    +
    Describes a component dependency. They form descriptions of dependencies + that are managed by the dependency manager. They can be used to query their state + for monitoring tools. The dependency manager shell command is an example of + such a tool.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static intSTATE_AVAILABLE_OPTIONAL +
      State constant for an available, optional dependency.
      +
      static intSTATE_AVAILABLE_REQUIRED +
      State constant for an available, required dependency.
      +
      static java.lang.String[]STATE_NAMES +
      Names for the states of this dependency.
      +
      static intSTATE_OPTIONAL +
      State constant for an optional dependency that has not been started yet.
      +
      static intSTATE_REQUIRED +
      State constant for a required dependency that has not been started yet.
      +
      static intSTATE_UNAVAILABLE_OPTIONAL +
      State constant for an unavailable, optional dependency.
      +
      static intSTATE_UNAVAILABLE_REQUIRED +
      State constant for an unavailable, required dependency.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      java.lang.StringgetFilter() +
      Returns the Dependency filter or null
      +
      java.lang.StringgetName() +
      Returns the name of this dependency (a generic name with optional info separated by spaces)
      +
      java.lang.StringgetSimpleName() +
      Returns the simple dependency name (service classname for example)
      +
      intgetState() +
      Returns the state of this dependency.
      +
      java.lang.StringgetType() +
      Returns the name of the type of this dependency.
      +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        STATE_NAMES

        +
        static final java.lang.String[] STATE_NAMES
        +
        Names for the states of this dependency.
        +
      • +
      + + + +
        +
      • +

        STATE_UNAVAILABLE_OPTIONAL

        +
        static final int STATE_UNAVAILABLE_OPTIONAL
        +
        State constant for an unavailable, optional dependency.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        STATE_AVAILABLE_OPTIONAL

        +
        static final int STATE_AVAILABLE_OPTIONAL
        +
        State constant for an available, optional dependency.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        STATE_UNAVAILABLE_REQUIRED

        +
        static final int STATE_UNAVAILABLE_REQUIRED
        +
        State constant for an unavailable, required dependency.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        STATE_AVAILABLE_REQUIRED

        +
        static final int STATE_AVAILABLE_REQUIRED
        +
        State constant for an available, required dependency.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        STATE_OPTIONAL

        +
        static final int STATE_OPTIONAL
        +
        State constant for an optional dependency that has not been started yet.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        STATE_REQUIRED

        +
        static final int STATE_REQUIRED
        +
        State constant for a required dependency that has not been started yet.
        +
        See Also:
        Constant Field Values
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getName

        +
        java.lang.String getName()
        +
        Returns the name of this dependency (a generic name with optional info separated by spaces)
        +
      • +
      + + + +
        +
      • +

        getSimpleName

        +
        java.lang.String getSimpleName()
        +
        Returns the simple dependency name (service classname for example)
        +
      • +
      + + + +
        +
      • +

        getFilter

        +
        java.lang.String getFilter()
        +
        Returns the Dependency filter or null
        +
      • +
      + + + +
        +
      • +

        getType

        +
        java.lang.String getType()
        +
        Returns the name of the type of this dependency.
        +
      • +
      + + + +
        +
      • +

        getState

        +
        int getState()
        +
        Returns the state of this dependency.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + Added: websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentExecutorFactory.html ============================================================================== --- websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentExecutorFactory.html (added) +++ websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentExecutorFactory.html Tue May 26 21:15:48 2015 @@ -0,0 +1,346 @@ + + + + + +ComponentExecutorFactory + + + + + + + + + + + +
+
org.apache.felix.dm
+

Interface ComponentExecutorFactory

+
+
+
+
    +
  • +
    +
    +
    public interface ComponentExecutorFactory
    +
    A ComponentExecutorFactory service can be registered by any management agent bundle + in order to enable parallel activation of Components.

    + + A ComponentExecutorFactory is part of the new concurrency model that forms the basis + of Dependency Manager 4.0. Let's first give a brief overview of the default thread model used when + no ComponentExecutorFactory is used. Then we'll explain the rationale and the usage of a + ComponentExecutorFactory service. +

    + +

    Default Thread Model

    + + By default, Dependency Manager uses a lock-free/single thread model: +

      + +
    • When an external event that influence the state of a Component is taking place (for example, + when a service dependency on which the Component is depending on is registered in the registry by + a given thread), then DependencyManager does not perform any locking for the handling of the event. + Instead of that, a job that will handle the event is inserted in an internal lock-free + Serial Queue which is internally maintained in each Component. + +
    • all jobs scheduled in the Serial Queue are then executed in FIFO order, by the first + thread which has triggered the first event. This avoid to use some blocking locks in DM internals, and + also it simplifies the development of DM components, because all lifecycle callbacks + (init/start/stop/destroy) and dependency injections are scheduled through the Serial Queue: + This means that your component is not concurrently called in lifecycle callbacks and in dependency injection + methods. + +
    • Now let's describe which thread is executing the jobs scheduled in a Component Serial Queue: + When a job (J1) is scheduled in the queue while it is empty, then the current thread becomes the "master" + and will immediately execute the Serial Queue tasks (synchronously). And if another thread + triggers another event concurrently while the "master" thread is executing the job J1, then a job (J2) + for this new event is just enqueued in the Serial Queue, but the other thread returns + immediately to the caller, and the job J2 will then be executed by the "master" thread (after J1). +
    + +

    + This mechanism allows to serially handle all Component events (service dependencies) in FIFO order + without maintaining any locks. + +

    Enabling parallelism with a ComponentExecutorFactory

    + + As described above, all the external events that influence the state of a given component are handed by + jobs scheduled in the Serial Queue of the Component, and the jobs are getting executed serially + by a single "master" thread. So usually, bundles are started from a single thread, meaning that all Components + are then activated synchronously. +

    + + But when you register in the OSGi service registry a ComponentExecutorFactory, that factory + will be used by DependencyManager to create an Executor of your choice for each Component, typically a shared + threadpool configured by yourself. And all the Component Serial Queues will be executed using + the Executor returned by the getExecutorFor(Component) method. + However, jobs scheduled in the Serial Queue of a given Component are still executed one at a + time, in FIFO order and the Component remains single threaded, and independent Components + may then each be managed and activated concurrently with respect to each other. +

    + If you want to ensure that all Components are initialized after the ComponentExecutorFactory is + registered in the OSGI registry, you can use the "org.apache.felix.dependencymanager.parallel" OSGi + system property which specifies the list of components which must wait for the ComponentExecutorFactory + service. This property value can be set to a wildcard ("*"), or a list of components implementation class + prefixes (comma separated). So, all components whose class name starts with the specified prefixes will be cached + until the ComponentExecutorFactory service is registered (In this way, it is not necessary to use + the StartLevel service if you want to ensure that all components are started concurrently). +

    + + Some class name prefixes can also be negated (using "!"), in order to exclude some components from the + list of components using the ComponentExecutorFactory service. +

    + + Notice that if the ComponentExecutorFactory itself and all its dependent services are defined using + the Dependency Manager API, then you have to list the package of such components with a "!" + prefix, in order to indicate that those components must not wait for a ComponentExecutorFactory service + (since they are part of the ComponentExecutorFactory implementation !). +

    + +

    Examples for the usage of the "org.apache.felix.dependencymanager.parallel" property:

    + +
    + org.apache.felix.dependencymanager.parallel=*   
    +      -> means all components must be cached until a ComponentExecutorFactory comes up.
    + 
    + org.apache.felix.dependencymanager.parallel=foo.bar, foo.zoo
    +      -> means only components whose implementation class names are starting with "foo.bar" or "foo.zoo" 
    +      must be handled using an Executor returned by the ComponentExecutorFactory service. Other Components
    +      will be handled normally, as when there is no ComponentExecutorFactory available.
    + 
    + org.apache.felix.dependencymanager.parallel=!foo.threadpool, *
    +      -> means all components must be delayed until the ComponentExecutorFactory comes up, except the 
    +      components whose implementations class names are starting with "foo.threadpool" prefix). 
    + 
    + +

    Examples of a ComponentExecutorFactory that provides a shared threadpool:

    + + First, we define the OSGi bundle context system property to enable parallelism for all DM Components + excepts the one which declares the ComponentExecutorFactory: + +
    +   org.apache.felix.dependencymanager.parallel=!com.acme.management.threadpool, *
    + 
    + + Next, here is the Activator which declares the ComponentExecutorFactory: + +
    +   package com.acme.management.threadpool;
    +   import org.apache.felix.dm.*;
    +   
    +   public class Activator extends DependencyActivatorBase {      
    +      public void init(BundleContext context, DependencyManager mgr) throws Exception {
    +         mgr.add(createComponent()
    +            .setInterface(ComponentExecutorFactory.class.getName(), null)
    +            .setImplementation(ComponentExecutorFactoryImpl.class)
    +            .add(createConfigurationDependency()
    +                 .setPid("com.acme.management.threadpool.ComponentExecutorFactoryImpl")));
    +      }
    +   }
    + 
    + + And here is the implementation for our ComponentExecutorFactory: + +
    +   package com.acme.management.threadpool;
    +   import org.apache.felix.dm.*;
    +
    +  public class ComponentExecutorFactoryImpl implements ComponentExecutorFactory {
    +      volatile Executor m_threadPool;
    +      
    +      void updated(Dictionary conf) {
    +          m_sharedThreadPool = Executors.newFixedThreadPool(Integer.parseInt("threadpool.size"));
    +      }
    +
    +      @Override
    +      public Executor getExecutorFor(Component component) {
    +          return m_sharedThreadPool; // Use a shared threadpool for all Components
    +      }
    +  }
    + 
    +
    Since:
    +
    4.0.0
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      java.util.concurrent.ExecutorgetExecutorFor(Component component) +
      Returns an Executor (typically a shared thread pool) used to manage a given DependencyManager Component.
      +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getExecutorFor

        +
        java.util.concurrent.Executor getExecutorFor(Component component)
        +
        Returns an Executor (typically a shared thread pool) used to manage a given DependencyManager Component.
        +
        Parameters:
        component - the Component to be managed by the returned Executor
        +
        Returns:
        an Executor used to manage the given component, or null if the component must not be managed using any executor.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + Added: websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentState.html ============================================================================== --- websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentState.html (added) +++ websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentState.html Tue May 26 21:15:48 2015 @@ -0,0 +1,357 @@ + + + + + +ComponentState + + + + + + + + + + + +
+
org.apache.felix.dm
+

Enum ComponentState

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<ComponentState>
    • +
    • +
        +
      • org.apache.felix.dm.ComponentState
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<ComponentState>
    +
    +
    +
    +
    public enum ComponentState
    +extends java.lang.Enum<ComponentState>
    +
    Component states. Any state listeners registered using @link Component.add(ComponentStateListener) method + are notified with the following stated whenever the component state changes.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      INACTIVE +
      The component is not currently started, and is inactive.
      +
      INSTANTIATED_AND_WAITING_FOR_REQUIRED +
      The component has all its initial required dependencies available, but is now waiting for some extra required + dependencies which have been added after the component have been started (like from the component init method for example).
      +
      TRACKING_OPTIONAL +
      The component is active, and is now tracking available optional dependencies.
      +
      WAITING_FOR_REQUIRED +
      The component is waiting for some required dependencies.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      static ComponentStatevalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static ComponentState[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        INACTIVE

        +
        public static final ComponentState INACTIVE
        +
        The component is not currently started, and is inactive.
        +
      • +
      + + + +
        +
      • +

        WAITING_FOR_REQUIRED

        +
        public static final ComponentState WAITING_FOR_REQUIRED
        +
        The component is waiting for some required dependencies.
        +
      • +
      + + + +
        +
      • +

        INSTANTIATED_AND_WAITING_FOR_REQUIRED

        +
        public static final ComponentState INSTANTIATED_AND_WAITING_FOR_REQUIRED
        +
        The component has all its initial required dependencies available, but is now waiting for some extra required + dependencies which have been added after the component have been started (like from the component init method for example).
        +
      • +
      + + + +
        +
      • +

        TRACKING_OPTIONAL

        +
        public static final ComponentState TRACKING_OPTIONAL
        +
        The component is active, and is now tracking available optional dependencies.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static ComponentState[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (ComponentState c : ComponentState.values())
        +    System.out.println(c);
        +
        +
        Returns:
        an array containing the constants of this enum type, in the order they are declared
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static ComponentState valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        Parameters:
        name - the name of the enum constant to be returned.
        +
        Returns:
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + Added: websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentStateListener.html ============================================================================== --- websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentStateListener.html (added) +++ websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ComponentStateListener.html Tue May 26 21:15:48 2015 @@ -0,0 +1,210 @@ + + + + + +ComponentStateListener + + + + + + + + + + + +
+
org.apache.felix.dm
+

Interface ComponentStateListener

+
+
+
+
    +
  • +
    +
    +
    public interface ComponentStateListener
    +
    This interface can be used to register a component state listener. Component + state listeners are called whenever a component state changes. You get notified + when the component is starting, started, stopping and stopped. Each callback + includes a reference to the component in question.
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + Added: websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ConfigurationDependency.html ============================================================================== --- websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ConfigurationDependency.html (added) +++ websites/staging/felix/trunk/content/apidocs/dependencymanager/r1/org/apache/felix/dm/ConfigurationDependency.html Tue May 26 21:15:48 2015 @@ -0,0 +1,398 @@ + + + + + +ConfigurationDependency + + + + + + + + + + + +
+
org.apache.felix.dm
+

Interface ConfigurationDependency

+
+
+
+
    +
  • +
    +
    All Superinterfaces:
    +
    ComponentDependencyDeclaration, Dependency
    +
    +
    +
    +
    public interface ConfigurationDependency
    +extends Dependency, ComponentDependencyDeclaration
    +
    Configuration dependency that can track the availability of a (valid) configuration. To use + it, specify a PID for the configuration. The dependency is always required, because if it is + not, it does not make sense to use the dependency manager. In that scenario, simply register + your component as a ManagedService(Factory) and handle everything yourself. Also, + only managed services are supported, not factories. There are a couple of things you need to + be aware of when implementing the updated(Dictionary) method: +
      +
    • Make sure it throws a ConfigurationException when you get a configuration + that is invalid. In this case, the dependency will not change: if it was not available, it + will still not be. If it was available, it will remain available and implicitly assume you + keep working with your old configuration.
    • +
    • This method will be called before all required dependencies are available. Make sure you + do not depend on these to parse your settings.
    • +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setCallback

        +
        ConfigurationDependency setCallback(java.lang.String callback)
        +
        Sets the name of the callback method that should be invoked when a configuration + is available. The contract for this method is identical to that of + ManagedService.updated(Dictionary) throws ConfigurationException.
        +
        Parameters:
        callback - the name of the callback method
        +
      • +
      + + + +
        +
      • +

        setCallback

        +
        ConfigurationDependency setCallback(java.lang.Object instance,
        +                                  java.lang.String callback)
        +
        Sets the name of the callback method that should be invoked when a configuration + is available. The contract for this method is identical to that of + ManagedService.updated(Dictionary) throws ConfigurationException.
        +
        Parameters:
        instance - the instance to call the callbacks on
        callback - the name of the callback method
        +
      • +
      + + + +
        +
      • +

        setPid

        +
        ConfigurationDependency setPid(java.lang.String pid)
        +
        Sets the service.pid of the configuration you are depending + on.
        +
      • +
      + + + +
        +
      • +

        setPropagate

        +
        ConfigurationDependency setPropagate(boolean propagate)
        +
        Sets propagation of the configuration properties to the service + properties. Any additional service properties specified directly are + merged with these.
        +
      • +
      + + + +
        +
      • +

        setHeading

        +
        ConfigurationDependency setHeading(java.lang.String heading)
        +
        The label used to display the tab name (or section) where the properties + are displayed. Example: "Printer Service".
        +
        Returns:
        The label used to display the tab name where the properties are + displayed (may be localized)
        +
      • +
      + + + +
        +
      • +

        setDescription

        +
        ConfigurationDependency setDescription(java.lang.String description)
        +
        A human readable description of the PID this configuration is associated + with. Example: "Configuration for the PrinterService bundle".
        +
        Returns:
        A human readable description of the PID this configuration is + associated with (may be localized)
        +
      • +
      + + + +
        +
      • +

        setLocalization

        +
        ConfigurationDependency setLocalization(java.lang.String path)
        +
        Points to the basename of the Properties file that can localize the Meta + Type informations. The default localization base name for the properties + is OSGI-INF/l10n/bundle, but can be overridden by the manifest + Bundle-Localization header (see core specification, in section + Localization on page 68). You can specify a specific localization + basename file using this method (e.g. + setLocalization("person") will match person_du_NL.properties + in the root bundle directory.
        +
      • +
      + + + + +
    • +
    +
  • +
+
+
+ + + + + + +