AZK CP Concurrent API Packages

Home > Preview

The flashcards below were created by user flashsmilenet on FreezingBlue Flashcards.


  1. Concurrent API Packages
       - contained in package:
       - and in subpackages:
    • contained in package
    •    - java.util.concurrent 
    • and in subpackages
    •    - java.util.concurrent.atomic
    •    - java.util.concurrent.locks
  2. java.util.concurrent defines the following key features: (4)
    • 1) Synchronizers
    • 2) Executors
    • 3) Concurrent collections
    • 4) The Fork/Join Framework
  3. Synchronizers
    - defined in ...
    - offer ...
    • - defined in java.util.concurrent
    • - offer high-level ways of synchronizing the interactions between multiple threads
  4. synchronizer classes: (5)
    • 1) Semaphore
    • 2) CountDownLatch
    • 3) CyclicBarrier
    • 4) Exchanger
    • 5) Phaser
  5. synchronizer class that implements the classic semaphore
    Semaphore
  6. Semaphore
    • - synchronizer class
    • - Implements the classic semaphore
  7. synchronizer class that waits until a specified number of events have occurred.
    CountDownLatch
  8. CountDownLatch
    • - synchronizer class
    • - Waits until a specified number of events have occurred.
  9. synchronizer class that enables a group of threads to wait at a predefined execution point.
    CyclicBarrier
  10. CyclicBarrier
    • - synchronizer class
    • - Enables a group of threads to wait at a predefined execution point.
  11. synchronizer class that exchanges data between two threads
    Exchanger
  12. Exchanger
    • - synchronizer class
    • - Exchanges data between two threads.
  13. synchronizer class that synchronizes threads that advance through multiple phases of an operation.
    Phaser
  14. Phaser
    • - synchronizer class
    • - Synchronizes threads that advance through multiple phases of an operation.
  15. Executors
    - defined in ...
    - manage ...
    • - defined in java.util.concurrent
    • - manage thread execution.
  16. At the top of the executor hierarchy is:
    java.util.concurrent.Executor - interface
  17. java.util.concurrent.Executor - interface
       - is ...
       - to ...
       - has ...
    • - is at the top of the executor hierarchy
    • - to initiate a thread
    • - has only one method
    •    void     execute(Runnable command)
    •       - Executes the given command at some time in the future.
  18. java.util.concurrent.Executor - interface has only one method:
    • void     execute(Runnable command)
    •    - Executes the given command at some time in the future.
  19. ExecutorService ...
    - is ...
    - extends ...
    - provides ...
    • - is interface
    • - extends Executor
    • - provides methods that manage execution

    • java.util.concurrent.Executor
    •    java.util.concurrent.ExecutorService
  20. There are three classes that implement ExecutorService interface:
    • 1) ThreadPoolExecutor
    • 2) ScheduledThreadPoolExecutor
    • 3) ForkJoinPool
  21. Executors class
    - is ...
    - includes ...
    • - is utility class defined in java.util.concurrent
    • - includes a number of static methods that simplify the creation of various executors.
  22. Other interfaces related to to executors: (2)
    • 1) Future
    • 2) Callable
  23. Future
    - is ...
    - contains ...
    • - is interfaces related to to executors
    • - contains a value that is returned by a thread after it executes
  24. Callable
    - is ...
    - defines ...
    • - is interfaces related to to executors
    • - defines a thread that returns a value.
  25. Concurrent collections
    - defined in
    - to offer ...
    • - defined in java.util.concurrent
    • - to offer concurrent alternatives to their related classes defined by the Collections Framework
  26. concurrent collection classes: (3)
    • 1) ConcurrentHashMap
    • 2) ConcurrentLinkedQueue
    • 3) CopyOnWriteArrayList
  27. Fork/Join Framework
    - defined in ...
    - supports ...
    • - defined in java.util.concurrent
    • - supports parallel programming
  28. Fork/Join Framework classes: (4)
    • 1) ForkJoinTask
    • 2) ForkJoinPool
    • 3) RecursiveTask
    • 4) RecursiveAction
  29. TimeUnit
    - is ...
    - defined in ...
    - to ...
    • - is enumeration
    • - defined in java.util.concurrent
    • - to better handle thread timing
  30. java.util.concurrent.atomic
    - is ...
    - facilitates ...
    - provides ...
    • - is Concurrent API subpackage
    • - facilitates the use of variables in a concurrent environment
    • - provides a means of efficiently updating the value of a variable without the use of locks
  31. java.util.concurrent.atomic has some classes: (2)
    • 1) AtomicInteger
    • 2) AtomicLong
  32. AtomicInteger
    - is ...
    - has methods (3) ...
    • - is a class of java.util.concurrent.atomic subpackage
    • 1) boolean     compareAndSet(int expect, int update)
    •    - Atomically sets the value to the given updated value if the current value == the expected value.
    • 2) int     decrementAndGet()
    •    - Atomically decrements by one the current value.
    • 3) int     getAndSet(int newValue)
    •    - Atomically sets to the given value and returns the old value.
  33. AtomicLong
    - is ...
    - has methods (3) ...
    • - is a class of java.util.concurrent.atomic subpackage
    • 1) boolean     compareAndSet(long expect, long update)
    •    - Atomically sets the value to the given updated value if the current value == the expected value.
    • 2) long     decrementAndGet()
    •    - Atomically decrements by one the current value.
    • 3) long     getAndSet(long newValue)
    •    - Atomically sets to the given value and returns the old value.
  34. java.util.concurrent.locks
    - is ...
    - provides ...
    • - is Concurrent API subpackage
    • - provides an alternative to the use of synchronized methods.
  35. At the core of java.util.concurrent.locks subpackage is ...
    is interface Lock
  36. Lock
    - is ...
    - has methods (3) ...
    • - is interface at the core of java.util.concurrent.locks subpackage
    • 1) void     lock()
    •    - Acquires the lock.
    • 2) boolean tryLock()
    •    - Acquires the lock only if it is free at the time of invocation
    • 3) void     unlock()
    •    - Releases the lock.
  37. another important interface of java.util.concurrent.locks subpackage
    ReadWriteLock
  38. ReadWriteLock
    - is ...
    - has methods (2) ...
    • - is interface of java.util.concurrent.locks subpackage
    • 1) Lock     readLock()
    •    - Returns the lock used for reading.
    • 2) Lock     writeLock()
    •    - Returns the lock used for writing.
  39. The major advantage of lock interfaces:
    - they provide two separate lock for reading and writing which enables you to write high performance data structure like ConcurrentHashMap and conditional blocking
  40. You have thread T1, T2 and T3, how will you ensure that thread T2 run after T1 and thread T3 run after T2?
    - it can be achieved by using join method of Thread class.
  41. What is the advantage of new Lock interface over synchronized block in Java? You need to implement a high performance cache which allows multiple reader but single writer to keep the integrity how will you implement it?

Card Set Information

Author:
flashsmilenet
ID:
330538
Filename:
AZK CP Concurrent API Packages
Updated:
2017-04-19 00:28:41
Tags:
AZK CP Concurrent API Packages
Folders:
AZK CP JAVA
Description:
AZK CP Concurrent API Packages
Show Answers:

Home > Flashcards > Print Preview