private SqlTask( TaskId taskId, URI location, String nodeId, QueryContext queryContext, SqlTaskExecutionFactory sqlTaskExecutionFactory, ExecutorService taskNotificationExecutor, DataSize maxBufferSize) { this.taskId = requireNonNull(taskId, "taskId is null"); this.taskInstanceId = UUID.randomUUID().toString(); this.location = requireNonNull(location, "location is null"); this.nodeId = requireNonNull(nodeId, "nodeId is null"); this.queryContext = requireNonNull(queryContext, "queryContext is null"); this.sqlTaskExecutionFactory = requireNonNull(sqlTaskExecutionFactory, "sqlTaskExecutionFactory is null"); requireNonNull(taskNotificationExecutor, "taskNotificationExecutor is null"); requireNonNull(maxBufferSize, "maxBufferSize is null"); outputBuffer = new LazyOutputBuffer( taskId, taskInstanceId, taskNotificationExecutor, maxBufferSize, // Pass a memory context supplier instead of a memory context to the output buffer, // because we haven't created the task context that holds the the memory context yet. () -> queryContext.getTaskContextByTaskId(taskId).localSystemMemoryContext()); taskStateMachine = new TaskStateMachine(taskId, taskNotificationExecutor); }
private SqlTask( TaskId taskId, URI location, String nodeId, QueryContext queryContext, SqlTaskExecutionFactory sqlTaskExecutionFactory, ExecutorService taskNotificationExecutor, DataSize maxBufferSize) { this.taskId = requireNonNull(taskId, "taskId is null"); this.taskInstanceId = UUID.randomUUID().toString(); this.location = requireNonNull(location, "location is null"); this.nodeId = requireNonNull(nodeId, "nodeId is null"); this.queryContext = requireNonNull(queryContext, "queryContext is null"); this.sqlTaskExecutionFactory = requireNonNull(sqlTaskExecutionFactory, "sqlTaskExecutionFactory is null"); requireNonNull(taskNotificationExecutor, "taskNotificationExecutor is null"); requireNonNull(maxBufferSize, "maxBufferSize is null"); outputBuffer = new LazyOutputBuffer( taskId, taskInstanceId, taskNotificationExecutor, maxBufferSize, // Pass a memory context supplier instead of a memory context to the output buffer, // because we haven't created the task context that holds the the memory context yet. () -> queryContext.getTaskContextByTaskId(taskId).localSystemMemoryContext()); taskStateMachine = new TaskStateMachine(taskId, taskNotificationExecutor); }