Use CustomizableThreadFactory for Kafka Binder

Fixes #543

We don't need another ThreadFactory implementation and can use Spring Framework class instead.
This commit is contained in:
Marius Bogoevici
2016-05-17 15:03:46 -04:00
parent 48d2888b71
commit 1d0031d356

View File

@@ -100,6 +100,7 @@ import org.springframework.retry.RetryOperations;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
@@ -125,7 +126,13 @@ public class KafkaMessageChannelBinder
public static final ByteArraySerializer BYTE_ARRAY_SERIALIZER = new ByteArraySerializer();
public static final DaemonThreadFactory DAEMON_THREAD_FACTORY = new DaemonThreadFactory();
public static final ThreadFactory DAEMON_THREAD_FACTORY;
static {
CustomizableThreadFactory threadFactory = new CustomizableThreadFactory("kafka-binder-");
threadFactory.setDaemon(true);
DAEMON_THREAD_FACTORY = threadFactory;
}
private boolean autoCreateTopics = true;
@@ -773,16 +780,6 @@ public class KafkaMessageChannelBinder
}
}
private static class DaemonThreadFactory implements ThreadFactory {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "kafka-binder-");
thread.setDaemon(true);
return thread;
}
}
private final class ReceivingHandler extends AbstractReplyProducingMessageHandler {
private final ExtendedConsumerProperties<KafkaConsumerProperties> consumerProperties;