Make all reactor script invocations thread safe
Might be a bit overkill to force synchronization for every single method invocation when the only scheduling done in reactor scripts are: - 5511000 (summon Targa) - 5511001 (summon Scarlion)
This commit is contained in:
@@ -13,10 +13,14 @@ import javax.script.ScriptException;
|
||||
public class SynchronizedInvocable implements Invocable {
|
||||
private final Invocable invocable;
|
||||
|
||||
public SynchronizedInvocable(Invocable invocable) {
|
||||
private SynchronizedInvocable(Invocable invocable) {
|
||||
this.invocable = invocable;
|
||||
}
|
||||
|
||||
public static Invocable of(Invocable invocable) {
|
||||
return new SynchronizedInvocable(invocable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException {
|
||||
return invocable.invokeMethod(thiz, name, args);
|
||||
|
||||
Reference in New Issue
Block a user