X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FScheduler.java;h=09487bd5ff2076d6a73b1a40aa0f1842a35f590a;hb=b1568b13f53ca805911fcd7737daf79492d6be1f;hp=4ec0aec32d0b2ba1ea377bbe3ca070022c05cf60;hpb=3591b88b94a6bb378af3d4abe6eb5233ce583104;p=org.ibex.core.git diff --git a/src/org/ibex/Scheduler.java b/src/org/ibex/Scheduler.java index 4ec0aec..09487bd 100644 --- a/src/org/ibex/Scheduler.java +++ b/src/org/ibex/Scheduler.java @@ -1,6 +1,8 @@ // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL] package org.ibex; +import java.io.IOException; + import org.ibex.js.*; import org.ibex.util.*; @@ -10,8 +12,8 @@ public class Scheduler { // Public API Exposed to org.ibex ///////////////////////////////////////////////// private static Scheduler singleton; - public static interface Task { public abstract void perform() throws Exception; } - public static void add(Task t) { singleton.runnable.append(t); } + public static interface Task { public abstract void perform() throws IOException, JSExn; } + public static void add(Task t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); } public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); } private static Task current = null; @@ -72,16 +74,18 @@ public class Scheduler { s._mousey = s.mousey; } } + Log.debug(Scheduler.class, "performing " + current); current.perform(); } renderAll(); } catch (JSExn e) { Log.info(Scheduler.class, "a JavaScript thread spawned with ibex.thread() threw an exception:"); - Log.info(Scheduler.class, "JS Exception: " + e.getObject() + "\n" + e.backtrace()); Log.info(Scheduler.class,e); } catch (Exception e) { Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:"); Log.info(Scheduler.class, e); + } catch (Throwable t) { + t.printStackTrace(); } // if an Error is thrown it will cause the engine to quit }