runelite-client: add immediate event bus

This commit is contained in:
Adam
2018-07-11 18:04:09 -04:00
parent 60b0ab9ddf
commit bdeaded3ee
2 changed files with 52 additions and 0 deletions

View File

@@ -25,12 +25,14 @@
package net.runelite.client;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.ImmediateEventBus;
import com.google.common.eventbus.SubscriberExceptionContext;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.name.Names;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Named;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@@ -104,6 +106,14 @@ public class RuneLiteModule extends AbstractModule
return new EventBus(RuneLiteModule::eventExceptionHandler);
}
@Provides
@Singleton
@Named("Immediate EventBus")
EventBus provideImmediateEventBus()
{
return new ImmediateEventBus(RuneLiteModule::eventExceptionHandler);
}
private static void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
{
log.warn("uncaught exception in event subscriber", exception);