|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -158,10 +158,9 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -158,10 +158,9 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
public Object getScriptedObject(ScriptSource scriptSource, Class<?>... actualInterfaces) |
|
|
|
|
throws IOException, ScriptCompilationException { |
|
|
|
|
|
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
try { |
|
|
|
|
Class<?> scriptClassToExecute; |
|
|
|
|
|
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
this.wasModifiedForTypeCheck = false; |
|
|
|
|
|
|
|
|
|
if (this.cachedResult != null) { |
|
|
|
@ -186,22 +185,24 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -186,22 +185,24 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
scriptClassToExecute = this.scriptClass; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Process re-execution outside of the synchronized block.
|
|
|
|
|
return executeScript(scriptSource, scriptClassToExecute); |
|
|
|
|
} |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
this.scriptClass = null; |
|
|
|
|
this.scriptResultClass = null; |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Class<?> getScriptedObjectType(ScriptSource scriptSource) |
|
|
|
|
throws IOException, ScriptCompilationException { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
try { |
|
|
|
|
if (this.scriptClass == null || scriptSource.isModified()) { |
|
|
|
|
// New script content...
|
|
|
|
|
this.wasModifiedForTypeCheck = true; |
|
|
|
@ -220,11 +221,14 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -220,11 +221,14 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
} |
|
|
|
|
return this.scriptResultClass; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
this.scriptClass = null; |
|
|
|
|
this.scriptResultClass = null; |
|
|
|
|
this.cachedResult = null; |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean requiresScriptedObjectRefresh(ScriptSource scriptSource) { |
|
|
|
|