logahawk.swing
Class EventDispatchThreadListener

java.lang.Object
  extended by logahawk.listeners.ProxyListener
      extended by logahawk.swing.EventDispatchThreadListener
All Implemented Interfaces:
Listener

public class EventDispatchThreadListener
extends ProxyListener

Ensures that the proxied Listener is only called on the EDT. This will use either SwingUtilities.invokeLater(Runnable) or SwingUtilities.invokeAndWait(Runnable) depending on block. The benefit of using SwingUtilities.invokeAndWait(Runnable) the application needs to pause and wait for the user to do something before continuing -- insert a new disk, remove a disk before reboot, connect a peripheral, change a tape, etc. (Note that you cannot block if you are using something like BlockingQueueLogger.


Field Summary
protected  boolean block
          If true this will use SwingUtilities.invokeAndWait(Runnable), blocking the calling thread.
 
Fields inherited from class logahawk.listeners.ProxyListener
listener
 
Constructor Summary
EventDispatchThreadListener(Listener listener)
           
EventDispatchThreadListener(Listener listener, boolean block)
           
 
Method Summary
 void log(LogMeta meta, String text)
          Logs the provided statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

block

protected final boolean block
If true this will use SwingUtilities.invokeAndWait(Runnable), blocking the calling thread. Default value is false.

Constructor Detail

EventDispatchThreadListener

public EventDispatchThreadListener(Listener listener)

EventDispatchThreadListener

public EventDispatchThreadListener(Listener listener,
                                   boolean block)
Method Detail

log

public void log(LogMeta meta,
                String text)
Description copied from interface: Listener
Logs the provided statement. Normally this method should not throw any exceptions. If exceptions are expected it is recommend to wrap this Listener with a FailSafeListener.