package com.ardverk.utils;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicReference;

public class EventUtils {

    private static AtomicReference<Thread> REFERENCE 
        = new AtomicReference<Thread>();
    
    private static final ThreadFactory FACTORY
            = new SimpleThreadFactory("EventUtilsThread") {
        @Override
        public Thread newThread(Runnable r) {
            Thread thread = super.newThread(r);
            REFERENCE.set(thread);
            return thread;
        }
    };
    
    private static final Executor EXECUTOR 
        = Executors.newSingleThreadExecutor(FACTORY);

    private EventUtils() {
    }

    public static boolean isEventThread() {
        return REFERENCE.get() == Thread.currentThread();
    }
    
    public static void fireEvent(Runnable event) {
        EXECUTOR.execute(event);
    }
}

@@ -32,171 +32,45 @@
 ort 
-java.util.concurrent.Executor;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.ThreadFactory;%0Aimport java.util.concurrent.atomic.AtomicReference
+org.ardverk.concurrent.AsyncExecutors
 ;%0A%0Ap
@@ -98,510 +98,12 @@
 s %7B%0A
-%0A
     
-private static AtomicReference%3CThread%3E REFERENCE %0A        = new AtomicReference%3CThread%3E();%0A    %0A    private static final ThreadFactory FACTORY%0A            = new SimpleThreadFactory(%22EventUtilsThread%22) %7B%0A        @Override%0A        public Thread newThread(Runnable r) %7B%0A            Thread thread = super.newThread(r);%0A            REFERENCE.set(thread);%0A            return thread;%0A        %7D%0A    %7D;%0A    %0A    private static final Executor EXECUTOR %0A        = Executors.newSingleThreadExecutor(FACTORY);%0A
 %0A   
@@ -196,38 +196,27 @@
 urn 
-REFERENCE.get() == Thread.curr
+AsyncExecutors.isEv
 entT
@@ -298,24 +298,32 @@
     
-EXECUTOR.execute
+AsyncExecutors.fireEvent
 (eve

Use AsyncExecutors' Event Thread