AsyncCompleter(final Executor executor, final ExceptionPolicy policy, final ExecutorCompletionServiceFactory completionServiceFactory, CompletionServiceDecorator completionServiceDecorator) { this.executor = notNull("executor", executor); this.policy = notNull("policy", policy); this.completionServiceFactory = notNull("completionServiceFactory", completionServiceFactory); this.completionServiceDecorator = completionServiceDecorator; }
public RuntimeExecutionException(final String message, final ExecutionException cause) { super(message, notNull("cause", cause)); } }
public Builder name(final String name) { this.name = notNull("name", name); return this; }
public LoadingCache(final SynchronizedLoadingCacheDecorator cache, final CacheLoader<K, V> loader) throws CacheException { super(cache, DEFAULT_NUMBER_OF_MUTEXES); this.loader = notNull("loader", loader); this.delegate = cache; }
public RuntimeTimeoutException(final String message, final TimeoutException cause) { super(message, notNull("cause", cause)); }
private static <K, V> CopyOnWriteSortedMap<K, V> comparedTreeMap(final Map<? extends K, ? extends V> map, final Type viewType, final Comparator<? super K> comparator) { notNull("comparator", comparator); return new CopyOnWriteSortedMap<K, V>(map, viewType) { private static final long serialVersionUID = -7243810284130497340L; @Override public <N extends Map<? extends K, ? extends V>> SortedMap<K, V> copy(final N map) { final TreeMap<K, V> treeMap = new TreeMap<K, V>(comparator); treeMap.putAll(map); return treeMap; } }; } }
public Builder type(final Type type) { this.type = notNull("type", type); return this; }
IgnoreAndReturnNull(final com.google.common.base.Supplier<T> delegate) { this.delegate = notNull("delegate", delegate); }
/** * Create a new {@link CopyOnWriteMap} with the supplied {@link Map} to * initialize the values. * * @param map the initial map to initialize with * @param viewType for writable or read-only key, value and entrySet views */ protected <N extends Map<? extends K, ? extends V>> AbstractCopyOnWriteMap(final N map, final View.Type viewType) { this.delegate = notNull("delegate", copy(notNull("map", map))); this.view = notNull("viewType", viewType).get(this); }
/** * Construct a new {@link WeakMemoizer} instance. * * @param initialCapacity how large the internal map should be initially. * @param delegate for creating the initial values. * @throws IllegalArgumentException if the initial capacity of elements is * negative. */ WeakMemoizer(final @NotNull Function<K, V> delegate) { this.map = new ConcurrentHashMap<K, MappedReference<K, V>>(); this.delegate = notNull("delegate", delegate); }
/** * Create a Builder with the supplied Executor * * @param executor */ public Builder(@NotNull final Executor executor) { this.executor = notNull("executor", executor); }
Default(final String name, final Type type, final int priority, final UncaughtExceptionHandler exceptionHandler) { namePrefix = notNull("name", name) + ":thread-"; this.type = notNull("type", type); isTrue("priority too low", priority >= Thread.MIN_PRIORITY); isTrue("priority too high", priority <= Thread.MAX_PRIORITY); this.priority = priority; final SecurityManager securityManager = System.getSecurityManager(); final ThreadGroup parent = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup(); group = new ThreadGroup(parent, name); this.exceptionHandler = exceptionHandler; }
ReadWriteManagedLock(final ReadWriteLock lock) { notNull("lock", lock); read = new ManagedLockImpl(lock.readLock()); write = new ManagedLockImpl(lock.writeLock()); }
@Override public void setLogLevel(@Nonnull final String loggerName, @Nonnull final String levelName) { notNull("loggerName", loggerName); notNull("levelName", levelName); getLogger(loggerName).setLevel(Level.toLevel(levelName)); messageHandlerService.sendMessage(ClusterManager.ALL_NODES, new Message(CHANNEL_LEVEL, serializeAsString(loggerName, levelName))); }
@Override public void setLogLevel(@Nonnull final Logger logger, @Nonnull final Level level) { notNull("logger", logger); notNull("level", level); logger.setLevel(level); messageHandlerService.sendMessage(ClusterManager.ALL_NODES, new Message(CHANNEL_LEVEL, serializeAsString(logger.getName(), level.toString()))); }
/** * Set the value of this reference. This method is lock-free. A thread waiting * in {@link #take()} or {@link #take(long, TimeUnit)} will be released and * given this value. * * @param value the new value. */ public void set(@NotNull final V value) { notNull("value", value); internalSet(value); }
/** * Create a new {@link CopyOnWriteSortedMap} where the underlying map * instances are {@link TreeMap}. * <p> * This map has {@link View.Type.STABLE stable} views. * * @param comparator the Comparator to use for ordering the keys. Note, should * be serializable if this map is to be serialized. */ public static <K, V> CopyOnWriteSortedMap<K, V> newTreeMap(final @NotNull Comparator<? super K> comparator) { final Builder<K, V> builder = builder(); notNull("comparator", comparator); return builder.ordering(comparator).newTreeMap(); }