@Override public E apply(E input) { return interner.intern(input); }
@Override public E apply(E input) { return interner.intern(input); }
public void setInterned(Properties p) { if (p != null) { this.interned = INTERNER.intern(p); } else { this.interned = p; } }
public void setInputFileFormatClass( final Class<? extends InputFormat> inputFileFormatClass) { if (inputFileFormatClass == null) { this.inputFileFormatClass = null; } else { this.inputFileFormatClass = (Class<? extends InputFormat>) CLASS_INTERNER.intern(inputFileFormatClass); } }
Protoclass forProto(Protoclass protoclass) { return protoclassInterner.intern(protoclass); } }
@Override public E apply(E input) { return interner.intern(input); }
public ScheduleIndex(String subject, long scheduleTime, long offset, int size, long sequence) { this.subject = INTERNER.intern(subject); this.scheduleTime = scheduleTime; this.offset = offset; this.size = size; this.sequence = sequence; }
public void intern(Interner<TableDesc> interner) { this.tableDesc = interner.intern(tableDesc); }
/** * Intern strings used for tag keys or values. */ public static String intern(String v) { return STR_CACHE.intern(v); }
/** * Returns the canonical representation of a tag. */ public static Tag intern(Tag t) { return TAG_CACHE.intern(t); }
DeclaringType forType(DeclaringType declaringType) { return typeInterner.intern(declaringType); }
DeclaringPackage forPackage(DeclaringPackage declaringPackage) { return packageInterner.intern(declaringPackage); }
/** * Interns and returns a reference to the representative instance * for any of a collection of string instances that are equal to each other. * Retains strong reference to the instance, * thus preventing it from being garbage-collected. * * @param sample string instance to be interned * @return strong reference to interned string instance */ public static String strongIntern(String sample) { if (sample == null) { return null; } return STRONG_INTERNER.intern(sample); }
@Nullable private Map<String, Object> prepareLoadSpec(@Nullable Map<String, Object> loadSpec) { if (loadSpec == null) { return null; } // Load spec is just of 3 entries on average; HashMap/LinkedHashMap consumes much more memory than ArrayMap Map<String, Object> result = new Object2ObjectArrayMap<>(loadSpec.size()); for (Map.Entry<String, Object> e : loadSpec.entrySet()) { result.put(STRING_INTERNER.intern(e.getKey()), e.getValue()); } return result; }
private List<String> prepareDimensionsOrMetrics(@Nullable List<String> list, Interner<List<String>> interner) { if (list == null) { return ImmutableList.of(); } else { List<String> result = list .stream() .filter(s -> !Strings.isNullOrEmpty(s)) // dimensions & metrics are stored as canonical string values to decrease memory required for storing // large numbers of segments. .map(STRING_INTERNER::intern) // TODO replace with ImmutableList.toImmutableList() when updated to Guava 21+ .collect(Collectors.collectingAndThen(Collectors.toList(), ImmutableList::copyOf)); return interner.intern(result); } }
public void setOutputFileFormatClass(final Class<?> outputFileFormatClass) { Class<? extends OutputFormat> outputClass = outputFileFormatClass == null ? null : HiveFileFormatUtils.getOutputFormatSubstitute(outputFileFormatClass); if (outputClass != null) { this.outputFileFormatClass = (Class<? extends HiveOutputFormat>) CLASS_INTERNER.intern(outputClass); } else { this.outputFileFormatClass = outputClass; } }
@SuppressWarnings("unchecked") @Value.Check protected T intern() { return (T) INTERNER.intern(this); } }
@Override public <E> Interner<E> create(Collection<E> contents) { Interner<E> interner = Interners.newWeakInterner(); for (E e : contents) { interner.intern(e); } return interner; } },
@Override public <E> Interner<E> create(Collection<E> contents) { Interner<E> interner = Interners.newStrongInterner(); for (E e : contents) { interner.intern(e); } return interner; } };
@Override public Integer load(Integer key) { return interner.get().intern(-key); } },