docs: public static void getExtensions(Map<String, String> map)
                      throws IllegalArgumentException {
          if (map == null) {
              throw new IllegalArgumentException(
                              "Parameter 'map' can not be null.");
          }
          if (recursion.get() == Boolean.TRUE) {
              return;
          }
          recursion.set(Boolean.TRUE);
          LinkedList<String> cleanup = new LinkedList<String>();
          r.lock();
          try {
              for (Map.Entry<String, WeakReference<Extension>> entry : extensionMap
                              .entrySet()) {
                  Extension extension = entry.getValue().get();
                  if (extension == null) {
                      cleanup.add(entry.getKey());
                  } else {
                      String value = extension.getValue();
                      if (value != null) {
                          map.put(entry.getKey(), value);
                      }
                  }
              }
          } finally {
              r.unlock();
              recursion.remove();
          }
          if (cleanup.size() > 0) {
              w.lock();
              try {
                  for (String key : cleanup) {
                      WeakReference<Extension> extension = extensionMap
                                      .remove(key);
                      if (extension != null && extension.get() != null) {
                          // Special case! Somebody has put new extension for this
                          // key after we released
                          // read lock and before we took write lock. We need to
                          // put it back.
                          extensionMap.put(key, extension);
                      }
                  }
              } finally {
                  w.unlock();
              }
          }
          if (extensions.get() != null) {
              for (Entry<String, String> entry : extensions.get().entrySet()) {
                  map.put(entry.getKey(), entry.getValue());
              }
          }
  
      }