Chapter 7: Concurrency Flashcards

1
Q

ExecutorService method, Executes a Runnable task at some point in the future

A

void execute(Runnable command)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ExecutorService method, executes a task at some point in the future and returns Future representing the task.

A

Future> submit(Runnable command)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ExecutorService method, executes a Callable task at some point in the future and returns a Future representing the pending results of the task

A

Future submit(Callable task)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

List > invokeAll( Collection extends Callable> tasks throws InterruptedException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ExecutorService method, Executes the given tasks, synchronously returning the result of one of finished tasks, cancelling any unfinished tasks

A

T invokeAny( Collection extends Callable> tasks) throws InterruptedException, ExecutionException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Future method, returns true if task was completed

A

boolean isDone()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Future method, returns true if the task was canceled before it completed normally

A

boolean isCancelled()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Future method, attempts to cancel execution of the task

A

boolean cancel()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Future method, retrieves the result of a task, waiting endlessly if it is not yet available

A

V get()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Future method, retrieves the result of a task, waiting the specified amount of time.

A

V get(long timeout, TimeUnit unit)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Enumerate the Synchronized Collections

A
Collections.synchronizedCollection();
Collections.synchronizedMap();
Collections.synchronizedSet();
Collections.synchronizedList();
Collections.synchronizedSortedMap();
Collections.synchronizedSortedList();
Collections.synchronizedNavigableMap();
Collections.synchronizedNavigableSet();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly