code: public final Factory registerFactory(Factory factory) {
          if (factory == null) {
              throw new NullPointerException();
          }
          try {
              factoryLock.acquireWrite();
              factories.add(0, factory);
              clearCaches();
          }
          finally {
              factoryLock.releaseWrite();
          }
          notifyChanged();
          return factory;
      }
docs: Register a Factory.  Returns the factory if the service accepts
  the factory, otherwise returns null.  The default implementation
  accepts all factories.