You are viewing an older version of this section. Click here to navigate to the latest version.

Pooling Modules

Allow the user of the custom Mule Module to use a pool instead of a single instance to process messages.

From Mule 3 documentation:

Pooled components each have a component pool, which contains multiple instances of the component to handle simultaneous incoming requests. A service’s pooling profile configures its component pool.

When setting the poolabe parameter to true the generated schema will include additional configuration elements.


@Module(name = "mymodule", poolable = true)
public class MyModule {

The pooling-config element is nested inside the config element. Notice that there is no need to provide any custom Java code to handle the pool. All is needed is to provide some details for the pool, which are provided by the users of the extensions:

    <mymodule:pooling-profile maxActive="10" maxIdle="5" initialisationPolicy="INITIALISE_ALL"
                         exhaustedAction="WHEN_EXHAUSTED_FAIL" maxWait="60"/>

The attributes for the pooling-profile element have the following meaning:

Attribute Name Descriptipn


Required. Controls the maximum number of Mule components that can be borrowed from a session at one time. When set to a negative value, there is no limit to the number of components that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted.


Required. Controls the maximum number of Mule components that can sit idle in the pool at any time. When set to a negative value, there is no limit to the number of Mule components that may be idle at one time.


Optional. Determines how components in a pool should be initialized. The possible values are: INITIALISE_NONE (will not load any components into the pool on startup), INITIALISE_ONE (will load one initial component into the pool on startup), or INITIALISE_ALL (will load all components in the pool on startup). Default value is: INITIALISE_ONE


Optional. Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are: WHEN_EXHAUSTED_FAIL, which will throw a NoSuchElementException, WHEN_EXHAUSTED_WAIT, which will block by invoking Object.wait(long) until a new or idle object is available, or WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for at most that many milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely. Default value is: WHEN_EXHAUSTED_GROW


Required. Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the exhaustedAction is set to WHEN_EXHAUSTED_WAIT.