Skip to content

Latest commit

 

History

History
74 lines (50 loc) · 1.62 KB

kafka-ShutdownableThread.adoc

File metadata and controls

74 lines (50 loc) · 1.62 KB

ShutdownableThread

ShutdownableThread is the contract for non-daemon threads of execution.

ShutdownableThread contract expects that the objects implement doWork method.

def doWork(): Unit

run Method

run(): Unit
Note
run is a part of java.lang.Runnable that is executed when the thread is started.

run first prints out the following INFO message to the logs:

Starting

run then executes doWork method until isRunning flag is disabled.

In the end, run decrements the count of shutdownLatch and prints out the following INFO message to the logs:

Stopped

Pausing (Until Shutdown or Timeout) — pause Method

pause(
  timeout: Long,
  unit: TimeUnit): Unit

pause…​FIXME

Note
pause is used when…​FIXME

initiateShutdown Method

initiateShutdown(): Boolean

initiateShutdown…​FIXME

Note
initiateShutdown is used when…​FIXME

Internal Properties

Name Description

isRunning

Flag that controls how long to execute run method.

shutdownLatch

Java’s java.util.concurrentCountDownLatch with the number of passes being 1