EventBus/src/org/greenrobot/eventbus/util/AsyncExecutor.java
public void execute(final RunnableEx runnable) {
        threadPool.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    runnable.run();
                } catch (Exception e) {
                    Object event;
                    try {
                        event = failureEventConstructor.newInstance(e);
                    } catch (Exception e1) {
                        eventBus.getLogger().log(Level.SEVERE, "Original exception:", e);
                        throw new RuntimeException("Could not create failure event", e1);
                    }
                    if (event instanceof HasExecutionScope) {
                        ((HasExecutionScope) event).setExecutionScope(scope);
                    }
                    eventBus.post(event);
                }
            }
        });
    }
public void execute(final RunnableEx runnable) {
        threadPool.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    runnable.run();
                } catch (Exception e) {
                    Object event;
                    try {
                        event = failureEventConstructor.newInstance(e);
                    } catch (Exception e1) {
                        eventBus.getLogger().log(Level.SEVERE, "Original exception:", e);
                        throw new RuntimeException("Could not create failure event", e1);
                    }
                    if (event instanceof HasExecutionScope) {
                        ((HasExecutionScope) event).setExecutionScope(scope);
                    }
                    eventBus.post(event);
                }
            }
        });
    }
public void execute ( final RunnableEx runnable ) { threadPool . execute ( new Runnable ( ) { @ Override public void run ( ) { try { runnable . run ( ) ; } catch ( Exception e ) { Object event ; try { event = failureEventConstructor . newInstance ( e ) ; } catch ( Exception e1 ) { eventBus . getLogger ( ) . log ( Level . SEVERE , "Original exception:" , e ) ; throw new RuntimeException ( "Could not create failure event" , e1 ) ; } if ( event instanceof HasExecutionScope ) { ( ( HasExecutionScope ) event ) . setExecutionScope ( scope ) ; } eventBus . post ( event ) ; } } } ) ; }
Posts an failure event if the given {@link RunnableEx} throws an Exception.
Posts an failure event if the given {