public ExecutorService create() {
boolean remote = (this instanceof RemoteSendersExecutorServiceFactory);
ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true)
.setNameFormat(remote ? "remote-sender-%d" : "sender-%d").build();
RejectedExecutionHandler rejectedExecutionHandler = (remote ? new RejectedExecutionHandler() {
// from a remote sender
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
metrics.droppedEventInRemoteSender();
}
} : new RejectedExecutionHandler() {
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
metrics.droppedEventInSender();
}