allow more concurrency in script execution
authoradam <adam@megacz.com>
Thu, 23 Sep 2004 04:35:59 +0000 (04:35 +0000)
committeradam <adam@megacz.com>
Thu, 23 Sep 2004 04:35:59 +0000 (04:35 +0000)
darcs-hash:20040923043559-5007d-c5dcb180145d2b9691529cdd3f88233d96487f80.gz

src/org/ibex/mail/target/Script.java

index d2bca1b..27541d7 100644 (file)
@@ -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...");