Results 1 to 7 of 7

Thread: how can define my taskScheduler for each poller

  1. #1
    Join Date
    Mar 2010
    Posts
    5

    Default how can define my taskScheduler for each poller

    Because the "taskScheduler" bean (a global taskScheduler) is responsible for managing all pollers,so i cannot define my taskSchedulers to some pollers.

    i want to define custom myTaskScheduler for each poller,such as

    myTaskSchedulerA for pollerA,
    myTaskSchedulerB for pollerB,
    myTaskSchedulerC for pollerC...

    Does anyone have any ideals ?

    Thanks !

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Well how about reading the reference guide, it is explained there...
    Last edited by Marten Deinum; Mar 22nd, 2010 at 05:44 AM.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    Well, the previous reply was a bit blunt, but I hope you did find the reference manual link helpful. Basically, you just want to add a "task-executor" attribute to the poller and provide a reference to a TaskExecutor.

    If you are using Spring 3.0, you might also want to consider the new "task" namespace. With that, configuration of TaskExecutors is very simple:
    http://static.springsource.org/sprin...task-namespace

    Hope that helps.
    -Mark

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Hmm Mark I guess you are right, maybe the time has come to look on, 99% of the questions I answer are answered before (sometimes in the same week) or are solved by reading the reference guide.

    I'll ponder on that for a while.

    And sorry for the blunt reply/replies I made...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    I think you've probably answered most questions at least 2X
    And, your help on the forums is definitely appreciated.

    I'm just usually trying to consider the possibility that our docs might not be clear enough (in the case of the XSD, I have an open issue to provide more detail).

    Cheers,
    Mark

  6. #6
    Join Date
    Mar 2010
    Posts
    5

    Default

    Quote Originally Posted by Mark Fisher View Post
    Well, the previous reply was a bit blunt, but I hope you did find the reference manual link helpful. Basically, you just want to add a "task-executor" attribute to the poller and provide a reference to a TaskExecutor.

    If you are using Spring 3.0, you might also want to consider the new "task" namespace. With that, configuration of TaskExecutors is very simple:
    http://static.springsource.org/sprin...task-namespace

    Hope that helps.
    -Mark
    Hi,Mark.
    I konw that the poller's "task-executor" attribute can reference a TaskExecutor,but the all TaskExecutors use a global taskScheduler.
    So I want to know how to config a TaskExecutor with a custom taskScheduler,not a global one.

    such as :

    <task:executor id="executor1" pool-size="6" queue-capacity="10" keep-alive="1"/>

    <task:executor id="executor2" pool-size="3" queue-capacity="1" keep-alive="1"/>

    <task:scheduler id="taskScheduler" pool-size="6" />

    .....
    <poller id="poller1" task-executor="executor1" receive-timeout="2">
    <interval-trigger interval="100"/>
    </poller>
    ......

    ......
    <poller id="poller2" task-executor="executor2" receive-timeout="20">
    <interval-trigger interval="1000"/>
    </poller>


    The "taskScheduler" is the global taskScheduler.
    The poller1 refences "executor1" and the poller2 refences "executor2".
    The "executor1" and "executor2" use a default taskScheduler (a global one).
    So i want define custom taskSchedulers (not a global one) for each "executor1" and "executor2" .

    such as :
    taskScheduler1 for "executor1"
    taskScheduler2 for "executor2"

    and the taskScheduler1 and taskScheduler2 are not the global taskScheduler which id is "taskScheduler".

    But i find the SI does not support it ,So how can i define a custom taskScheduler for each task-executor?

    Anybody has a good idea about this?

    Thanks very much!

  7. #7
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    You don't need to, if you would the poolsize would be pretty much useless on the task-executor.

    From the docs

    When Polling Consumers provide an explicit task-executor reference in their configuration, the invocation of the handler methods will happen within that executor's thread pool and not the main scheduler pool. However, when no task-executor is provided for an endpoint's poller, it will be invoked by one of the main scheduler's threads.
    And please use [ code][/code ] tags when posting code.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •