2

Is it possible to run a batch job (JSR-352 Batch Processing) on another dedicated thread?

In my application I have several tasks that I would like to execute on another dedicated thread pool. Besides, I have tasks to execute on the default half of threads (default thread pool configured in Wildfly standalone.xml file).

Unfortunately, as far I could only set a new pool of threads for the entire mechanism:

    <subsystem xmlns="urn:jboss:domain:batch-jberet:1.0">
        <default-job-repository name="in-memory"/>
        <default-thread-pool name="batch | special"/>
        <job-repository name="in-memory">
            <in-memory/>
        </job-repository>
        <thread-pool name="batch">
            <max-threads count="10"/>
            <keepalive-time time="30" unit="seconds"/>
        </thread-pool>
        <thread-pool name="special"> //new pool
            <max-threads count="5"/>
            <keepalive-time time="30" unit="seconds"/>
        </thread-pool>
    </subsystem>

So in my case I can be used interchangeably batch or special thread-pool but not together for diffrent jobs.

In summary, I would like to set thread-pool per job

ostry
  • 117
  • 1
  • 2
  • 8

2 Answers2

1

I don't think you can specify batch thread-pool per job. However, you can specify a custom thread-pool per deployment by using jboss-all.xml inside the application archive. See WildFly Batch Subsystem Configuration Docs.

cheng
  • 1,076
  • 6
  • 6
0

No, it's not possible to define thread-pools per job. But you can define, which batch default thread pool your application will use.

  1. Define an additional thread pool:

    <subsystem xmlns="urn:jboss:domain:batch-jberet:1.0"> ... <thread-pool name="testpool"> <max-threads count="10"/> <keepalive-time time="30" unit="seconds"/> </thread-pool> </subsystem>

  2. Create webapp/WEB-INF/jboss-all.xml with

    <jboss xmlns="urn:jboss:1.0"> <batch xmlns="urn:jboss:batch-jberet:1.0"> <thread-pool name="testpool"/> </batch> </jboss>

JavaBohne
  • 171
  • 2
  • 4