- Threads
- A Java Thread is an independent path of execution within a program.
- Many Threads can run concurrently within a program.
- Every Thread in Java is created and controlled by the java.lang.Thread class.
- Ways
- Extend
Thread
class - Implement
Runnable
interface - Anonymous implementation
- Executor Services
- Extend
- Synchronization
- Volatile keyword (to avoid issue caused by caching)
- Synchronized keyword
- Method
- Code Blocks
- Thread Pool
- Countdown Latch
- Blocking Queue
- Wait And Notify
- Re-Entrant Lock
- Semaphore
- Callable And Future
- Interrupting Thread