### Question:
EnvFunction extends FunctionExpressionImpl { public static void setGlobalValues(Map<String, Object> values) { globalLookup.clear(); if (values != null) { for (Entry<String, Object> e : values.entrySet()) { globalLookup.put(e.getKey().toUpperCase(), e.getValue()); } } } EnvFunction(); static void setLocalValues(Map<String, Object> values); static void clearLocalValues(); static void setGlobalValues(Map<String, Object> values); static void clearGlobalValues(); static void setLocalValue(String name, Object value); static void setGlobalValue(String name, Object value); @Override int getArgCount(); @Override Object evaluate(Object feature); @Override void setParameters(List params); @Override void setFallbackValue(Literal fallback);  }### Answer:
@Test public void testSetGlobalValues() throws Exception { System.out.println(" setGlobalValues"); final Map<String, Object> table = new HashMap<String, Object>(); table.put("foo", 1); table.put("bar", 2); EnvFunction.setGlobalValues(table); final CountDownLatch latch = new CountDownLatch(2); class Task implements Runnable { final String key; Task(String key) { if (!table.containsKey(key)) { throw new IllegalArgumentException("Invalid arg " + key); } this.key = key; } public void run() { EnvFunction.setGlobalValue(key, table.get(key)); latch.countDown(); try { latch.await(); } catch (InterruptedException ex) { throw new IllegalStateException(ex); } for (String name : table.keySet()) { Object result = ff.function("env", ff.literal(name)).evaluate(null); int value = ((Number) result).intValue(); assertEquals(table.get(name), value); } } } Future f1 = executor.submit(new Task("foo")); Future f2 = executor.submit(new Task("bar")); f1.get(); f2.get(); }