Announcement Announcement Module
Collapse
No announcement yet.
Exposing task pool of a channel as a OSgi service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exposing task pool of a channel as a OSgi service

    We are planning to use Spring integration for our project along with spring dm server.

    we plan to define a common thread pool executor in teh common bundle and export this as service which other bundles can use. The purpose of this is that each bundle can either define his own executor and use teh common one which is imported as a common service.

    Now my question is as follows

    Since the thread pool executor implements java.util.concurrent.Executor i planned to expose using this interface. And in the bundle which uses it i used the bean id as a filter. But the problem was

    When i started the dm server i got an error saying pub-sub-channel doesnt not take this java.util.concurrent as a paramter in teh constructor.


    So does it mean that i have to use cglib and export it as a service ?


    How do i solve this problem where i need to export task pool executor and use it in the other bundle channel definition.

  • #2
    Spring provides a ConcurrentTaskExecutor implementation that simply delegates to any java.util.concurrent.Executor, so you could configure and inject that instead.

    That said, we should probably consider accepting the java.util.concurrent.Executor interface there (and elsewhere in the framework) since Spring's TaskExecutor extends it as of Spring 3.0 and mirrors the only method defined on that interface.

    Please feel free to open an issue in JIRA for that, and try using ConcurrentTaskExecutor in the meantime.

    Regards,
    Mark

    Comment


    • #3
      Thanks Mark.

      Also looking at constructor code, if I change my service interface from Executor to TaskExecutor i think it will work.

      public PublishSubscribeChannel(TaskExecutor taskExecutor)
      {
      this.taskExecutor = taskExecutor;
      this.dispatcher = new BroadcastingDispatcher(taskExecutor);
      }

      Comment

      Working...
      X