Package javax.script

Examples of javax.script.Compilable


            this.batchSize = batchSize;
           
            LOG.debug("Created metric pickler with prefix {} and batchSize {}", prefix, batchSize);
           
            ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");           
            Compilable compilable = (Compilable) engine;
            pickleScript = compilable.compile(PICKLER_SCRIPT);

        }
View Full Code Here


            this.batchSize = batchSize;
           
            LOG.debug("Created metric pickler with prefix {} and batchSize {}", prefix, batchSize);
           
            ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");           
            Compilable compilable = (Compilable) engine;
            pickleScript = compilable.compile(PICKLER_SCRIPT);

        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, 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);
            Object obj = function.eval(bindings);
            if (obj instanceof Invoker[]) {
                invokersCopy = Arrays.asList((Invoker<T>[]) obj);
            } else if (obj instanceof Object[]) {
                invokersCopy = new ArrayList<Invoker<T>>();
View Full Code Here

    @SuppressWarnings("unchecked")
    public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, 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);
            Object obj = function.eval(bindings);
            if (obj instanceof Invoker[]) {
                invokersCopy = Arrays.asList((Invoker<T>[]) obj);
            } else if (obj instanceof Object[]) {
                invokersCopy = new ArrayList<Invoker<T>>();
View Full Code Here

            this.batchSize = batchSize;
           
            LOG.debug("Created metric pickler with prefix {} and batchSize {}", prefix, batchSize);
           
            ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");           
            Compilable compilable = (Compilable) engine;
            try {
                pickleScript = compilable.compile(PICKLER_SCRIPT);
            } catch (ScriptException e) {
                throw new RuntimeException("Unable to compile pickle script", e);
            }

        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, 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);
            Object obj = function.eval(bindings);
            if (obj instanceof Invoker[]) {
                invokersCopy = Arrays.asList((Invoker<T>[]) obj);
            } else if (obj instanceof Object[]) {
                invokersCopy = new ArrayList<Invoker<T>>();
View Full Code Here

TOP

Related Classes of javax.script.Compilable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.