Uses of Class
com.google.common.annotations.GwtIncompatible
-
Packages that use GwtIncompatible Package Description com.google.common.base Basic utility libraries and interfaces.com.google.common.cache This package contains caching utilities.com.google.common.collect This package contains generic collection interfaces and implementations, and other utilities for working with collections.com.google.common.io This package contains utility methods and classes for working with Java I/O; for example input streams, output streams, readers, writers, and files.com.google.common.math Arithmetic functions operating on primitive values andBigInteger
instances.com.google.common.primitives Static utilities for working with the eight primitive types andvoid
, and value types for treating them as unsigned.com.google.common.util.concurrent Concurrency utilities. -
-
Uses of GwtIncompatible in com.google.common.base
Classes in com.google.common.base with annotations of type GwtIncompatible Modifier and Type Class Description class
StandardSystemProperty
Represents a standard system property.Fields in com.google.common.base with annotations of type GwtIncompatible Modifier and Type Field Description static java.nio.charset.Charset
Charsets. ISO_8859_1
ISO-8859-1: ISO Latin Alphabet Number 1 (ISO-LATIN-1).static java.nio.charset.Charset
Charsets. US_ASCII
US-ASCII: seven-bit ASCII, the Basic Latin block of the Unicode character set (ISO646-US).static java.nio.charset.Charset
Charsets. UTF_16
UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark.static java.nio.charset.Charset
Charsets. UTF_16BE
UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.static java.nio.charset.Charset
Charsets. UTF_16LE
UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.Methods in com.google.common.base with annotations of type GwtIncompatible Modifier and Type Method Description static Predicate<java.lang.Class<?>>
Predicates. assignableFrom(java.lang.Class<?> clazz)
Returns a predicate that evaluates totrue
if the class being tested is assignable from the given class.static Predicate<java.lang.CharSequence>
Predicates. contains(java.util.regex.Pattern pattern)
Returns a predicate that evaluates totrue
if theCharSequence
being tested contains any match for the given regular expression pattern.static Predicate<java.lang.CharSequence>
Predicates. containsPattern(java.lang.String pattern)
Returns a predicate that evaluates totrue
if theCharSequence
being tested contains any match for the given regular expression pattern.static java.lang.reflect.Field
Enums. getField(java.lang.Enum<?> enumValue)
Returns theField
in whichenumValue
is defined.static Predicate<java.lang.Object>
Predicates. instanceOf(java.lang.Class<?> clazz)
Returns a predicate that evaluates totrue
if the object being tested is an instance of the given class.static Splitter
Splitter. on(java.util.regex.Pattern separatorPattern)
Returns a splitter that considers any subsequence matchingpattern
to be a separator.static Splitter
Splitter. onPattern(java.lang.String separatorPattern)
Returns a splitter that considers any subsequence matching a given pattern (regular expression) to be a separator.java.lang.String
Stopwatch. toString()
Returns a string representation of the current elapsed time.java.lang.String
Stopwatch. toString(int significantDigits)
Deprecated.UseStopwatch.toString()
instead. -
Uses of GwtIncompatible in com.google.common.cache
Methods in com.google.common.cache with annotations of type GwtIncompatible Modifier and Type Method Description static <K,V>
CacheLoader<K,V>CacheLoader. asyncReloading(CacheLoader<K,V> loader, java.util.concurrent.Executor executor)
Returns aCacheLoader
which wrapsloader
, executing calls toCacheLoader.reload(K, V)
usingexecutor
.static CacheBuilder<java.lang.Object,java.lang.Object>
CacheBuilder. from(CacheBuilderSpec spec)
Constructs a newCacheBuilder
instance with the settings specified inspec
.static CacheBuilder<java.lang.Object,java.lang.Object>
CacheBuilder. from(java.lang.String spec)
Constructs a newCacheBuilder
instance with the settings specified inspec
.CacheBuilder<K,V>
CacheBuilder. maximumWeight(long weight)
Specifies the maximum weight of entries the cache may contain.CacheBuilder<K,V>
CacheBuilder. refreshAfterWrite(long duration, java.util.concurrent.TimeUnit unit)
Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.ListenableFuture<V>
CacheLoader. reload(K key, V oldValue)
Computes or retrieves a replacement value corresponding to an already-cachedkey
.CacheBuilder<K,V>
CacheBuilder. softValues()
Specifies that each value (not key) stored in the cache should be wrapped in aSoftReference
(by default, strong references are used).CacheBuilder<K,V>
CacheBuilder. weakKeys()
Specifies that each key (not value) stored in the cache should be wrapped in aWeakReference
(by default, strong references are used).CacheBuilder<K,V>
CacheBuilder. weakValues()
Specifies that each value (not key) stored in the cache should be wrapped in aWeakReference
(by default, strong references are used).<K1 extends K,V1 extends V>
CacheBuilder<K1,V1>CacheBuilder. weigher(Weigher<? super K1,? super V1> weigher)
Specifies the weigher to use in determining the weight of entries. -
Uses of GwtIncompatible in com.google.common.collect
Classes in com.google.common.collect with annotations of type GwtIncompatible Modifier and Type Class Description class
ImmutableRangeMap<K extends java.lang.Comparable<?>,V>
ARangeMap
whose contents will never change, with many other important properties detailed atImmutableCollection
.class
ImmutableSortedMultiset<E>
ASortedMultiset
whose contents will never change, with many other important properties detailed atImmutableCollection
.class
TreeRangeMap<K extends java.lang.Comparable,V>
An implementation ofRangeMap
based on aTreeMap
, supporting all optional operations.class
TreeRangeSet<C extends java.lang.Comparable<?>>
An implementation ofRangeSet
backed by aTreeMap
.Methods in com.google.common.collect with annotations of type GwtIncompatible Modifier and Type Method Description static <K,V>
java.util.NavigableMap<K,V>Maps. asMap(java.util.NavigableSet<K> set, Function<? super K,V> function)
Returns a view of the navigable set as a map, mapping keys from the set according to the specified function.java.util.NavigableMap<K,java.util.Collection<V>>
TreeMultimap. asMap()
Returns a map view that associates each key with the corresponding values in the multimap.E
ImmutableSortedSet. ceiling(E e)
static <T> T[]
ObjectArrays. concat(T[] first, T[] second, java.lang.Class<T> type)
Returns a new array that contains the concatenated contents of two arrays.abstract UnmodifiableIterator<E>
ImmutableSortedSet. descendingIterator()
ImmutableSortedSet<E>
ImmutableSortedSet. descendingSet()
<T> FluentIterable<T>
FluentIterable. filter(java.lang.Class<T> type)
Returns the elements from this fluent iterable that are instances of classtype
.static <T> java.lang.Iterable<T>
Iterables. filter(java.lang.Iterable<?> unfiltered, java.lang.Class<T> type)
Returns all instances of classtype
inunfiltered
.static <T> UnmodifiableIterator<T>
Iterators. filter(java.util.Iterator<?> unfiltered, java.lang.Class<T> type)
Returns all instances of classtype
inunfiltered
.static <E> java.util.NavigableSet<E>
Sets. filter(java.util.NavigableSet<E> unfiltered, Predicate<? super E> predicate)
Returns the elements of aNavigableSet
,unfiltered
, that satisfy a predicate.static <K,V>
java.util.NavigableMap<K,V>Maps. filterEntries(java.util.NavigableMap<K,V> unfiltered, Predicate<? super java.util.Map.Entry<K,V>> entryPredicate)
Returns a sorted map containing the mappings inunfiltered
that satisfy a predicate.static <K,V>
java.util.NavigableMap<K,V>Maps. filterKeys(java.util.NavigableMap<K,V> unfiltered, Predicate<? super K> keyPredicate)
Returns a navigable map containing the mappings inunfiltered
whose keys satisfy a predicate.static <K,V>
java.util.NavigableMap<K,V>Maps. filterValues(java.util.NavigableMap<K,V> unfiltered, Predicate<? super V> valuePredicate)
Returns a navigable map containing the mappings inunfiltered
whose values satisfy a predicate.E
ImmutableSortedSet. floor(E e)
static ImmutableMap<java.lang.String,java.lang.String>
Maps. fromProperties(java.util.Properties properties)
Creates anImmutableMap<String, String>
from aProperties
instance.java.util.NavigableSet<V>
TreeMultimap. get(K key)
ContiguousSet<C>
ContiguousSet. headSet(C toElement, boolean inclusive)
ImmutableSortedSet<E>
ImmutableSortedSet. headSet(E toElement, boolean inclusive)
E
ImmutableSortedSet. higher(E e)
java.util.NavigableSet<K>
TreeMultimap. keySet()
Returns a view collection of all distinct keys contained in this multimap.E
ImmutableSortedSet. lower(E e)
static <T> T[]
ObjectArrays. newArray(java.lang.Class<T> type, int length)
Returns a new array of the given length with the specified component type.static <E> java.util.concurrent.CopyOnWriteArrayList<E>
Lists. newCopyOnWriteArrayList()
Creates an emptyCopyOnWriteArrayList
instance.static <E> java.util.concurrent.CopyOnWriteArrayList<E>
Lists. newCopyOnWriteArrayList(java.lang.Iterable<? extends E> elements)
Creates aCopyOnWriteArrayList
instance containing the given elements.static <E> java.util.concurrent.CopyOnWriteArraySet<E>
Sets. newCopyOnWriteArraySet()
Creates an emptyCopyOnWriteArraySet
instance.static <E> java.util.concurrent.CopyOnWriteArraySet<E>
Sets. newCopyOnWriteArraySet(java.lang.Iterable<? extends E> elements)
Creates aCopyOnWriteArraySet
instance containing the given elements.static <E> Interner<E>
Interners. newWeakInterner()
Returns a new thread-safe interner which retains a weak reference to each instance it has interned, and so does not prevent these instances from being garbage-collected.E
ImmutableSortedSet. pollFirst()
Deprecated.Unsupported operation.E
ImmutableSortedSet. pollLast()
Deprecated.Unsupported operation.ContiguousSet<C>
ContiguousSet. subSet(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)
ImmutableSortedSet<E>
ImmutableSortedSet. subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
static <K,V>
java.util.NavigableMap<K,V>Maps. synchronizedNavigableMap(java.util.NavigableMap<K,V> navigableMap)
Returns a synchronized (thread-safe) navigable map backed by the specified navigable map.static <E> java.util.NavigableSet<E>
Sets. synchronizedNavigableSet(java.util.NavigableSet<E> navigableSet)
Returns a synchronized (thread-safe) navigable set backed by the specified navigable set.ContiguousSet<C>
ContiguousSet. tailSet(C fromElement, boolean inclusive)
ImmutableSortedSet<E>
ImmutableSortedSet. tailSet(E fromElement, boolean inclusive)
V[][]
ArrayTable. toArray(java.lang.Class<V> valueClass)
Returns a two-dimensional array with the table contents.E[]
FluentIterable. toArray(java.lang.Class<E> type)
Returns an array containing all of the elements from this fluent iterable in iteration order.static <T> T[]
Iterables. toArray(java.lang.Iterable<? extends T> iterable, java.lang.Class<T> type)
Copies an iterable's elements into an array.static <T> T[]
Iterators. toArray(java.util.Iterator<? extends T> iterator, java.lang.Class<T> type)
Copies an iterator's elements into an array.static <K,V1,V2>
java.util.NavigableMap<K,V2>Maps. transformEntries(java.util.NavigableMap<K,V1> fromMap, Maps.EntryTransformer<? super K,? super V1,V2> transformer)
Returns a view of a navigable map whose values are derived from the original navigable map's entries.static <K,V1,V2>
java.util.NavigableMap<K,V2>Maps. transformValues(java.util.NavigableMap<K,V1> fromMap, Function<? super V1,V2> function)
Returns a view of a navigable map where each value is transformed by a function.static <K,V>
java.util.NavigableMap<K,V>Maps. unmodifiableNavigableMap(java.util.NavigableMap<K,V> map)
Returns an unmodifiable view of the specified navigable map.static <E> java.util.NavigableSet<E>
Sets. unmodifiableNavigableSet(java.util.NavigableSet<E> set)
Returns an unmodifiable view of the specified navigable set.MapMaker
MapMaker. weakKeys()
Specifies that each key (not value) stored in the map should be wrapped in aWeakReference
(by default, strong references are used).MapMaker
MapMaker. weakValues()
Specifies that each value (not key) stored in the map should be wrapped in aWeakReference
(by default, strong references are used). -
Uses of GwtIncompatible in com.google.common.io
Methods in com.google.common.io with annotations of type GwtIncompatible Modifier and Type Method Description ByteSource
BaseEncoding. decodingSource(CharSource encodedSource)
Returns aByteSource
that reads base-encoded bytes from the specifiedCharSource
.abstract java.io.InputStream
BaseEncoding. decodingStream(java.io.Reader reader)
Returns anInputStream
that decodes base-encoded input from the specifiedReader
.ByteSink
BaseEncoding. encodingSink(CharSink encodedSink)
Returns aByteSink
that writes base-encoded bytes to the specifiedCharSink
.abstract java.io.OutputStream
BaseEncoding. encodingStream(java.io.Writer writer)
Returns anOutputStream
that encodes bytes using this encoding into the specifiedWriter
. -
Uses of GwtIncompatible in com.google.common.math
Methods in com.google.common.math with annotations of type GwtIncompatible Modifier and Type Method Description static int
IntMath. binomial(int n, int k)
Returnsn
choosek
, also known as the binomial coefficient ofn
andk
, orInteger.MAX_VALUE
if the result does not fit in anint
.static long
LongMath. checkedAdd(long a, long b)
Returns the sum ofa
andb
, provided it does not overflow.static long
LongMath. checkedMultiply(long a, long b)
Returns the product ofa
andb
, provided it does not overflow.static long
LongMath. checkedPow(long b, int k)
Returns theb
to thek
th power, provided it does not overflow.static long
LongMath. checkedSubtract(long a, long b)
Returns the difference ofa
andb
, provided it does not overflow.static java.math.BigInteger
BigIntegerMath. divide(java.math.BigInteger p, java.math.BigInteger q, java.math.RoundingMode mode)
Returns the result of dividingp
byq
, rounding using the specifiedRoundingMode
.static long
LongMath. divide(long p, long q, java.math.RoundingMode mode)
Returns the result of dividingp
byq
, rounding using the specifiedRoundingMode
.static long
LongMath. factorial(int n)
Returnsn!
, that is, the product of the firstn
positive integers,1
ifn == 0
, orLong.MAX_VALUE
if the result does not fit in along
.static boolean
DoubleMath. isMathematicalInteger(double x)
Returnstrue
ifx
represents a mathematical integer.static boolean
DoubleMath. isPowerOfTwo(double x)
Returnstrue
ifx
is exactly equal to2^k
for some finite integerk
.static int
BigIntegerMath. log10(java.math.BigInteger x, java.math.RoundingMode mode)
Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
IntMath. log10(int x, java.math.RoundingMode mode)
Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
LongMath. log10(long x, java.math.RoundingMode mode)
Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
DoubleMath. log2(double x, java.math.RoundingMode mode)
Returns the base 2 logarithm of a double value, rounded with the specified rounding mode to anint
.static double
DoubleMath. mean(double... values)
Returns the arithmetic mean ofvalues
.static double
DoubleMath. mean(java.lang.Iterable<? extends java.lang.Number> values)
Returns the arithmetic mean ofvalues
.static double
DoubleMath. mean(java.util.Iterator<? extends java.lang.Number> values)
Returns the arithmetic mean ofvalues
.static int
LongMath. mod(long x, int m)
Returnsx mod m
, a non-negative value less thanm
.static long
LongMath. mod(long x, long m)
Returnsx mod m
, a non-negative value less thanm
.static int
IntMath. pow(int b, int k)
Returnsb
to thek
th power.static long
LongMath. pow(long b, int k)
Returnsb
to thek
th power.static java.math.BigInteger
DoubleMath. roundToBigInteger(double x, java.math.RoundingMode mode)
Returns theBigInteger
value that is equal tox
rounded with the specified rounding mode, if possible.static int
DoubleMath. roundToInt(double x, java.math.RoundingMode mode)
Returns theint
value that is equal tox
rounded with the specified rounding mode, if possible.static long
DoubleMath. roundToLong(double x, java.math.RoundingMode mode)
Returns thelong
value that is equal tox
rounded with the specified rounding mode, if possible.static java.math.BigInteger
BigIntegerMath. sqrt(java.math.BigInteger x, java.math.RoundingMode mode)
Returns the square root ofx
, rounded with the specified rounding mode.static int
IntMath. sqrt(int x, java.math.RoundingMode mode)
Returns the square root ofx
, rounded with the specified rounding mode.static long
LongMath. sqrt(long x, java.math.RoundingMode mode)
Returns the square root ofx
, rounded with the specified rounding mode. -
Uses of GwtIncompatible in com.google.common.primitives
Methods in com.google.common.primitives with annotations of type GwtIncompatible Modifier and Type Method Description static char
Chars. fromByteArray(byte[] bytes)
Returns thechar
value whose big-endian representation is stored in the first 2 bytes ofbytes
; equivalent toByteBuffer.wrap(bytes).getChar()
.static int
Ints. fromByteArray(byte[] bytes)
Returns theint
value whose big-endian representation is stored in the first 4 bytes ofbytes
; equivalent toByteBuffer.wrap(bytes).getInt()
.static short
Shorts. fromByteArray(byte[] bytes)
Returns theshort
value whose big-endian representation is stored in the first 2 bytes ofbytes
; equivalent toByteBuffer.wrap(bytes).getShort()
.static char
Chars. fromBytes(byte b1, byte b2)
Returns thechar
value whose byte representation is the given 2 bytes, in big-endian order; equivalent toChars.fromByteArray(new byte[] {b1, b2})
.static int
Ints. fromBytes(byte b1, byte b2, byte b3, byte b4)
Returns theint
value whose byte representation is the given 4 bytes, in big-endian order; equivalent toInts.fromByteArray(new byte[] {b1, b2, b3, b4})
.static short
Shorts. fromBytes(byte b1, byte b2)
Returns theshort
value whose byte representation is the given 2 bytes, in big-endian order; equivalent toShorts.fromByteArray(new byte[] {b1, b2})
.UnsignedInteger
UnsignedInteger. times(UnsignedInteger val)
Returns the result of multiplying this andval
.static byte[]
Chars. toByteArray(char value)
Returns a big-endian representation ofvalue
in a 2-element byte array; equivalent toByteBuffer.allocate(2).putChar(value).array()
.static byte[]
Ints. toByteArray(int value)
Returns a big-endian representation ofvalue
in a 4-element byte array; equivalent toByteBuffer.allocate(4).putInt(value).array()
.static byte[]
Shorts. toByteArray(short value)
Returns a big-endian representation ofvalue
in a 2-element byte array; equivalent toByteBuffer.allocate(2).putShort(value).array()
.static java.lang.Double
Doubles. tryParse(java.lang.String string)
Parses the specified string as a double-precision floating point value.static java.lang.Float
Floats. tryParse(java.lang.String string)
Parses the specified string as a single-precision floating point value. -
Uses of GwtIncompatible in com.google.common.util.concurrent
Methods in com.google.common.util.concurrent with annotations of type GwtIncompatible Modifier and Type Method Description static void
MoreExecutors. addDelayedShutdownHook(java.util.concurrent.ExecutorService service, long terminationTimeout, java.util.concurrent.TimeUnit timeUnit)
Add a shutdown hook to wait for thread completion in the givenservice
.static void
Uninterruptibles. awaitUninterruptibly(java.util.concurrent.CountDownLatch latch)
Invokeslatch.
await()
uninterruptibly.static boolean
Uninterruptibles. awaitUninterruptibly(java.util.concurrent.CountDownLatch latch, long timeout, java.util.concurrent.TimeUnit unit)
Invokeslatch.
await(timeout, unit)
uninterruptibly.static <V,X extends java.lang.Throwable>
ListenableFuture<V>Futures. catching(ListenableFuture<? extends V> input, java.lang.Class<X> exceptionType, Function<? super X,? extends V> fallback)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V,X extends java.lang.Throwable>
ListenableFuture<V>Futures. catching(ListenableFuture<? extends V> input, java.lang.Class<X> exceptionType, Function<? super X,? extends V> fallback, java.util.concurrent.Executor executor)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V,X extends java.lang.Throwable>
ListenableFuture<V>Futures. catchingAsync(ListenableFuture<? extends V> input, java.lang.Class<X> exceptionType, AsyncFunction<? super X,? extends V> fallback)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V,X extends java.lang.Throwable>
ListenableFuture<V>Futures. catchingAsync(ListenableFuture<? extends V> input, java.lang.Class<X> exceptionType, AsyncFunction<? super X,? extends V> fallback, java.util.concurrent.Executor executor)
Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V,X extends java.lang.Exception>
VFutures. get(java.util.concurrent.Future<V> future, long timeout, java.util.concurrent.TimeUnit unit, java.lang.Class<X> exceptionClass)
Deprecated.UseFutures.getChecked(Future, Class, long, TimeUnit)
, noting the change in parameter order.static <V,X extends java.lang.Exception>
VFutures. get(java.util.concurrent.Future<V> future, java.lang.Class<X> exceptionClass)
Deprecated.static <V,X extends java.lang.Exception>
VFutures. getChecked(java.util.concurrent.Future<V> future, java.lang.Class<X> exceptionClass)
Returns the result ofFuture.get()
, converting most exceptions to a new instance of the given checked exception type.static <V,X extends java.lang.Exception>
VFutures. getChecked(java.util.concurrent.Future<V> future, java.lang.Class<X> exceptionClass, long timeout, java.util.concurrent.TimeUnit unit)
Returns the result ofFuture.get(long, TimeUnit)
, converting most exceptions to a new instance of the given checked exception type.static java.util.concurrent.ExecutorService
MoreExecutors. getExitingExecutorService(java.util.concurrent.ThreadPoolExecutor executor)
Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static java.util.concurrent.ExecutorService
MoreExecutors. getExitingExecutorService(java.util.concurrent.ThreadPoolExecutor executor, long terminationTimeout, java.util.concurrent.TimeUnit timeUnit)
Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static java.util.concurrent.ScheduledExecutorService
MoreExecutors. getExitingScheduledExecutorService(java.util.concurrent.ScheduledThreadPoolExecutor executor)
Converts the given ThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static java.util.concurrent.ScheduledExecutorService
MoreExecutors. getExitingScheduledExecutorService(java.util.concurrent.ScheduledThreadPoolExecutor executor, long terminationTimeout, java.util.concurrent.TimeUnit timeUnit)
Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static <V> V
Futures. getUnchecked(java.util.concurrent.Future<V> future)
Returns the result of callingFuture.get()
uninterruptibly on a task known not to throw a checked exception.static <V> V
Uninterruptibles. getUninterruptibly(java.util.concurrent.Future<V> future, long timeout, java.util.concurrent.TimeUnit unit)
Invokesfuture.
get(timeout, unit)
uninterruptibly.static <V> ListenableFuture<V>
Futures. immediateCancelledFuture()
Creates aListenableFuture
which is cancelled immediately upon construction, so thatisCancelled()
always returnstrue
.static <V,X extends java.lang.Exception>
CheckedFuture<V,X>Futures. immediateCheckedFuture(V value)
Returns aCheckedFuture
which has its value set immediately upon construction.static <V,X extends java.lang.Exception>
CheckedFuture<V,X>Futures. immediateFailedCheckedFuture(X exception)
Returns aCheckedFuture
which has an exception set immediately upon construction.static <T> ImmutableList<ListenableFuture<T>>
Futures. inCompletionOrder(java.lang.Iterable<? extends ListenableFuture<? extends T>> futures)
Returns a list of delegate futures that correspond to the futures received in the order that they complete.static void
Uninterruptibles. joinUninterruptibly(java.lang.Thread toJoin)
InvokestoJoin.
join()
uninterruptibly.static void
Uninterruptibles. joinUninterruptibly(java.lang.Thread toJoin, long timeout, java.util.concurrent.TimeUnit unit)
Invokesunit.
timedJoin(toJoin, timeout)
uninterruptibly.static <I,O>
java.util.concurrent.Future<O>Futures. lazyTransform(java.util.concurrent.Future<I> input, Function<? super I,? extends O> function)
LikeFutures.transform(ListenableFuture, Function)
except that the transformationfunction
is invoked on each call toget()
on the returned future.static ListeningExecutorService
MoreExecutors. listeningDecorator(java.util.concurrent.ExecutorService delegate)
Creates anExecutorService
whosesubmit
andinvokeAll
methods submitListenableFutureTask
instances to the given delegate executor.static ListeningScheduledExecutorService
MoreExecutors. listeningDecorator(java.util.concurrent.ScheduledExecutorService delegate)
Creates aScheduledExecutorService
whosesubmit
andinvokeAll
methods submitListenableFutureTask
instances to the given delegate executor.static <V,X extends java.lang.Exception>
CheckedFuture<V,X>Futures. makeChecked(ListenableFuture<V> future, Function<? super java.lang.Exception,X> mapper)
Creates aCheckedFuture
out of a normalListenableFuture
and aFunction
that maps fromException
instances into the appropriate checked type.static ListeningExecutorService
MoreExecutors. newDirectExecutorService()
Creates an executor service that runs each task in the thread that invokesexecute/submit
, as inThreadPoolExecutor.CallerRunsPolicy
This applies both to individually submitted tasks and to collections of tasks submitted viainvokeAll
orinvokeAny
.static <V> ListenableFuture<V>
Futures. nonCancellationPropagating(ListenableFuture<V> future)
Creates a newListenableFuture
whose result is set from the supplied future when it completes.static java.util.concurrent.ThreadFactory
MoreExecutors. platformThreadFactory()
Returns a default thread factory used to create new threads.static <E> void
Uninterruptibles. putUninterruptibly(java.util.concurrent.BlockingQueue<E> queue, E element)
Invokesqueue.
put(element)
uninterruptibly.static ListeningExecutorService
MoreExecutors. sameThreadExecutor()
Deprecated.UseMoreExecutors.directExecutor()
if you only require anExecutor
andMoreExecutors.newDirectExecutorService()
if you need aListeningExecutorService
.static boolean
MoreExecutors. shutdownAndAwaitTermination(java.util.concurrent.ExecutorService service, long timeout, java.util.concurrent.TimeUnit unit)
Shuts down the given executor gradually, first disabling new submissions and later cancelling existing tasks.static void
Uninterruptibles. sleepUninterruptibly(long sleepFor, java.util.concurrent.TimeUnit unit)
Invokesunit.
sleep(sleepFor)
uninterruptibly.static <E> E
Uninterruptibles. takeUninterruptibly(java.util.concurrent.BlockingQueue<E> queue)
Invokesqueue.
take()
uninterruptibly.static boolean
Uninterruptibles. tryAcquireUninterruptibly(java.util.concurrent.Semaphore semaphore, int permits, long timeout, java.util.concurrent.TimeUnit unit)
Invokessemaphore.
tryAcquire(permits, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles. tryAcquireUninterruptibly(java.util.concurrent.Semaphore semaphore, long timeout, java.util.concurrent.TimeUnit unit)
Invokessemaphore.
tryAcquire(1, timeout, unit)
uninterruptibly.static <V> ListenableFuture<V>
Futures. withTimeout(ListenableFuture<V> delegate, long time, java.util.concurrent.TimeUnit unit, java.util.concurrent.ScheduledExecutorService scheduledExecutor)
Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.
-