/**
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowplugin.openflow.md.core;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- *
+ * threadPoolExecutor implementation logging exceptions thrown by threads
*/
public class ThreadPoolLoggingExecutor extends ThreadPoolExecutor {
-
- private static Logger LOG = LoggerFactory.getLogger(ThreadPoolLoggingExecutor.class);
+
+ private static final Logger LOG = LoggerFactory.getLogger(ThreadPoolLoggingExecutor.class);
/**
* @param corePoolSize
* @param keepAliveTime
* @param unit
* @param workQueue
+ * @param poolName thread name prefix
*/
public ThreadPoolLoggingExecutor(int corePoolSize, int maximumPoolSize,
- long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
+ long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue,
+ final String poolName) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
+ new ThreadFactoryBuilder().setNameFormat(poolName+"-%d").build());
}
@Override