org.gstreamer.swing
Class SwingExecutorService

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.gstreamer.swing.SwingExecutorService
All Implemented Interfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.util.concurrent.ScheduledExecutorService

public class SwingExecutorService
extends java.util.concurrent.AbstractExecutorService
implements java.util.concurrent.ScheduledExecutorService

A ScheduledExecutorService that executes tasks and timers on the AWT/Swing EDT.


Constructor Summary
SwingExecutorService()
          Creates a new ScheduledExecutorService.
 
Method Summary
 boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit units)
           
 void execute(java.lang.Runnable task)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
<V> java.util.concurrent.ScheduledFuture<V>
schedule(java.util.concurrent.Callable<V> task, long initialDelay, java.util.concurrent.TimeUnit units)
           
 java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable task, long initialDelay, java.util.concurrent.TimeUnit units)
           
 java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long interval, java.util.concurrent.TimeUnit units)
           
 java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long interval, java.util.concurrent.TimeUnit units)
           
 void shutdown()
          Stops this executor service from accepting any more tasks.
 java.util.List<java.lang.Runnable> shutdownNow()
           
<T> T
wrap(java.lang.Class<T> interfaceClass, T instance)
          Creates a proxy version of interfaceClass that executes instance on the Swing EDT when any of its methods are invoked.
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.ExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
 

Constructor Detail

SwingExecutorService

public SwingExecutorService()
Creates a new ScheduledExecutorService.

Method Detail

wrap

public <T> T wrap(java.lang.Class<T> interfaceClass,
                  T instance)
Creates a proxy version of interfaceClass that executes instance on the Swing EDT when any of its methods are invoked.

Parameters:
interfaceClass - the interface to generate.
instance - the instance to delegate calls to.
Returns:
a new instance of interfaceclass.

shutdown

public void shutdown()
Stops this executor service from accepting any more tasks.

Specified by:
shutdown in interface java.util.concurrent.ExecutorService

shutdownNow

public java.util.List<java.lang.Runnable> shutdownNow()
Specified by:
shutdownNow in interface java.util.concurrent.ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface java.util.concurrent.ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface java.util.concurrent.ExecutorService

awaitTermination

public boolean awaitTermination(long timeout,
                                java.util.concurrent.TimeUnit units)
                         throws java.lang.InterruptedException
Specified by:
awaitTermination in interface java.util.concurrent.ExecutorService
Throws:
java.lang.InterruptedException

execute

public void execute(java.lang.Runnable task)
Specified by:
execute in interface java.util.concurrent.Executor

schedule

public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable task,
                                                        long initialDelay,
                                                        java.util.concurrent.TimeUnit units)
Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

schedule

public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> task,
                                                            long initialDelay,
                                                            java.util.concurrent.TimeUnit units)
Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

scheduleAtFixedRate

public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable task,
                                                                   long initialDelay,
                                                                   long interval,
                                                                   java.util.concurrent.TimeUnit units)
Specified by:
scheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorService

scheduleWithFixedDelay

public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable task,
                                                                      long initialDelay,
                                                                      long interval,
                                                                      java.util.concurrent.TimeUnit units)
Specified by:
scheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorService


Copyright © 2010. All Rights Reserved.