You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Lucas Moten (JIRA)" <ji...@apache.org> on 2008/09/17 16:13:44 UTC

[jira] Created: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

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


<p>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></p>

<p>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.</p>

<p>A FilterMediator extends AbstractListMediator, but for the else branch, uses a ListMediator.</p>

<p>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.</p>

<p>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.</p>

<p>A workaround is to use named sequences wherever possible, and reference that instead, as the 'else' branch of a FilterMediator can alternatively use an elseKey.</p>

<p>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.</p>

<p>For example, this cannot work because the inline sequence is not initialized, and thus callout isn't initialized</p>
<pre>
<switch>
  <case>
    <callout>...</callout>
  </case>
</switch>
</pre>
<p>For filters, this cannot work because inline sequences are not initialized</p><pre>
<filter>
  <then>..</then>
  <else>
    <callout>
  </else>
</filter>
</pre>
<p>But this can</p><pre>
<filter>
  <callout>
</filter>
</pre>
<p>as can this</p><pre>
<filter>
  <then>
    <callout>
  </then>
</filter>
</pre>
<p>and this</p><pre>
<sequence name="namedsequence">
  <callout>
</sequence>
<filter>
  <then>..</then>
  <else sequence="namedsequence">
</filter
</pre>

-- 
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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Assigned: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen reassigned SYNAPSE-451:
---------------------------------------

    Assignee: Andreas Veithen

> 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
>            Assignee: Andreas Veithen
>
> 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Commented: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SYNAPSE-451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631903#action_12631903 ] 

Andreas Veithen commented on SYNAPSE-451:
-----------------------------------------

I fixed FilterMediator. I will to the others later.

> 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
>            Assignee: Andreas Veithen
>
> 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Updated: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

Posted by "Lucas Moten (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lucas Moten updated SYNAPSE-451:
--------------------------------

    Description: 
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>

  was:
<p>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></p>

<p>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.</p>

<p>A FilterMediator extends AbstractListMediator, but for the else branch, uses a ListMediator.</p>

<p>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.</p>

<p>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.</p>

<p>A workaround is to use named sequences wherever possible, and reference that instead, as the 'else' branch of a FilterMediator can alternatively use an elseKey.</p>

<p>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.</p>

<p>For example, this cannot work because the inline sequence is not initialized, and thus callout isn't initialized</p>
<pre>
<switch>
  <case>
    <callout>...</callout>
  </case>
</switch>
</pre>
<p>For filters, this cannot work because inline sequences are not initialized</p><pre>
<filter>
  <then>..</then>
  <else>
    <callout>
  </else>
</filter>
</pre>
<p>But this can</p><pre>
<filter>
  <callout>
</filter>
</pre>
<p>as can this</p><pre>
<filter>
  <then>
    <callout>
  </then>
</filter>
</pre>
<p>and this</p><pre>
<sequence name="namedsequence">
  <callout>
</sequence>
<filter>
  <then>..</then>
  <else sequence="namedsequence">
</filter
</pre>


> 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Commented: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

Posted by "Lucas Moten (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Resolved: (SYNAPSE-451) Selection Mediators don't carry initialization through all branches

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved SYNAPSE-451.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3

> 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
>            Assignee: Andreas Veithen
>             Fix For: 1.3
>
>
> 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org