09-23-2011 09:12 AM
public Object eval(String script, Bindings n) throws ScriptException {
ScriptThread thread = new ScriptThread(javascriptEngine,script,n);
thread.start();
long startTime = System.currentTimeMillis();
while(System.currentTimeMillis()-startTime < 10000 && thread.getResult() == null);
Object result = thread.getResult();
if(result == null) {
throw new ScriptException("Script execution was too long");
}
return result;
@Override
public void run() {
try {
result = engine.eval(script, bindings);
} catch (ScriptException e) {
e.printStackTrace();
}
}
Exception in thread "Thread-2" java.lang.NullPointerException
at org.activiti.engine.impl.scripting.BeansResolverFactory.containsKey(BeansResolverFactory.java:30)
at org.activiti.engine.impl.scripting.ScriptBindings.containsKey(ScriptBindings.java:52)
at javax.script.SimpleScriptContext.getAttributesScope(Unknown Source)
at com.sun.script.javascript.ExternalScriptable.put(Unknown Source)
at com.sun.script.javascript.RhinoScriptEngine.getRuntimeScope(Unknown Source)
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at xxx.ScriptThread.run(ScriptThread.java:23)
return Context.getProcessEngineConfiguration().getBeans().containsKey(key);
public static ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
Stack<ProcessEngineConfigurationImpl> stack = getStack(processEngineConfigurationStackThreadLocal);
if (stack.isEmpty()) {
return null;
}
return stack.peek();
}
09-23-2011 09:23 AM
09-23-2011 09:32 AM
Context.setProcessEngineConfiguration(config);
Context.setCommandContext(commandContext);
before evaluation. Now I throw a ScriptException if the script is too long. My new problem () is that after the exception is thrown, the script seems to be still running (JavaVM still take 100% of the CPU).Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.