Chapter 7: Concurrency Flashcards
ExecutorService method, Executes a Runnable task at some point in the future
void execute(Runnable command)
ExecutorService method, executes a task at some point in the future and returns Future representing the task.
Future> submit(Runnable command)
ExecutorService method, executes a Callable task at some point in the future and returns a Future representing the pending results of the task
Future submit(Callable task)
ExecutorService, executes the given tasks, synchronously returning the result of all task as a Collection of Future objects, in the same order they were in the origina collection
List > invokeAll( Collection extends Callable> tasks throws InterruptedException
ExecutorService method, Executes the given tasks, synchronously returning the result of one of finished tasks, cancelling any unfinished tasks
T invokeAny( Collection extends Callable> tasks) throws InterruptedException, ExecutionException
Future method, returns true if task was completed
boolean isDone()
Future method, returns true if the task was canceled before it completed normally
boolean isCancelled()
Future method, attempts to cancel execution of the task
boolean cancel()
Future method, retrieves the result of a task, waiting endlessly if it is not yet available
V get()
Future method, retrieves the result of a task, waiting the specified amount of time.
V get(long timeout, TimeUnit unit)
Enumerate the Synchronized Collections
Collections.synchronizedCollection(); Collections.synchronizedMap(); Collections.synchronizedSet(); Collections.synchronizedList(); Collections.synchronizedSortedMap(); Collections.synchronizedSortedList(); Collections.synchronizedNavigableMap(); Collections.synchronizedNavigableSet();