code: public void addPlugin(final Plugin plugin) {
          // put plugin into the repository's reciever map
          synchronized (pluginMap) {
              String name = plugin.getName();
  
              // make sure the plugin has reference to repository
              plugin.setLoggerRepository(getLoggerRepository());
  
              Plugin existingPlugin = (Plugin) pluginMap.get(name);
              if (existingPlugin != null) {
                  existingPlugin.shutdown();
              }
  
              // put the new plugin into the map
              pluginMap.put(name, plugin);
              firePluginStarted(plugin);
          }
      }
docs: Adds a plugin to the plugin registry.
  If a plugin with the same name exists
  already, it is shutdown and removed.
  
  @param plugin the plugin to add.