public void register(DiagnosticsPlugin plugin) {
        checkNotNull(plugin, "plugin can't be null");
        if (!enabled) {
            return;
        }

        long periodMillis = plugin.getPeriodMillis();
        if (periodMillis < -1) {
            throw new IllegalArgumentException(plugin + " can't return a periodMillis smaller than -1");
        }
        logger.finest(plugin.getClass().toString() + " is " + (periodMillis == DISABLED ? "disabled" : "enabled"));
        if (periodMillis == DISABLED) {
            return;
        }

        pluginsMap.put(plugin.getClass(), plugin);
        plugin.onStart();

        if (periodMillis > 0) {
            // it is a periodic task
            scheduler.scheduleAtFixedRate(new WritePluginTask(plugin), 0, periodMillis, MILLISECONDS);
        } else {
            addStaticPlugin(plugin);
        }
    }
public void register ( DiagnosticsPlugin plugin ) { checkNotNull ( plugin , "plugin can't be null" ) ; if ( ! enabled ) { return ; } long periodMillis = plugin . getPeriodMillis ( ) ; if ( periodMillis < - 1 ) { throw new IllegalArgumentException ( plugin + " can't return a periodMillis smaller than -1" ) ; } logger . finest ( plugin . getClass ( ) . toString ( ) + " is " + ( periodMillis == DISABLED ? "disabled" : "enabled" ) ) ; if ( periodMillis == DISABLED ) { return ; } pluginsMap . put ( plugin . getClass ( ) , plugin ) ; plugin . onStart ( ) ; if ( periodMillis > 0 ) { scheduler . scheduleAtFixedRate ( new WritePluginTask ( plugin ) , 0 , periodMillis , MILLISECONDS ) ; } else { addStaticPlugin ( plugin ) ; } }
Registers a {@link DiagnosticsPlugin}.
<p>
This method is thread-safe.
<p>
There is no checking for duplicate registration.
<p>
If the {@link Diagnostics} is disabled, the call is ignored.

@param plugin the plugin to register
@throws NullPointerException if plugin is {@code null}