Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3808

PartitionPlan.getThreads() returning zero value causes batch job not be started

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 8.1.0.Final
    • Fix Version/s: 9.0.0.Alpha1
    • Component/s: Batch
    • Labels:
      None
    • Environment:

      Windows 7 Home Premium Service Pack 1 64-bit + JDK8u11 + WildFly 8.1.0 Final

    • Steps to Reproduce:
      Hide

      Create a simple batch application. Define and write a PartitionMapper returning a PartionPlanImpl object, but don't override getThreads method. For example:

      package batchtest;

      import java.util.Properties;

      import javax.batch.api.partition.PartitionMapper;
      import javax.batch.api.partition.PartitionPlan;
      import javax.batch.api.partition.PartitionPlanImpl;
      import javax.enterprise.context.Dependent;
      import javax.inject.Named;

      @Dependent
      @Named("TestPartitionMapper")
      public class TestPartitionMapper implements PartitionMapper {
      @Override
      public PartitionPlan mapPartitions() throws Exception {
      return new PartitionPlanImpl() {
      @Override
      public int getPartitions()

      { return 2; }

      // getThreads() is not overridden
      // Defaults to zero, which means thread count
      // should be equal to partition count

      @Override
      public Properties[] getPartitionProperties()

      { Properties[] props = new Properties[getPartitions()]; props[0] = new Properties(); props[1] = new Properties(); return props; }

      };
      }
      }

      Then try to start the batch job. Number of threads should be equal to number of partitions, but the batch job don't start in WildFly. In GlassFish the batch job is started in 2 threads as expected.

      Show
      Create a simple batch application. Define and write a PartitionMapper returning a PartionPlanImpl object, but don't override getThreads method. For example: package batchtest; import java.util.Properties; import javax.batch.api.partition.PartitionMapper; import javax.batch.api.partition.PartitionPlan; import javax.batch.api.partition.PartitionPlanImpl; import javax.enterprise.context.Dependent; import javax.inject.Named; @Dependent @Named("TestPartitionMapper") public class TestPartitionMapper implements PartitionMapper { @Override public PartitionPlan mapPartitions() throws Exception { return new PartitionPlanImpl() { @Override public int getPartitions() { return 2; } // getThreads() is not overridden // Defaults to zero, which means thread count // should be equal to partition count @Override public Properties[] getPartitionProperties() { Properties[] props = new Properties[getPartitions()]; props[0] = new Properties(); props[1] = new Properties(); return props; } }; } } Then try to start the batch job. Number of threads should be equal to number of partitions, but the batch job don't start in WildFly. In GlassFish the batch job is started in 2 threads as expected.

      Description

      If you define a batch job to be divided to multiple partitions and write a PartitionMapper returning a PartitionPlanImpl object but don't override getThreads method, which means getThreads returns zero meaning thread count should be equal to partition count, but the batch job doesn't start.

      See http://docs.oracle.com/javaee/7/api/javax/batch/api/partition/PartitionPlan.html#setThreads(int)

      In GlassFish this works as expected: if getThreads is not overridden (thus returning zero), batch job is started in as many threads as there are partitions.

      See steps to reproduce for further details.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  elguardian Enrique González Martínez
                  Reporter:
                  arialfred Ari Silvan
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: