/**
  * Sets the {@link BranchProjectFactory}.
  *
  * @param projectFactory the new {@link BranchProjectFactory}.
  */
 public synchronized void setProjectFactory(BranchProjectFactory<P, R> projectFactory) {
   projectFactory.getClass(); // throw NPE if null
   if (factory == projectFactory) {
     return;
   }
   if (factory != null) {
     factory.setOwner(null);
   }
   factory = projectFactory;
   factory.setOwner(this);
 }
 /** Consolidated initialization code. */
 private synchronized void init2() {
   if (sources == null) {
     sources = new PersistedList<BranchSource>(this);
   }
   if (nullSCMSource == null) {
     nullSCMSource = new NullSCMSource();
   }
   nullSCMSource.setOwner(this);
   for (SCMSource source : getSCMSources()) {
     source.setOwner(this);
   }
   final BranchProjectFactory<P, R> factory = getProjectFactory();
   factory.setOwner(this);
 }