mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
set names for threads
This commit is contained in:
@@ -26,30 +26,46 @@
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.event;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.eventbus.AsyncEventBus;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.ThrowingEventBus;
|
||||
import java.util.concurrent.Executors;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import org.apache.shiro.concurrent.SubjectAwareExecutorService;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GuavaScmEventBus extends ScmEventBus
|
||||
{
|
||||
|
||||
|
||||
/** Field description */
|
||||
private static final String THREAD_NAME = "EventBus-%s";
|
||||
|
||||
/**
|
||||
* the logger for GuavaScmEventBus
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
GuavaScmEventBus.class);
|
||||
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GuavaScmEventBus.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs a new ScmEventBus
|
||||
*
|
||||
@@ -57,11 +73,18 @@ public class GuavaScmEventBus extends ScmEventBus
|
||||
public GuavaScmEventBus()
|
||||
{
|
||||
eventBus = new ThrowingEventBus();
|
||||
|
||||
//J-
|
||||
ThreadFactory factory = new ThreadFactoryBuilder()
|
||||
.setNameFormat(THREAD_NAME).build();
|
||||
asyncEventBus = new AsyncEventBus(
|
||||
new SubjectAwareExecutorService(Executors.newCachedThreadPool()));
|
||||
new SubjectAwareExecutorService(Executors.newCachedThreadPool(factory))
|
||||
);
|
||||
//J+
|
||||
}
|
||||
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user