On 9/12/14 2:37 PM, Alan Bateman wrote:
On 12/09/2014 11:45, Daniel Fuchs wrote:

I am still unconvinced this is worth the additional
complexity it would bring to the implementation.
The deprecated methods were using HashMap to store listeners,
and therefore the order in which listeners were invoked was also
undefined. Nobody has ever complained.

I'm not convinced either. The previous methods were rarely used (prior
to their deprecation and eventual removal there was a static analysis
done on tens of thousands of projects to get some data on actual usage
and there were only a handful of actual usages). The only reason for
introducing alternative methods is that there is a solution for the tiny
number of cases where LogManager can't be sub-classes. So I think it's
best to keep it as simpler as possible.

Would modifying the specification of addConfigurationListener()
as follows be sufficient to make the workings of the proposed
implementation clearer?

    /**
     * Adds a configuration listener to be invoked each time the logging
     * properties are read and the configuration is changed.
     * If the listener is already registered the method does nothing.
     * <p>
     * The order in which the listeners are invoked is unspecified.
     * <br>
     * If a security manager is on, each listener will be invoked in the
     * {@linkplain AccessControlContext security context} with which it was
     * registered.
     * <p>
     * It is recommended that listeners do not throw errors or exceptions.
     * Exceptions or errors thrown by listeners will
* be propagated to the caller of {@link #readConfiguration()} (or {@link
     * #readConfiguration(java.io.InputStream)}) preventing those listeners
     * that haven't been invoked yet from being fired.
     *
* @param listener A configuration listener that will be invoked after the
     *        configuration changed.
     * @return This LogManager.
     * @throws SecurityException if a security manager exists and if the
     * caller does not have LoggingPermission("control").
     * @throws NullPointerException if the listener is null.
     *
     * @since 1.9
     */
    public LogManager addConfigurationListener(Runnable listener) {

best regards,

-- daniel


-Alan

Reply via email to