Skip to content

Commit

Permalink
issue #297: remove boolean parameter from method JobBuilder#enableJmx
Browse files Browse the repository at this point in the history
  • Loading branch information
fmbenhassine committed Oct 16, 2017
1 parent 3b1d8aa commit d67e898
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Expand Up @@ -193,15 +193,27 @@ public JobBuilder errorThreshold(final long errorThreshold) {

/**
* Activate JMX monitoring.
* @deprecated use {@link JobBuilder#enableJmx()} instead. This method will be removed in v5.3
*
* @param jmx true to enable jmx monitoring
* @return the job builder
*/
@Deprecated
public JobBuilder enableJmx(final boolean jmx) {
parameters.setJmxMonitoring(jmx);
return this;
}

/**
* Activate JMX monitoring.
*
* @return the job builder
*/
public JobBuilder enableJmx() {
parameters.setJmxMonitoring(true);
return this;
}

/**
* Set the batch size.
*
Expand Down
Expand Up @@ -299,7 +299,7 @@ public void whenARecordProcessorReturnsNull_thenTheRecordShouldBeFiltered() thro

@Test
public void whenJobNameIsNotSpecified_thenTheJmxMBeanShouldBeRegisteredWithDefaultJobName() throws Exception {
job = new JobBuilder().enableJmx(true).build();
job = new JobBuilder().enableJmx().build();
job.call();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
assertThat(mbs.isRegistered(new ObjectName(JMX_MBEAN_NAME + "name=" + JobParameters.DEFAULT_JOB_NAME))).isTrue();
Expand All @@ -308,7 +308,7 @@ public void whenJobNameIsNotSpecified_thenTheJmxMBeanShouldBeRegisteredWithDefau
@Test
public void whenJobNameIsSpecified_thenTheJmxMBeanShouldBeRegisteredWithTheGivenJobName() throws Exception {
String name = "master";
job = new JobBuilder().enableJmx(true).named(name).build();
job = new JobBuilder().enableJmx().named(name).build();
job.call();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
assertThat(mbs.isRegistered(new ObjectName(JMX_MBEAN_NAME + "name=" + name))).isTrue();
Expand Down
Expand Up @@ -75,7 +75,9 @@ private void registerJobParameters(JobBuilder jobBuilder) {
}
jobBuilder.errorThreshold(errorThreshold);
jobBuilder.batchSize(batchSize);
jobBuilder.enableJmx(enableJmx);
if (enableJmx) {
jobBuilder.enableJmx();
}
}

private void registerMainComponents(JobBuilder jobBuilder) {
Expand Down

0 comments on commit d67e898

Please sign in to comment.