Hi!

I have a component that acts a bit like a whiteboard provider. It looks 
something like this:

public class MyWhiteboard
{
  boolean isActive;

  @Reference MyExecutor executor; // Required service to execute on an Item

  @Reference(multiple/dynamic)
  void bindItem( Item item )
  {
    if (isActivated)
      // add the Item
    else
      // Store the item to be added once this component is activated
  }

  void unbindItem( Item item )
  {
    // Remove the item
  }

  @Activate
  void activate()
  {
    // execute non-processed Items
    isActivate = true;
  }
}

The MyExecutor must be present before an Item can be processed, but there is no 
guarantee as to the binding order. All I can think of doing is ensuring that 
the Component is Activated before processing.

My question is: is there a more elegant / simpler / less error prone way of 
accomplishing this?


Thanks!
=David


_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to