3 Replies Latest reply: May 21, 2012 9:16 AM by Jesper Pedersen RSS

Configure WorkManagerService to inject LongRunningThreadPool

Jon Perry Newbie

Hello All

I am using jboss-as-7.1.1.Final and want to use some of the new QOS features of the Work Management contract of the JCA 1.6 spec.  I have specified a HintsContext.LONGRUNNING_HINT in my workContext and is detected correctly in the org.jboss.jca.core.workmanager.WorkManagerImpl.  But if i put a breakpoint in my work class i noticed that the thread performing my work was default-short-running-threads-threads-1.  I stepped through the src for 7.1.1.Final, I noticed that the start method of org.jboss.as.connector.workmanager.WorkManagerService had the following:

 

BlockingExecutor longRunning = (BlockingExecutor) executorLong.getOptionalValue();

if (longRunning != null) {

    this.value.setLongRunningThreadPool(longRunning);

    this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue());

} else {

    this.value.setLongRunningThreadPool((BlockingExecutor) executorShort.getValue());

    this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue());
}

 

Its the default workmanager and it has a long running pool defined:

<subsystem xmlns="urn:jboss:domain:jca:1.1">

<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>

<bean-validation enabled="true"/>

<default-workmanager>

<short-running-threads>

<core-threads count="50"/>

<queue-length count="50"/>

<max-threads count="50"/>

<keepalive-time time="10" unit="seconds"/>

</short-running-threads>

<long-running-threads>

<core-threads count="50"/>

<queue-length count="50"/>

<max-threads count="50"/>

<keepalive-time time="10" unit="seconds"/>

</long-running-threads>

</default-workmanager>

<cached-connection-manager/>

</subsystem>

 

For some reason the injected value for the longRunning Exceuter is not found. Can anyone provide some insight on what I am doing wrong?

Many Thanks

  • 1. Re: Configure WorkManagerService to inject LongRunningThreadPool
    jaikiran pai Master

    Jon, welcome to the forums!

     

    Is this reproducible against the latest nightly builds https://community.jboss.org/thread/167590?

  • 2. Re: Configure WorkManagerService to inject LongRunningThreadPool
    Jon Perry Newbie

    Thanks for the response, much appreciated.

    I have tried with the latest nightly build and the thread no longer indicates that it is a default-short -running thread in its name.

    Just out of curiosity, I put a bp in the new source and org.jboss.as.connector.subsystems.jca.WorkManagerAdd's performRuntime does not seem to recognize that i have a <long-running-threads> configuration.

     

     

    if (operation.get(WORKMANAGER_LONG_RUNNING).isDefined() && operation.get(WORKMANAGER_LONG_RUNNING).asBoolean()) {
            builder.addDependency(ThreadsServices.EXECUTOR.append(WORKMANAGER_LONG_RUNNING).append(name), Executor.class, wmService.getExecutorLongInjector());
    }

     

    And when the WorkManagerService starts, the longRunning BlockingExecuter is null and as a result gets assigned the shortRunning one.

     

    BlockingExecutor longRunning = (BlockingExecutor) executorLong.getOptionalValue();

    if (longRunning != null) {
        this.value.setLongRunningThreadPool(longRunning);
        this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue());
    } else {
         this.value.setLongRunningThreadPool((BlockingExecutor) executorShort.getValue());
         this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue());
    }

     

    I am using the standalone-full.xml and JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes".
    Cheers,

    Jon

     

     

     

     

  • 3. Re: Configure WorkManagerService to inject LongRunningThreadPool
    Jesper Pedersen Master

    Thanks for the report - we will take a look at it