<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: Latest</li>
<li>Operating System version: win10</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private static &lt;T&gt; Invoker&lt;T&gt; buildInvokerChain(final Invoker&lt;T&gt; invoker, String key, String group) {
        Invoker&lt;T&gt; last = invoker;
        List&lt;Filter&gt; filters = ExtensionLoader.getExtensionLoader(Filter.class).getActivateExtension(invoker.getUrl(), key, group);
        if (!filters.isEmpty()) {
            for (int i = filters.size() - 1; i &gt;= 0; i--) {
                final Filter filter = filters.get(i);
                final Invoker&lt;T&gt; next = last;
                last = new Invoker&lt;T&gt;() {

                   ...........
                    @Override
                    public Result invoke(Invocation invocation) throws RpcException {
                        return filter.invoke(next, invocation);
                    }
                   ...........
                };
            }
        }
        return last;
    }"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-k">static</span> &lt;<span class="pl-smi">T</span>&gt; <span class="pl-s1">Invoker</span>&lt;<span class="pl-s1">T</span>&gt; <span class="pl-s1">buildInvokerChain</span>(<span class="pl-k">final</span> <span class="pl-smi">Invoker</span>&lt;<span class="pl-smi">T</span>&gt; <span class="pl-s1">invoker</span>, <span class="pl-smi">String</span> <span class="pl-s1">key</span>, <span class="pl-smi">String</span> <span class="pl-s1">group</span>) {
        <span class="pl-smi">Invoker</span>&lt;<span class="pl-smi">T</span>&gt; <span class="pl-s1">last</span> = <span class="pl-s1">invoker</span>;
        <span class="pl-smi">List</span>&lt;<span class="pl-smi">Filter</span>&gt; <span class="pl-s1">filters</span> = <span class="pl-smi">ExtensionLoader</span>.<span class="pl-en">getExtensionLoader</span>(<span class="pl-smi">Filter</span>.<span class="pl-k">class</span>).<span class="pl-en">getActivateExtension</span>(<span class="pl-s1">invoker</span>.<span class="pl-en">getUrl</span>(), <span class="pl-s1">key</span>, <span class="pl-s1">group</span>);
        <span class="pl-k">if</span> (!<span class="pl-s1">filters</span>.<span class="pl-en">isEmpty</span>()) {
            <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-s1">filters</span>.<span class="pl-en">size</span>() - <span class="pl-c1">1</span>; <span class="pl-s1">i</span> &gt;= <span class="pl-c1">0</span>; <span class="pl-s1">i</span>--) {
                <span class="pl-k">final</span> <span class="pl-smi">Filter</span> <span class="pl-s1">filter</span> = <span class="pl-s1">filters</span>.<span class="pl-en">get</span>(<span class="pl-s1">i</span>);
                <span class="pl-k">final</span> <span class="pl-smi">Invoker</span>&lt;<span class="pl-smi">T</span>&gt; <span class="pl-s1">next</span> = <span class="pl-s1">last</span>;
                <span class="pl-s1">last</span> = <span class="pl-k">new</span> <span class="pl-smi">Invoker</span>&lt;<span class="pl-smi">T</span>&gt;() {

                   ...........
                    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
                    <span class="pl-k">public</span> <span class="pl-smi">Result</span> <span class="pl-en">invoke</span>(<span class="pl-smi">Invocation</span> <span class="pl-s1">invocation</span>) <span class="pl-k">throws</span> <span class="pl-smi">RpcException</span> {
                        <span class="pl-k">return</span> <span class="pl-s1">filter</span>.<span class="pl-en">invoke</span>(<span class="pl-s1">next</span>, <span class="pl-s1">invocation</span>);
                    }
                   ...........
                };
            }
        }
        <span class="pl-k">return</span> <span class="pl-s1">last</span>;
    }</pre></div>
<p dir="auto">it will creates the same number of the <strong>anonymous Invoker class</strong> as <strong>filters size</strong> when refer() or export(...) every time, it's a linked structure</p>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">use one <strong>anonymous Invoker class</strong> to instead of it</p>
<p dir="auto">use one <strong>for</strong> call to instead of <strong>linked</strong> call</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">NONE</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.5.3</li>
<li>Operating System version: macOS Mojave</li>
<li>Java version: 1.8.0_201</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>register a script route to an interface</li>
<li>the script will get the applicationName by the args of context</li>
</ol>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function route(invokers, invocation, context) {
    print(invokers);
    print(invocation);
    print(context);
    print(context.getUrl());
    print(context.getUrls());
    print(context.getUrl().getParameter(&quot;application&quot;));
    return invokers;
}
route(invokers, invocation, context);"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">route</span><span class="pl-kos">(</span><span class="pl-s1">invokers</span><span class="pl-kos">,</span> <span class="pl-s1">invocation</span><span class="pl-kos">,</span> <span class="pl-s1">context</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">invokers</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">invocation</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">getUrl</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">getUrls</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">getUrl</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">getParameter</span><span class="pl-kos">(</span><span class="pl-s">"application"</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> <span class="pl-s1">invokers</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-en">route</span><span class="pl-kos">(</span><span class="pl-s1">invokers</span><span class="pl-kos">,</span> <span class="pl-s1">invocation</span><span class="pl-kos">,</span> <span class="pl-s1">context</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<ol start="3" dir="auto">
<li>the url may be null sometimes。This is consumerSide，I think it shouldn't be null always。<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/19384711/66380472-19718580-e9ea-11e9-81b9-4e1739ba47fd.png"><img src="https://user-images.githubusercontent.com/19384711/66380472-19718580-e9ea-11e9-81b9-4e1739ba47fd.png" alt="image" style="max-width: 100%;"></a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/19384711/66380484-22625700-e9ea-11e9-829b-817048cf0e74.png"><img src="https://user-images.githubusercontent.com/19384711/66380484-22625700-e9ea-11e9-829b-817048cf0e74.png" alt="image" style="max-width: 100%;"></a><br>
the scriptRoute is executed before ConsumerContextFilter   and I can't find other place that the RpcContext was inited。</li>
</ol>
<p dir="auto">Based on the above code, it should be null always。</p>
<p dir="auto">I feel very puzzled.  I need some help。</p>