Java 类com.google.common.collect.Interners 实例源码

项目:neoscada    文件:InternerHelper.java   
public static Interner<String> makeInterner ( final String specificPropertyName, final String defaultType )
{
    final String type = System.getProperty ( specificPropertyName, System.getProperty ( "org.eclipse.scada.defaultStringInterner", defaultType ) );
    if ( "weak".equals ( type ) )
    {
        return new NullSafeInterner ( Interners.<String> newWeakInterner () );
    }
    else if ( "strong".equals ( type ) )
    {
        return new NullSafeInterner ( Interners.<String> newStrongInterner () );
    }
    else if ( "java".equals ( type ) )
    {
        return new JavaStringInterner ();
    }
    else
    {
        return makeNoOpInterner ();
    }
}
项目:openrtb-doubleclick    文件:DoubleClickMetadata.java   
/**
 * Creates the DoubleClickMetadata object.
 *
 * @param transport How to read the many files providing metadata information.
 *     Typically you will use one of the provided implementations,
 *     {@link URLConnectionTransport} or {@link ResourceTransport}
 */
@Inject
public DoubleClickMetadata(Transport transport) {
  Pattern ssvp = Pattern.compile("(\\d+)\\s+(.*)");
  Pattern csvp = Pattern.compile("(\\d+),(.*)");

  Interner<String> interner = Interners.<String>newStrongInterner();
  vendors = load(interner, transport, ssvp, ADX_DICT + "vendors.txt");
  gdnVendors = load(interner, transport, ssvp, ADX_DICT + "gdn-vendors.txt");
  HashMap<Integer, String> cats = new HashMap<>();
  cats.putAll(adSensitiveCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-sensitive-categories.txt"));
  cats.putAll(adProductCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-product-categories.txt"));
  cats.putAll(adRestrictedCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-restricted-categories.txt"));
  allAdCategories = ImmutableMap.copyOf(cats);
  agencies = load(interner, transport, ssvp, ADX_DICT + "agencies.txt");
  HashMap<Integer, String> attrs = new HashMap<>();
  attrs.putAll(pubExcCreativeAttributes =
      load(interner, transport, ssvp, ADX_DICT + "publisher-excludable-creative-attributes.txt"));
  attrs.putAll(buyDecCreativeAttributes =
      load(interner, transport, ssvp, ADX_DICT + "buyer-declarable-creative-attributes.txt"));
  allCreativeAttributes = ImmutableMap.copyOf(attrs);
  creativeStatusCodes = load(interner, transport, ssvp, ADX_DICT + "creative-status-codes.txt");
  sellerNetworks = load(interner, transport, ssvp, ADX_DICT + "seller-network-ids.txt");
  siteLists = load(interner, transport, ssvp, ADX_DICT + "site-lists.txt");
  contentLabels = load(interner, transport, ssvp, ADX_DICT + "content-labels.txt");
  publisherVerticals = load(interner, transport, ssvp, ADX_DICT + "publisher-verticals.txt");
  mobileCarriers = load(interner, transport, CSVParser.csvParser(), csvp,
      ADX_DICT + "mobile-carriers.csv");
  geoTargetsByCriteriaId = loadGeoTargets(interner, transport, ADX_DICT + "geo-table.csv");
  HashMap<GeoTarget.CanonicalKey, GeoTarget> byKey = new HashMap<>();
  for (GeoTarget target : geoTargetsByCriteriaId.values()) {
    byKey.put(target.key(), target);
  }
  geoTargetsByCanonicalKey = ImmutableMap.copyOf(byKey);
  dmaRegions = loadCitiesDMARegions(interner, ADX_DICT + "cities-dma-regions.csv");
  countryCodes = loadCountryCodes(interner, ADX_DICT + "countries.txt");
}
项目:creeper    文件:PlayerManagement.java   
private Interner<String> findInterner() {
    Player player = gameManager.getPlayerManager().getPlayer(playerId);
    Interner<String> interner;
    if (player == null) {
        interner = Interners.newWeakInterner();
    } else {
        interner = player.getInterner();
    }
    return interner;
}
项目:incubator-sentry    文件:SimpleFileProviderBackend.java   
public SimpleFileProviderBackend(Configuration conf, Path resourcePath) throws IOException {
  this.resourcePath = resourcePath;
  this.fileSystem = resourcePath.getFileSystem(conf);
  this.groupRolePrivilegeTable = HashBasedTable.create();
  this.conf = conf;
  this.configErrors = Lists.newArrayList();
  this.configWarnings = Lists.newArrayList();
  this.validators = ImmutableList.of();
  this.allowPerDatabaseSection = true;
  this.initialized = false;
  this.stringInterner = Interners.newWeakInterner();
}
项目:Reer    文件:StringInterner.java   
public StringInterner() {
    this.interner = Interners.newWeakInterner();
}
项目:ResearchCode    文件:XFactoryEfficientImpl.java   
public XFactoryEfficientImpl() {
    super();
    // Use an weak references as this factory may stay around in the XFactoryRegistry for a long time
    interner = Interners.newWeakInterner();
}
项目:ResearchCode    文件:XFactoryMemoryImpl.java   
public XFactoryMemoryImpl() {
    super();
    // Use an weak references as this factory may stay around in the XFactoryRegistry for a long time
    interner = Interners.newWeakInterner();
}
项目:SEWOL    文件:XFactoryNaiveImpl.java   
public XFactoryNaiveImpl() {
    super();
    // Use an weak references as this factory may stay around in the XFactoryRegistry for a long time 
    interner = Interners.newWeakInterner();
}
项目:mongowp    文件:WeakMapStringPool.java   
public WeakMapStringPool(StringPoolPolicy heuristic) {
  super(heuristic);
  this.interner = Interners.newWeakInterner();
}
项目:bazel    文件:BlazeInterners.java   
public static <T> Interner<T> newWeakInterner() {
  return setConcurrencyLevel(Interners.newBuilder().weak()).build();
}
项目:bazel    文件:BlazeInterners.java   
public static <T> Interner<T> newStrongInterner() {
  return setConcurrencyLevel(Interners.newBuilder().strong()).build();
}