From 518251798accf9497e0cc2ad02a4bfa68fd2af4a Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 23 Sep 2004 04:35:59 +0000 Subject: [PATCH] allow more concurrency in script execution darcs-hash:20040923043559-5007d-c5dcb180145d2b9691529cdd3f88233d96487f80.gz --- src/org/ibex/mail/target/Script.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/org/ibex/mail/target/Script.java b/src/org/ibex/mail/target/Script.java index d2bca1b..27541d7 100644 --- a/src/org/ibex/mail/target/Script.java +++ b/src/org/ibex/mail/target/Script.java @@ -24,7 +24,9 @@ public class Script extends Target { final JS js; private Message m = null; + private String filePath = null; public Script(String filePath) throws JSExn, IOException { + this.filePath = filePath; js = JS.cloneWithNewParentScope(JS.fromReader(filePath, 0, new InputStreamReader(new FileInputStream(filePath))), new ScriptScope()); } @@ -38,7 +40,16 @@ public class Script extends Target { } } - public synchronized void accept(Message m) throws IOException, MailException { + public void accept(Message m) throws IOException, MailException { + try { + new Script(filePath).reallyAccept(m); + } catch (JSExn e) { + Log.error(this, e); + throw new MailException(e.toString()); + } + } + + private synchronized void reallyAccept(Message m) throws IOException, MailException, JSExn { this.m = m; try { Log.info(this, "invoking config..."); -- 1.7.10.4