ApplicationContextTracker

public abstract class ApplicationContextTracker extends ServiceTracker

Base class for every class that wishes to track Spring application context. Contains a methods that help with synchronous processing.

Constructors

ApplicationContextTracker

public ApplicationContextTracker(BundleContext context)

Methods

contextInvalidOrProcessed

protected boolean contextInvalidOrProcessed(ServiceReference serviceReference, ApplicationContext applicationContext)

Checks whether the given context is still valid (by checking its service reference) and not yet processed.

Parameters:
  • serviceReference – the service reference for the context
  • applicationContext – the context to check
Returns:

true if the context is invalid or already processed, false otherwise

getLock

protected Object getLock()

Returns an object that should be used as a lock for synchronization of context processing

Returns:a lock for synchronization

markAsProcessed

protected void markAsProcessed(ApplicationContext applicationContext)

Marks the given application context as already processed by this tracker, by saving its id.

Parameters:
  • applicationContext – the application context to be marked as processed

removeFromProcessed

protected void removeFromProcessed(ApplicationContext applicationContext)

Undoes marking an application context as processed by this tracked. Its id is removed from the list of processed ids.

Parameters:
  • applicationContext – the application context to remove from the list of processed contexts