glassfish
  1. glassfish
  2. GLASSFISH-20150

BATCH RI: SkipWriteListener is called no of items processed rather than no of times exception thrown

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b82_EE7MS7
    • Fix Version/s: 4.0_b84_RC1
    • Component/s: batch
    • Labels:
      None

      Description

      Tested with latest glassfish nightly + b22

      My sample Job XML

      <?xml version="1.0" encoding="UTF-8"?>
      <job id="PayRollJobListeners" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
      <properties>
      <property name="TESTNO" value="#

      {jobParameters['TESTNO']}

      "/>
      </properties>
      <step id="step1">
      <listeners>
      <listener ref="SampleSkipReadListener"></listener>
      <listener ref="SampleSkipWriteListener"></listener>
      <listener ref="SampleSkipProcessListener"></listener>
      <listener ref="SampleRetryReadListener"></listener>
      <listener ref="SampleRetryWriteListener"></listener>
      <listener ref="SampleRetryProcessListener"></listener>
      </listeners>
      <chunk item-count="3" skip-limit="3">
      <reader ref="SimpleItemReader"></reader>
      <processor ref="SimpleItemProcessor"></processor>
      <writer ref="SimpleItemWriter"></writer>
      <skippable-exception-classes>
      <include class="java.lang.ArithmeticException"/>
      </skippable-exception-classes>
      </chunk>
      </step>
      </job>

      SimpleItemReader will read 6 items one by one.
      I have introduced ArithmeticException in SimpleItemWriter writeItems method. As per chunk item-count my SimpleItemWriter writeItems called only twice as there are only 6 items from the reader. So skip-limit value set to 3 should complete the JOB successfully

      Issue --> After writeItems Arithmetic Exception thrown, SkipWriterListener is called 3 times(chunk count) and job process next chunk it makes the JOB to FAILED bcoz of Arithmetic Exception

      Attached Sample App: https://www.dropbox.com/s/eu78eidm31mveid/SimpleListeners.war

      Deploy the app and start Job2 from http://<server>:<port>/SimpleListeners/JobSubmitterServlet

        Activity

        Hide
        ScottKurz added a comment -

        I thought this had come up on the spec ML and we'd decided on # of items. Looking back at the spec now I only see, clearly, that it's saying # of exceptions.

        Thanks for catching that. Let me look into this...

        Show
        ScottKurz added a comment - I thought this had come up on the spec ML and we'd decided on # of items. Looking back at the spec now I only see, clearly, that it's saying # of exceptions. Thanks for catching that. Let me look into this...
        Hide
        Kaushik Mukherjee added a comment -

        Looks like the RI was counting the exceptions against each item in the write chunk. This is fixed for the next drop.

        Show
        Kaushik Mukherjee added a comment - Looks like the RI was counting the exceptions against each item in the write chunk. This is fixed for the next drop.
        Hide
        ScottKurz added a comment -

        Fixed in jbatch 1.0-b24

        Show
        ScottKurz added a comment - Fixed in jbatch 1.0-b24

          People

          • Assignee:
            ScottKurz
            Reporter:
            arunkumar_s
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: