From: adam Date: Thu, 23 Sep 2004 04:35:59 +0000 (+0000) Subject: allow more concurrency in script execution X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=518251798accf9497e0cc2ad02a4bfa68fd2af4a;p=org.ibex.mail.git allow more concurrency in script execution darcs-hash:20040923043559-5007d-c5dcb180145d2b9691529cdd3f88233d96487f80.gz --- 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...");