public TaskManagerJobMetricGroup addJob(JobID jobId, String jobName) {
        Preconditions.checkNotNull(jobId);
        String resolvedJobName = jobName == null || jobName.isEmpty() ? jobId.toString() : jobName;
        TaskManagerJobMetricGroup jobGroup;
        synchronized (this) { // synchronization isn't strictly necessary as of FLINK-24864
            jobGroup = jobs.get(jobId);
            if (jobGroup == null) {
                jobGroup = new TaskManagerJobMetricGroup(registry, this, jobId, resolvedJobName);
                jobs.put(jobId, jobGroup);
            }
        }
        return jobGroup;
    }
@Test
    void testGetSameJob() {
        assertThat(metricGroup.addJob(JOB_ID, JOB_NAME))
                .isSameAs(metricGroup.addJob(JOB_ID, JOB_NAME));
        assertThat(metricGroup.addJob(new JobID(), "another job"))
                .isNotSameAs(metricGroup.addJob(JOB_ID, JOB_NAME));
    }