Interface ServiceListener
-
- All Superinterfaces:
java.util.EventListener
- All Known Subinterfaces:
AllServiceListener
,UnfilteredServiceListener
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@ConsumerType @FunctionalInterface public interface ServiceListener extends java.util.EventListener
AServiceEvent
listener.ServiceListener
is a listener interface that may be implemented by a bundle developer. When aServiceEvent
is fired, it is synchronously delivered to aServiceListener
. The Framework may deliverServiceEvent
objects to aServiceListener
out of order and may concurrently call and/or reenter aServiceListener
.A
ServiceListener
object is registered with the Framework using theBundleContext.addServiceListener
method.ServiceListener
objects are called with aServiceEvent
object when a service is registered, modified, or is in the process of unregistering.ServiceEvent
object delivery toServiceListener
objects is filtered by the filter specified when the listener was registered. If the Java Runtime Environment supports permissions, then additional filtering is done.ServiceEvent
objects are only delivered to the listener if the bundle which defines the listener object's class has the appropriateServicePermission
to get the service using at least one of the named classes under which the service was registered.ServiceEvent
object delivery toServiceListener
objects is further filtered according to package sources as defined inServiceReference.isAssignableTo(Bundle, String)
.- See Also:
ServiceEvent
,ServicePermission
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
serviceChanged(ServiceEvent event)
Receives notification that a service has had a lifecycle change.
-
-
-
Method Detail
-
serviceChanged
void serviceChanged(ServiceEvent event)
Receives notification that a service has had a lifecycle change.- Parameters:
event
- TheServiceEvent
object.
-
-