/** * Creates a new instance of {@link DefaultBlockMaster}. * * @param metricsMaster the metrics master * @param masterContext the context for Alluxio master * @param clock the clock to use for determining the time * @param executorServiceFactory a factory for creating the executor service to use for running * maintenance threads */ DefaultBlockMaster(MetricsMaster metricsMaster, CoreMasterContext masterContext, Clock clock, ExecutorServiceFactory executorServiceFactory) { super(masterContext, clock, executorServiceFactory); Preconditions.checkNotNull(metricsMaster, "metricsMaster"); mBlockStore = masterContext.getBlockStoreFactory() .apply(new BlockStoreArgs(ServerConfiguration.global())); mGlobalStorageTierAssoc = new MasterStorageTierAssoc(); mMetricsMaster = metricsMaster; Metrics.registerGauges(this); }
private ChainingListenableFuture( AsyncFunction<? super I, ? extends O> function, ListenableFuture<? extends I> inputFuture) { this.function = checkNotNull(function); this.inputFuture = checkNotNull(inputFuture); }
TransformedEntriesMultimap(Multimap<K, V1> fromMultimap, final EntryTransformer<? super K, ? super V1, V2> transformer) { this.fromMultimap = checkNotNull(fromMultimap); this.transformer = checkNotNull(transformer); }
@Override public int compare(Comparable left, Comparable right) { checkNotNull(left); // for GWT checkNotNull(right); return left.compareTo(right); }
/** * Creates (but does not start) a new stopwatch, using the specified time * source. * * @deprecated Use {@link Stopwatch#createUnstarted(Ticker)} instead. */ @Deprecated Stopwatch(Ticker ticker) { this.ticker = checkNotNull(ticker, "ticker"); }
OnePlusArrayList(@Nullable E first, E[] rest) { this.first = first; this.rest = checkNotNull(rest); } @Override public int size() {
@Override public V put(R rowKey, C columnKey, V value) { checkNotNull(rowKey); checkNotNull(columnKey); checkNotNull(value); return getOrCreate(rowKey).put(columnKey, value); }
public static JaxRsResource create(RuntimeResource runtimeResource, SourceParser sourceParser) { checkNotNull(runtimeResource); checkNotNull(sourceParser); return new JerseyJaxRsResource(runtimeResource, sourceParser); }
TwoPlusArrayList(@Nullable E first, @Nullable E second, E[] rest) { this.first = first; this.second = second; this.rest = checkNotNull(rest); } @Override public int size() {
private ToStringHelper addHolder(String name, @Nullable Object value) { ValueHolder valueHolder = addHolder(); valueHolder.value = value; valueHolder.name = checkNotNull(name); return this; }
private ToStringHelper addHolder(String name, @Nullable Object value) { ValueHolder valueHolder = addHolder(); valueHolder.value = value; valueHolder.name = checkNotNull(name); return this; }
/** * Returns a predicate that evaluates to {@code true} if both of its * components evaluate to {@code true}. The components are evaluated in * order, and evaluation will be "short-circuited" as soon as a false * predicate is found. */ public static <T> Predicate<T> and(Predicate<? super T> first, Predicate<? super T> second) { return new AndPredicate<T>(Predicates.<T>asList( checkNotNull(first), checkNotNull(second))); }
/** Standard constructor. */ protected AbstractMapBasedMultiset(Map<E, Count> backingMap) { this.backingMap = checkNotNull(backingMap); this.size = super.size(); }
/** * Returns a matcher that matches any character matched by either this matcher or {@code other}. */ public CharMatcher or(CharMatcher other) { return new Or(this, checkNotNull(other)); }
@Override public Collection<V> replaceValues(@Nullable K key, Iterable<? extends V> values) { checkNotNull(values); Collection<V> result = removeAll(key); putAll(key, values); return result; }
/** * Returns a view of the specified string as an immutable list of {@code * Character} values. * * @since 7.0 */ @Beta public static ImmutableList<Character> charactersOf(String string) { return new StringAsImmutableList(checkNotNull(string)); }
/** * Sets a custom {@code Equivalence} strategy for comparing keys. * * <p>By default, the cache uses {@link Equivalence#identity} to determine key equality when * {@link #weakKeys} is specified, and {@link Equivalence#equals()} otherwise. */ @GwtIncompatible("To be supported") CacheBuilder<K, V> keyEquivalence(Equivalence<Object> equivalence) { checkState(keyEquivalence == null, "key equivalence was already set to %s", keyEquivalence); keyEquivalence = checkNotNull(equivalence); return this; }
@Override public final <T> T[] toArray(T[] other) { checkNotNull(other); int size = size(); if (other.length < size) { other = ObjectArrays.newArray(other, size); } else if (other.length > size) { other[size] = null; } copyIntoArray(other, 0); return other; }
@Nullable public V getIfPresent(Object key) { int hash = hash(checkNotNull(key)); V value = segmentFor(hash).get(key, hash); if (value == null) { globalStatsCounter.recordMisses(1); } else { globalStatsCounter.recordHits(1); } return value; }
PowerSet(Set<E> input) { ImmutableMap.Builder<E, Integer> builder = ImmutableMap.builder(); int i = 0; for (E e : checkNotNull(input)) { builder.put(e, i++); } this.inputSet = builder.build(); checkArgument(inputSet.size() <= 30, "Too many elements to create power set: %s > 30", inputSet.size()); }