Skip to content

Commit

Permalink
Update thread group nameFormat to %s
Browse files Browse the repository at this point in the history
  • Loading branch information
dain committed Feb 11, 2015
1 parent 273db16 commit cf23f9f
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class TableNameCompleter
{
private static final long RELOAD_TIME_MINUTES = 2;

private final ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("completer-%d"));
private final ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("completer-%s"));
private final QueryRunner queryRunner;
private final LoadingCache<String, List<String>> tableCache;
private final LoadingCache<String, List<String>> functionCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public SqlQueryManager(

this.executionFactories = checkNotNull(executionFactories, "executionFactories is null");

this.queryExecutor = newCachedThreadPool(threadsNamed("query-scheduler-%d"));
this.queryExecutor = newCachedThreadPool(threadsNamed("query-scheduler-%s"));
this.queryExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) queryExecutor);

checkNotNull(config, "config is null");
Expand All @@ -125,7 +125,7 @@ public SqlQueryManager(
this.maxQueryHistory = config.getMaxQueryHistory();
this.clientTimeout = config.getClientTimeout();

queryManagementExecutor = Executors.newScheduledThreadPool(config.getQueryManagerExecutorPoolSize(), threadsNamed("query-management-%d"));
queryManagementExecutor = Executors.newScheduledThreadPool(config.getQueryManagerExecutorPoolSize(), threadsNamed("query-management-%s"));
queryManagementExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) queryManagementExecutor);
queryManagementExecutor.scheduleWithFixedDelay(new Runnable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public SqlTaskManager(

final DataSize maxBufferSize = config.getSinkMaxBufferSize();

taskNotificationExecutor = newCachedThreadPool(threadsNamed("task-notification-%d"));
taskNotificationExecutor = newCachedThreadPool(threadsNamed("task-notification-%s"));
taskNotificationExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) taskNotificationExecutor);

taskManagementExecutor = newScheduledThreadPool(5, threadsNamed("task-management-%d"));
taskManagementExecutor = newScheduledThreadPool(5, threadsNamed("task-management-%s"));
taskManagementExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) taskManagementExecutor);

final SqlTaskExecutionFactory sqlTaskExecutionFactory = new SqlTaskExecutionFactory(taskNotificationExecutor, taskExecutor, planner, queryMonitor, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public TaskExecutor(int runnerThreads, Ticker ticker)
checkArgument(runnerThreads > 0, "runnerThreads must be at least 1");

// we manages thread pool size directly, so create an unlimited pool
this.executor = newCachedThreadPool(threadsNamed("task-processor-%d"));
this.executor = newCachedThreadPool(threadsNamed("task-processor-%s"));
this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) executor);
this.runnerThreads = runnerThreads;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void configure(Binder binder)

// query execution
binder.bind(ExecutorService.class).annotatedWith(ForQueryExecution.class)
.toInstance(newCachedThreadPool(threadsNamed("query-execution-%d")));
.toInstance(newCachedThreadPool(threadsNamed("query-execution-%s")));
binder.bind(QueryExecutionMBean.class).in(Scopes.SINGLETON);
newExporter(binder).export(QueryExecutionMBean.class).as(generatedNameOf(QueryExecution.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public HttpRemoteTaskFactory(QueryManagerConfig config,
this.taskUpdateRequestCodec = taskUpdateRequestCodec;
this.maxConsecutiveErrorCount = config.getRemoteTaskMaxConsecutiveErrorCount();
this.minErrorDuration = config.getRemoteTaskMinErrorDuration();
ExecutorService coreExecutor = newCachedThreadPool(daemonThreadsNamed("remote-task-callback-%d"));
ExecutorService coreExecutor = newCachedThreadPool(daemonThreadsNamed("remote-task-callback-%s"));
this.executor = ExecutorServiceAdapter.from(new BoundedExecutor(coreExecutor, config.getRemoteTaskMaxCallbackThreads()));
this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) coreExecutor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void main(String[] args)

public TaskExecutorSimulator()
{
executor = listeningDecorator(newCachedThreadPool(threadsNamed(getClass().getSimpleName() + "-%d")));
executor = listeningDecorator(newCachedThreadPool(threadsNamed(getClass().getSimpleName() + "-%s")));

taskExecutor = new TaskExecutor(24, new Ticker()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void setUp()
// contents of taskMap indicate the node-task map for the current stage
taskMap = new HashMap<>();
nodeSelector = nodeScheduler.createNodeSelector("foo");
remoteTaskExecutor = Executors.newCachedThreadPool(daemonThreadsNamed("remoteTaskExecutor"));
remoteTaskExecutor = Executors.newCachedThreadPool(daemonThreadsNamed("remoteTaskExecutor-%s"));
}

@AfterMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ public void testSplitAssignmentBatchSizeGreaterThanMaxPending()

private SqlStageExecution createSqlStageExecution(NodeScheduler nodeScheduler, int splitBatchSize, StageExecutionPlan tableScanPlan)
{
ExecutorService remoteTaskExecutor = newCachedThreadPool(daemonThreadsNamed("remoteTaskExecutor"));
ExecutorService remoteTaskExecutor = newCachedThreadPool(daemonThreadsNamed("remoteTaskExecutor-%s"));
MockRemoteTaskFactory remoteTaskFactory = new MockRemoteTaskFactory(remoteTaskExecutor);
ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("stageExecutor"));
ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("stageExecutor-%s"));

OutputBuffers outputBuffers = INITIAL_EMPTY_OUTPUT_BUFFERS
.withBuffer(OUT, new UnpartitionedPagePartitionFunction())
Expand All @@ -222,7 +222,7 @@ private SqlStageExecution createSqlStageExecution(NodeScheduler nodeScheduler, i
public void testYieldCausesFullSchedule()
throws Exception
{
ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("test"));
ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
SqlStageExecution stageExecution = null;
try {
StageExecutionPlan joinPlan = createJoinPlan("A");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public TestSqlTask()
taskExecutor = new TaskExecutor(8);
taskExecutor.start();

taskNotificationExecutor = newScheduledThreadPool(5, threadsNamed("task-notification-%d"));
taskNotificationExecutor = newScheduledThreadPool(5, threadsNamed("task-notification-%s"));

LocalExecutionPlanner planner = createTestingPlanner();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class TestAggregationOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));

driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class TestDistinctLimitOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class TestDriver
public void setUp()
throws Exception
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));

driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestFilterAndProjectOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));

driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class TestHashAggregationOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));

driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class TestHashJoinOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
taskContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class TestHashSemiJoinOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
taskContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TestLimitOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestMarkDistinctOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class TestOrderByOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestRecordProjectOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class TestRowNumberOperator
@BeforeClass
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class TestScanFilterAndProjectOperator

public TestScanFilterAndProjectOperator()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class TestTopNOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TestTopNRowNumberOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class TestUnnestOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));

driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class TestWindowOperator
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION)
.addPipelineContext(true, true)
.addDriverContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
public class MockTaskManager
implements TaskManager
{
private final ScheduledExecutorService stateNotificationExecutor = newScheduledThreadPool(5, daemonThreadsNamed("test-%d"));
private final ScheduledExecutorService stateNotificationExecutor = newScheduledThreadPool(5, daemonThreadsNamed("test-%s"));

private final HttpServerInfo httpServerInfo;
private final DataSize maxBufferSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void setupClass()
{
Logging.initialize();
if (PARALLEL) {
executor = listeningDecorator(newFixedThreadPool(getRuntime().availableProcessors() * 2, daemonThreadsNamed("completer-%d")));
executor = listeningDecorator(newFixedThreadPool(getRuntime().availableProcessors() * 2, daemonThreadsNamed("completer-%s")));
}
else {
executor = listeningDecorator(sameThreadExecutor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class TestJoinProbeCompiler
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test"));
executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
taskContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void train(Dataset dataset)

svm_problem problem = toSvmProblem(dataset);

ExecutorService service = newCachedThreadPool(threadsNamed("libsvm-trainer-" + System.identityHashCode(this) + "-%d"));
ExecutorService service = newCachedThreadPool(threadsNamed("libsvm-trainer-" + System.identityHashCode(this) + "-%s"));
try {
TimeLimiter limiter = new SimpleTimeLimiter(service);
//TODO: this time limit should be configurable
Expand Down

0 comments on commit cf23f9f

Please sign in to comment.