If the context module's list of listeners already contains a listener {@code l} such that {@code (l==listener)}, then this method replaces that listener's filter (which may be {@code null}) with the specified one (which may be {@code null}).
The listener is called if the filter criteria is met. To filter based upon the class of the service, the filter should reference the {@link org.jboss.gravia.Constants#OBJECTCLASS} property. If {@code filter} is {@code null}, all services are considered to match the filter.
When using a {@code filter}, it is possible that the {@code ServiceEvent}s for the complete lifecycle of a service will not be delivered to the listener. For example, if the {@code filter} only matches when theproperty {@code x} has the value {@code 1}, the listener will not be called if the service is registered with the property {@code x} not setto the value {@code 1}. Subsequently, when the service is modified setting property {@code x} to the value {@code 1}, the filter will match and the listener will be called with a {@code ServiceEvent} of type{@code MODIFIED}. Thus, the listener will not be called with a {@code ServiceEvent} of type {@code REGISTERED}. @param listener The {@code ServiceListener} object to be added. @param filter The filter criteria. @throws IllegalArgumentException If {@code filter} contains an invalidfilter string that cannot be parsed. @throws IllegalStateException If this ModuleContext is no longer valid. @see ServiceEvent @see ServiceListener
|
|
|
|
|
|