Source:
<code>StreamTask createTask(final Consumer<byte[], byte[]> mainConsumer, final TaskId taskId, final Set<TopicPartition> partitions) { createTaskSensor.record(); final String threadIdPrefix = String.format("stream-thread [%s] ", Thread.currentThread().getName()); final String logPrefix = threadIdPrefix + String.format("%s [%s] ", "task", taskId); final LogContext logContext = new LogContext(logPrefix); final ProcessorTopology topology = builder.build(taskId.topicGroupId); final ProcessorStateManager stateManager = new ProcessorStateManager( taskId, partitions, Task.TaskType.ACTIVE, stateDirectory, topology.storeToChangelogTopic(), storeChangelogReader, logContext); if (threadProducer == null) { final Map<String, Object> producerConfigs = config.getProducerConfigs(getTaskProducerClientId(threadId, taskId)); producerConfigs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, applicationId + "-" + taskId); log.info("Creating producer client for task {}", taskId); <START> taskProducer.put(taskId, clientSupplier.getProducer(producerConfigs)); <END> } final RecordCollector recordCollector = new RecordCollectorImpl( logContext, taskId, mainConsumer, threadProducer != null ? new TransactionManager(threadProducer) : new TransactionManager(taskProducer.get(taskId), applicationId, taskId), config.defaultProductionExceptionHandler(), EXACTLY_ONCE.equals(config.getString(StreamsConfig.PROCESSING_GUARANTEE_CONFIG)), streamsMetrics); return new StreamTask( taskId, partitions, topology, mainConsumer, config, streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector); }</code><technical_language>removing entry task closure? If cleans potentially ever-growing map</technical_language>

Target:
StreamTask createTask(final Consumer<byte[], byte[]> mainConsumer, final TaskId taskId, final Set<TopicPartition> partitions) { createTaskSensor.record(); final String threadIdPrefix = String.format("stream-thread [%s] ", Thread.currentThread().getName()); final String logPrefix = threadIdPrefix + String.format("%s [%s] ", "task", taskId); final LogContext logContext = new LogContext(logPrefix); final ProcessorTopology topology = builder.build(taskId.topicGroupId); final ProcessorStateManager stateManager = new ProcessorStateManager( taskId, partitions, Task.TaskType.ACTIVE, stateDirectory, topology.storeToChangelogTopic(), storeChangelogReader, logContext); if (threadProducer == null) { final Map<String, Object> producerConfigs = config.getProducerConfigs(getTaskProducerClientId(threadId, taskId)); producerConfigs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, applicationId + "-" + taskId); log.info("Creating producer client for task {}", taskId); taskProducers.put(taskId, clientSupplier.getProducer(producerConfigs)); } final RecordCollector recordCollector = new RecordCollectorImpl( logContext, taskId, mainConsumer, threadProducer != null ? new StreamsProducer(logContext, threadProducer) : new StreamsProducer(logContext, taskProducers.get(taskId), applicationId, taskId), config.defaultProductionExceptionHandler(), EXACTLY_ONCE.equals(config.getString(StreamsConfig.PROCESSING_GUARANTEE_CONFIG)), streamsMetrics); return new StreamTask( taskId, partitions, topology, mainConsumer, config, streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector); }