code: public static void setCurrentPersistenceBroker(PBKey key, PersistenceBrokerInternal broker)
              throws PBFactoryException
      {
          HashMap map = (HashMap) currentBrokerMap.get();
          WeakHashMap set = null;
          if(map == null)
          {
              map = new HashMap();
              currentBrokerMap.set(map);
  
              synchronized(lock) {
                  loadedHMs.add(map);
              }
          }
          else
          {
              set = (WeakHashMap) map.get(key);
          }
  
          if(set == null)
          {
              // We emulate weak HashSet using WeakHashMap
              set = new WeakHashMap();
              map.put(key, set);
          }
          set.put(broker, null);
      }
docs: Mark a PersistenceBroker as preferred choice for current Thread
  
  @param key    The PBKey the broker is associated to
  @param broker The PersistenceBroker to mark as current