public class StreamThread
extends java.lang.Thread
Modifier and Type | Class and Description |
---|---|
static class |
StreamThread.State
Stream thread states are the possible states that a stream thread can be in.
|
static interface |
StreamThread.StateListener
Listen to state change events
|
Constructor and Description |
---|
StreamThread(org.apache.kafka.common.utils.Time time,
StreamsConfig config,
org.apache.kafka.clients.producer.Producer<byte[],byte[]> producer,
org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> restoreConsumer,
org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer,
java.lang.String originalReset,
TaskManager taskManager,
org.apache.kafka.streams.processor.internals.StreamThread.StreamsMetricsThreadImpl streamsMetrics,
InternalTopologyBuilder builder,
java.lang.String threadClientId,
org.apache.kafka.common.utils.LogContext logContext,
java.util.concurrent.atomic.AtomicInteger assignmentErrorCode) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> |
adminClientMetrics() |
java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> |
consumerMetrics() |
static StreamThread |
create(InternalTopologyBuilder builder,
StreamsConfig config,
KafkaClientSupplier clientSupplier,
org.apache.kafka.clients.admin.AdminClient adminClient,
java.util.UUID processId,
java.lang.String clientId,
org.apache.kafka.common.metrics.Metrics metrics,
org.apache.kafka.common.utils.Time time,
StreamsMetadataState streamsMetadataState,
long cacheSizeBytes,
StateDirectory stateDirectory,
StateRestoreListener userStateRestoreListener) |
boolean |
isRunning() |
boolean |
isRunningAndNotRebalancing() |
java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> |
producerMetrics() |
void |
run()
Execute the stream processors
|
void |
setStateListener(StreamThread.StateListener listener)
Set the
StreamThread.StateListener to be notified when state changes. |
void |
shutdown()
Shutdown this stream thread.
|
StreamThread.State |
state() |
java.util.Map<TaskId,StreamTask> |
tasks() |
ThreadMetadata |
threadMetadata()
Return information about the current
StreamThread . |
java.lang.String |
toString()
Produces a string representation containing useful information about a StreamThread.
|
java.lang.String |
toString(java.lang.String indent)
Produces a string representation containing useful information about a StreamThread, starting with the given indent.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
public StreamThread(org.apache.kafka.common.utils.Time time, StreamsConfig config, org.apache.kafka.clients.producer.Producer<byte[],byte[]> producer, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> restoreConsumer, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer, java.lang.String originalReset, TaskManager taskManager, org.apache.kafka.streams.processor.internals.StreamThread.StreamsMetricsThreadImpl streamsMetrics, InternalTopologyBuilder builder, java.lang.String threadClientId, org.apache.kafka.common.utils.LogContext logContext, java.util.concurrent.atomic.AtomicInteger assignmentErrorCode)
public void setStateListener(StreamThread.StateListener listener)
StreamThread.StateListener
to be notified when state changes. Note this API is internal to
Kafka Streams and is not intended to be used by an external application.public StreamThread.State state()
public boolean isRunningAndNotRebalancing()
public boolean isRunning()
public static StreamThread create(InternalTopologyBuilder builder, StreamsConfig config, KafkaClientSupplier clientSupplier, org.apache.kafka.clients.admin.AdminClient adminClient, java.util.UUID processId, java.lang.String clientId, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time, StreamsMetadataState streamsMetadataState, long cacheSizeBytes, StateDirectory stateDirectory, StateRestoreListener userStateRestoreListener)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
org.apache.kafka.common.KafkaException
- for any Kafka-related exceptionsjava.lang.RuntimeException
- for any other non-Kafka exceptionspublic void shutdown()
Note that there is nothing to prevent this function from being called multiple times (e.g., in testing), hence the state is set only the first time
public final ThreadMetadata threadMetadata()
StreamThread
.ThreadMetadata
.public java.util.Map<TaskId,StreamTask> tasks()
public java.lang.String toString()
toString
in class java.lang.Thread
public java.lang.String toString(java.lang.String indent)
public java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> producerMetrics()
public java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> consumerMetrics()
public java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> adminClientMetrics()