Source:
public JobSpecification resolveJobSpecification(final String id, @Valid final JobRequest jobRequest) { final long start = System.nanoTime(); final Set<Tag> tags = Sets.newHashSet(); try { log.info( "Received request to resolve a job specification for job id and parameters {}", id, jobRequest ); final Map<Cluster, String> clustersAndCommandsForJob = this.queryForClustersAndCommands( jobRequest.getCriteria().getClusterCriteria(), jobRequest.getCriteria().getCommandCriterion() ); final Cluster cluster = this.selectCluster(id, jobRequest, clustersAndCommandsForJob.keySet()); final Command command = this.getCommand(clustersAndCommandsForJob.get(cluster), id); final List<JobSpecification.ExecutionResource> applicationResources = Lists.newArrayList(); for (final Application application : this.getApplications(id, jobRequest, command)) { applicationResources.add( new JobSpecification.ExecutionResource(application.getId(), application.getResources()) ); } final List<String> commandArgs = Lists.newArrayList(command.getExecutable()); commandArgs.addAll(jobRequest.getCommandArgs()); final JobSpecification jobSpecification = new JobSpecification( commandArgs, new JobSpecification.ExecutionResource(id, jobRequest.getResources()), new JobSpecification.ExecutionResource(cluster.getId(), cluster.getResources()), new JobSpecification.ExecutionResource(command.getId(), command.getResources()), applicationResources, this.generateEnvironmentVariables(id, jobRequest, cluster, command), jobRequest.getRequestedAgentConfig().isInteractive(), jobRequest.getRequestedAgentConfig().getRequestedJobDirectoryLocation().orElse(DEFAULT_JOB_DIRECTORY), toArchiveLocation( jobRequest .getRequestedAgentConfig() .getRequestedArchiveLocationPrefix() .orElse(defaultArchiveLocation), id) ); MetricsUtils.addSuccessTags(tags); return jobSpecification; } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw new RuntimeException(t); } finally { this.registry .timer(RESOLVE_JOB_SPECIFICATION_TIMER, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }

Target:
public JobSpecification resolveJobSpecification(final String id, @Valid final JobRequest jobRequest) { final long start = System.nanoTime(); final Set<Tag> tags = Sets.newHashSet(); try { log.info( "Received request to resolve a job specification for job id and parameters {}", id, jobRequest ); final Map<Cluster, String> clustersAndCommandsForJob = this.queryForClustersAndCommands( jobRequest.getCriteria().getClusterCriteria(), jobRequest.getCriteria().getCommandCriterion() ); final Cluster cluster = this.selectCluster(id, jobRequest, clustersAndCommandsForJob.keySet()); final Command command = this.getCommand(clustersAndCommandsForJob.get(cluster), id); final List<JobSpecification.ExecutionResource> applicationResources = Lists.newArrayList(); for (final Application application : this.getApplications(id, jobRequest, command)) { applicationResources.add( new JobSpecification.ExecutionResource(application.getId(), application.getResources()) ); } final List<String> commandArgs = Lists.newArrayList(command.getExecutable()); commandArgs.addAll(jobRequest.getCommandArgs()); final JobSpecification jobSpecification = new JobSpecification( commandArgs, new JobSpecification.ExecutionResource(id, jobRequest.getResources()), new JobSpecification.ExecutionResource(cluster.getId(), cluster.getResources()), new JobSpecification.ExecutionResource(command.getId(), command.getResources()), applicationResources, this.generateEnvironmentVariables(id, jobRequest, cluster, command), jobRequest.getRequestedAgentConfig().isInteractive(), jobRequest.getRequestedAgentConfig().getRequestedJobDirectoryLocation().orElse(DEFAULT_JOB_DIRECTORY), toArchiveLocation( jobRequest .getRequestedJobArchivalData() .getRequestedArchiveLocationPrefix() .orElse(null), id) ); MetricsUtils.addSuccessTags(tags); return jobSpecification; } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw new RuntimeException(t); } finally { this.registry .timer(RESOLVE_JOB_SPECIFICATION_TIMER, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }