diff options
author | Sven Gothel <sgothel@jausoft.com> | 2010-10-14 18:46:50 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2010-10-14 18:46:50 +0200 |
commit | fe17e13d5c0d70fe0d2e2e09b2b91a5827d234b4 (patch) | |
tree | 90953e0fe6b8fb5f8d796e004523b8503803787b /src/newt/classes/com | |
parent | 6ced17f0325d5719e992b246ffd156e5b39694b4 (diff) |
NEWT: Drop post stop tasks on EDT due to it's recursive nature (DEBUG traces them).
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java index fd68bb6cf..ce204cd25 100644 --- a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java +++ b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java @@ -62,10 +62,11 @@ public class DefaultEDTUtil implements EDTUtil { public final void reset() { synchronized(edtLock) { waitUntilStopped(); - if(edt.tasks.size()>0) { - throw new RuntimeException("Remaining EDTTasks: "+edt.tasks.size()+" - "+edt); - } if(DEBUG) { + if(edt.tasks.size()>0) { + Throwable t = new Throwable("Warning: EDT reset, remaining tasks: "+edt.tasks.size()+" - "+edt); + t.printStackTrace(); + } System.err.println(Thread.currentThread()+": EDT reset - edt: "+edt); } this.edt = new EventDispatchThread(threadGroup, name); @@ -115,7 +116,12 @@ public class DefaultEDTUtil implements EDTUtil { synchronized(rTaskLock) { // lock the optional task execution synchronized(edtLock) { // lock the EDT status if( edt.shouldStop ) { - throw new RuntimeException("EDT about to stop: "+edt); + // drop task .. + if(DEBUG) { + Throwable t = new Throwable("Warning: EDT about (1) to stop, won't enqueue new task: "+edt); + t.printStackTrace(); + } + return; } // Exception ee = new Exception("XXX stop: "+stop+", tasks: "+edt.tasks.size()+", task: "+task); // ee.printStackTrace(); @@ -130,7 +136,8 @@ public class DefaultEDTUtil implements EDTUtil { task.run(); wait = false; // running in same thread (EDT) -> no wait if(stop && edt.tasks.size()>0) { - throw new RuntimeException("Remaining EDTTasks: "+edt.tasks.size()+" - "+edt); + Throwable t = new Throwable("Warning: EDT about (2) to stop, having remaining tasks: "+edt.tasks.size()+" - "+edt); + t.printStackTrace(); } } else { start(); // start if not started yet @@ -272,11 +279,14 @@ public class DefaultEDTUtil implements EDTUtil { task.run(); tasks.notifyAll(); } - if(null!=task && task.getAttachment()==null) { - error = new RuntimeException("Last EDTTasks Not Final: "+tasks.size()+ - ", "+task+" - "+edt); - } else if(tasks.size()>0) { - error = new RuntimeException("Remaining EDTTasks Post Final: "+tasks.size()); + if(DEBUG) { + if(null!=task && task.getAttachment()==null) { + Throwable t = new Throwable("Warning: EDT exit: Last task Not Final: "+tasks.size()+", "+task+" - "+edt); + t.printStackTrace(); + } else if(tasks.size()>0) { + Throwable t = new Throwable("Warning: EDT exit: Remaining tasks Post Final: "+tasks.size()); + t.printStackTrace(); + } } } } |