org.apache.felix.servicebinder
Interface InstanceReferenceListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
InstanceManager.StateChangeMulticaster

public interface InstanceReferenceListener
extends java.util.EventListener

This is an event listener for listening to changes in the availability of the underlying object associated with an InstanceReference. For the precise details of when this event is fired, refer to the methods below.

Author:
Felix Project Team

Method Summary
 void invalidating(InstanceReferenceEvent event)
          This method is called when an InstanceReference's underlying object is going to be invalidated.
 void validated(InstanceReferenceEvent event)
          This method is called when an InstanceReference's underlying object becomes valid, i.e., the instance is available for use.
 

Method Detail

validated

void validated(InstanceReferenceEvent event)
This method is called when an InstanceReference's underlying object becomes valid, i.e., the instance is available for use. This event is fired during the following sequence of steps:

  1. Instance created.
  2. Dependencies bound, if any.
  3. Services registered, if any.
  4. Lifecycle.activate() is called, if the instance implements the Lifecycle interface.
  5. Fire InstanceReferenceListener.validated().

Parameters:
event - the associated instance reference event.

invalidating

void invalidating(InstanceReferenceEvent event)
This method is called when an InstanceReference's underlying object is going to be invalidated. This event is fired during the following sequence of steps:

  1. Fire InstanceReferenceListener.invalidating().
  2. Call Lifecycle.deactivate(), if the instance implements the Lifecycle interface.
  3. Unregister services, if any.
  4. Unbind dependencies, if any.
  5. Dispose instance.

Note: Care must be taken during this callback, because the underlying object associated with the instance reference may not be fully functioning. For example, this event might be fired in direct response to a dependent service shutting down, which then instigates the invalidation of the underlying object instance.

Parameters:
event - the associated instance reference event.