[
https://issues.apache.org/jira/browse/SYNAPSE-451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631901#action_12631901
]
Lucas Moten commented on SYNAPSE-451:
-------------------------------------
The following mediators contain inline sequences that are not initialized:
core/org.apache.synapse.config.mediators.builtin.CacheMediator
core/org.apache.synapse.config.mediators.ejp.aggregator.AggregateMediator
core/org.apache.synapse.config.mediators.filters.FilterMediator (only true
branch is initialized)
core/org.apache.synapse.config.mediators.filters.SwitchMediator (does not
support named sequences, no workaround)
extensions/org.apache.synapse.config.mediators.throttle.ThrottleMediator
With exception to FilterMediator, each of these extends AbstractMediator.
Notes above explain what works and doesn't for mediators in the true/false
branches of FilterMediator.
Mediators that are nested within the sequences of these 5 mediators can fail if
they require initialization. This includes CalloutMediator, in some cases
ClassMediator (if its ManagedLifeCycle), and presumably SpringMediator.
If a mediator is not an instance of ManagedLifecycle, but allows for sequences,
then each mediator of each sequence should be checked to determine whether it
needs initialization. The init logic in AbstractListMediator is essentially
what needs to be replicated in the five classes above, and any others later on
supporting sequences.
> Selection Mediators don't carry initialization through all branches
> -------------------------------------------------------------------
>
> Key: SYNAPSE-451
> URL: https://issues.apache.org/jira/browse/SYNAPSE-451
> Project: Synapse
> Issue Type: Bug
> Components: Core
> Reporter: Lucas Moten
>
> See also: JIRAs <a
> href="https://issues.apache.org/jira/browse/SYNAPSE-437">Apache
> SYNAPSE-437</a>, <a href="https://wso2.org/jira/browse/ESBJAVA-422">WSO2
> ESBJAVA-422</a>
> Thus far, this mostly appears to be an issue with CalloutMediator, because
> it's mediate method depends upon init() having been run to setup the
> ServiceClient.
> A FilterMediator extends AbstractListMediator, but for the else branch, uses
> a ListMediator.
> When synapse initializes inline sequences as part of SynapseConfiguration,
> the init method of SequenceMediator is called. This in turn calls init of
> its superclass, which is AbstractListMediator. In that class, all child
> mediators that are instances of ManagedLifecycle are in turn initialized.
> For the FilterMediator, the 'then' branch, as an AbstractListMediator being
> an instance of ManagedLifecycle is initialized at startup. However, the
> 'else' branch, being declared as a ListMediator, will not be. Thus, it
> appears as though any mediator requiring initialization inside of the Filter
> else branch will fail (NullPointerException) when it is referenced.
> The workaround is to use named sequences wherever possible, and reference
> that instead, as the 'else' branch of a FilterMediator can alternatively use
> an elseKey.
> However, this workaround appears to have limits when it comes to the
> SwitchMediator. Inline sequences are handled inside of SwitchCase as an
> AnonymousListMediator and like the FilterMediator, aren't initialized by top
> level in/out inline target sequences. Since SwitchMediators don't have the
> option of referencing a registry key for a named sequence initialized at
> startup, I believe this breaks the ability to run certain child mediators
> that require initialization of objects that only occur when init is called.
> For example, this cannot work because the inline sequence is not initialized
> <switch>
> <case>
> <callout>...</callout>
> </case>
> </switch>
> For filters, this cannot work because inline sequences are not initialized
> <filter>
> <then>..</then>
> <else>
> <callout>
> </else>
> </filter>
> But this can
> <filter>
> <callout>
> </filter>
> as can this
> <filter>
> <then>
> <callout>
> </then>
> </filter>
> and this
> <sequence name="namedsequence">
> <callout>
> </sequence>
> <filter>
> <then>..</then>
> <else sequence="namedsequence">
> </filter>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]