diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/GLWorkerThread.java | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLWorkerThread.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index 100b46a5e..131e6f3ac 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -86,7 +86,7 @@ public class GLWorkerThread { thread.start(); try { lock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } } @@ -149,7 +149,7 @@ public class GLWorkerThread { } } - public static void invoke(boolean wait, Runnable runnable) + public static void invoke(final boolean wait, final Runnable runnable) throws InvocationTargetException, InterruptedException { if(wait) { invokeAndWait(runnable); @@ -158,13 +158,13 @@ public class GLWorkerThread { } } - public static void invokeAndWait(Runnable runnable) + public static void invokeAndWait(final Runnable runnable) throws InvocationTargetException, InterruptedException { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeAndWait on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -179,19 +179,19 @@ public class GLWorkerThread { lockTemp.notifyAll(); lockTemp.wait(); if (exception != null) { - Throwable localException = exception; + final Throwable localException = exception; exception = null; throw new InvocationTargetException(localException); } } } - public static void invokeLater(Runnable runnable) { + public static void invokeLater(final Runnable runnable) { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeLater on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -237,7 +237,7 @@ public class GLWorkerThread { try { // Avoid race conditions with wanting to release contexts on this thread lock.wait(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } if (GLContext.getCurrent() != null) { @@ -256,7 +256,7 @@ public class GLWorkerThread { if (work != null) { try { work.run(); - } catch (Throwable t) { + } catch (final Throwable t) { exception = t; } finally { work = null; @@ -266,19 +266,19 @@ public class GLWorkerThread { while (!queue.isEmpty()) { try { - Runnable curAsync = queue.remove(0); + final Runnable curAsync = queue.remove(0); curAsync.run(); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println(getThreadName()+": Exception occurred on JOGL OpenGL worker thread:"); t.printStackTrace(); } } // See about releasing current context - GLContext curContext = GLContext.getCurrent(); + final GLContext curContext = GLContext.getCurrent(); if (curContext != null && (curContext instanceof GLContextImpl)) { - GLContextImpl impl = (GLContextImpl) curContext; + final GLContextImpl impl = (GLContextImpl) curContext; if (impl.hasWaiters()) { impl.release(); } |