1 package com.atlassian.event.internal;
2
3 import java.util.concurrent.Executors;
4 import java.util.concurrent.ThreadFactory;
5
6 import static com.google.common.base.Preconditions.checkNotNull;
7
8
9
10
11
12
13 public final class EventThreadFactory implements ThreadFactory {
14 private final ThreadFactory delegateThreadFactory;
15
16 public EventThreadFactory() {
17 this(Executors.defaultThreadFactory());
18 }
19
20 public EventThreadFactory(ThreadFactory delegateThreadFactory) {
21 this.delegateThreadFactory = checkNotNull(delegateThreadFactory);
22 }
23
24 public Thread newThread(Runnable r) {
25 final Thread thread = delegateThreadFactory.newThread(r);
26 thread.setName("AtlassianEvent::" + thread.getName());
27 return thread;
28 }
29 }