Example usage for com.google.common.util.concurrent NamingThreadFactory NamingThreadFactory

List of usage examples for com.google.common.util.concurrent NamingThreadFactory NamingThreadFactory

Introduction

In this page you can find the example usage for com.google.common.util.concurrent NamingThreadFactory NamingThreadFactory.

Prototype

public NamingThreadFactory(String format, ThreadFactory backingFactory) 

Source Link

Document

Creates a new factory that delegates to backingFactory for thread creation, then uses format to construct a name for the new thread.

Usage

From source file:com.android.quicksearchbox.QsbApplication.java

protected ShortcutRepository createShortcutRepository() {
    ThreadFactory logThreadFactory = new NamingThreadFactory("ShortcutRepositoryWriter #%d",
            new PriorityThreadFactory(Process.THREAD_PRIORITY_BACKGROUND));
    Executor logExecutor = Executors.newSingleThreadExecutor(logThreadFactory);
    return ShortcutRepositoryImplLog.create(getContext(), getConfig(), getCorpora(), getShortcutRefresher(),
            getMainThreadHandler(), logExecutor);
}

From source file:com.android.quicksearchbox.QsbApplication.java

protected ThreadFactory createQueryThreadFactory() {
    String nameFormat = "QSB #%d";
    int priority = getConfig().getQueryThreadPriority();
    return new NamingThreadFactory(nameFormat, new PriorityThreadFactory(priority));
}