From dccf2becaedc19560e467b93dfe00a9fdfe689af Mon Sep 17 00:00:00 2001 From: gojomo Date: Thu, 14 May 2009 22:27:10 +0000 Subject: [PATCH] copy to h3 Fix for [HER-1612] lock contention in BeanShellDecideRule/BeanShellProcessor occurs even if isolate-threads=true * BeanShellDecideRule.java (getInterpreter) add synchronization (decisionFor) remove method synchronization; sync on interpreter/getInterpreter makes it a superfluous bottleneck * BeanShellProcessor.java (getInterpreter) add synchronization (innerProcess) remove method synchronization; sync on interpreter/getInterpreter makes it a superfluous bottleneck --- .../src/main/java/org/archive/modules/BeanShellProcessor.java | 4 ++-- .../org/archive/modules/deciderules/BeanShellDecideRule.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/src/main/java/org/archive/modules/BeanShellProcessor.java b/modules/src/main/java/org/archive/modules/BeanShellProcessor.java index 8c17bf04..55500a3c 100644 --- a/modules/src/main/java/org/archive/modules/BeanShellProcessor.java +++ b/modules/src/main/java/org/archive/modules/BeanShellProcessor.java @@ -110,7 +110,7 @@ public class BeanShellProcessor extends Processor { } @Override - protected synchronized void innerProcess(ProcessorURI curi) { + protected void innerProcess(ProcessorURI curi) { // depending on previous configuration, interpreter may // be local to this thread or shared Interpreter interpreter = getInterpreter(); @@ -131,7 +131,7 @@ public class BeanShellProcessor extends Processor { * to this thread. * @return Interpreter to use */ - protected Interpreter getInterpreter() { + protected synchronized Interpreter getInterpreter() { if(sharedInterpreter==null && getIsolateThreads()) { // initialize diff --git a/modules/src/main/java/org/archive/modules/deciderules/BeanShellDecideRule.java b/modules/src/main/java/org/archive/modules/deciderules/BeanShellDecideRule.java index e8b134a7..ce50fe74 100644 --- a/modules/src/main/java/org/archive/modules/deciderules/BeanShellDecideRule.java +++ b/modules/src/main/java/org/archive/modules/deciderules/BeanShellDecideRule.java @@ -104,7 +104,7 @@ implements ApplicationContextAware { } @Override - public synchronized DecideResult innerDecide(ProcessorURI uri) { + public DecideResult innerDecide(ProcessorURI uri) { // depending on previous configuration, interpreter may // be local to this thread or shared Interpreter interpreter = getInterpreter(); @@ -127,7 +127,7 @@ implements ApplicationContextAware { * to this thread. * @return Interpreter to use */ - protected Interpreter getInterpreter() { + protected synchronized Interpreter getInterpreter() { if(sharedInterpreter==null && getIsolateThreads()) { // initialize