1 Reply Latest reply: Jun 10, 2010 1:36 AM by 567247 RSS

    Using a custom ThreadFactory in ProcessingPattern

    776277
      Is it possible to configure the ThreadFactory implementation that is used by the ProcessingPattern.

      It looks to be defined in LocalExecutorDispatcher.

      I looked at extending a custom version of the ProcessPatterningNamespaceHandler and then creating my own ExecutorDispatcher implementation that would return a Custom LocalExecutorDispatcher but it is not possible to extend the LocalExecutorDispatcher and just override the onStartup method due to the internal use of private variables.

      Am I missing a configuration option anywhere?

      Would it be possible in future release to allow the configuration of the ThreadFactory in the configuration or provide a DefaultLocalExecutorDispatcher that could be overridden?
        • 1. Re: Using a custom ThreadFactory in ProcessingPattern
          567247
          There is currently no way of configuring the ThreadFactory used for the LocalExecutorDispatcher.

          I am assuming you want this to be configured through the ProcessingPattern xml configuration, right? I have filed an issue to track this internally - INC-627.

          To workaround this, currently you will have to roll your own Dispatcher (perhaps by copying the LocalExecutorDispatcher and do your changes in a new class). Note that you don't have to extend the ProcessingPatternNameSpaceHandler to instantiate your new Dispatcher, instead you can use the <instance:class> to instantiate your own custom Dispatcher, including passing in your preferred ThreadFactory. More info on instance namespace here: http://coherence.oracle.com/display/INCUBATOR/The+Instance+Namespace+%281.6.0%29

          Here is an example:

          <processing:dispatchers>
          <processing:logging-dispatcher displayname="Logging Dispatcher" />
          <processing:task-dispatcher displayname="Task Dispatcher">
          <processing:composite-policy>
          <processing:attribute-match-policy />
          <processing:round-robin-policy />
          </processing:composite-policy>
          </processing:task-dispatcher>
          <processing:local-executor-dispatcher displayname="Local Dispatcher" />

          <instance:class classname="com.mycode.MyDispatcher">
          <instance:class classname="com.mycode.MySpecialThreadFactory"/> <!--- Pass in my ThreadFactory as the first constructor parameter -->
          <value:string>My dispatcher</value:string> <!--- Pass in the name of the dispatcher as the second constructor parameter -->
          <value:integer>10</value:integer> <!--- Pass in the number of threads as the third constructor parameter -->
          </instance:class>
          </processing:dispatchers>

          /Christer