Package io.grpc.stub
Class ClientCalls.ThreadlessExecutor
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable>
-
- io.grpc.stub.ClientCalls.ThreadlessExecutor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.Runnable>,java.util.Collection<java.lang.Runnable>,java.util.concurrent.Executor,java.util.Queue<java.lang.Runnable>
- Enclosing class:
- ClientCalls
private static final class ClientCalls.ThreadlessExecutor extends java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> implements java.util.concurrent.Executor
-
-
Constructor Summary
Constructors Constructor Description ThreadlessExecutor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(java.lang.Runnable runnable)private static voidrunQuietly(java.lang.Runnable runnable)voidshutdown()Called after final call towaitAndDrain(), from same thread.private static voidthrowIfInterrupted()voidwaitAndDrain()Waits until there is a Runnable, then executes it and all queued Runnables after it.-
Methods inherited from class java.util.concurrent.ConcurrentLinkedQueue
add, addAll, contains, isEmpty, iterator, offer, peek, poll, remove, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
waitAndDrain
public void waitAndDrain() throws java.lang.InterruptedExceptionWaits until there is a Runnable, then executes it and all queued Runnables after it. Must only be called by one thread at a time.- Throws:
java.lang.InterruptedException
-
shutdown
public void shutdown()
Called after final call towaitAndDrain(), from same thread.
-
runQuietly
private static void runQuietly(java.lang.Runnable runnable)
-
throwIfInterrupted
private static void throwIfInterrupted() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
execute
public void execute(java.lang.Runnable runnable)
- Specified by:
executein interfacejava.util.concurrent.Executor
-
-