code: public static void put(String instanceName, Driver instance) {
          // Copy current instances
          Map<String, Driver> newInstances = new HashMap<>();
          synchronized (instances) {
              Set<String> keys = instances.getInstances().keySet();
  
              for (String key : keys) {
                  newInstances.put(key, instances.getInstances().get(key));
              }
          }
  
          // Add new instance
          newInstances.put(instanceName, instance);
  
          instances = new IndexedInstances(newInstances);
      }
docs: Add/replace instance in current instance map. Work on a copy of the current map and replace it atomically.
  
  @param instanceName
  The name of the provider
  @param instance
  The instance