看到每次route都去compilable.compile,是否应该在构造函数里compile,每次route直接用CompiledScript,这样性能应该有提升。 public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { try { List<Invoker<T>> invokersCopy = new ArrayList<Invoker<T>>(invokers); Compilable compilable = (Compilable) engine; Bindings bindings = engine.createBindings(); bindings.put("invokers", invokersCopy); bindings.put("invocation", invocation); bindings.put("context", RpcContext.getContext()); CompiledScript function = compilable.compile(rule);
Activity
fix ScriptRouter中的CompiledScript应该缓存? apache#390
Cache CompiledScript #390 (#3524)
ralf0131 commentedon Feb 21, 2019
This issue is fixed from 2.7.1 onwards.
[-]ScriptRouter中的CompiledScript应该缓存?[/-][+]ScriptRouter should cache CompiledScript[/+]Merge master branch to 3.x dev branch (#3718)