• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SubscriberExceptionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.common.eventbus.SubscriberExceptionContext的典型用法代码示例。如果您正苦于以下问题:Java SubscriberExceptionContext类的具体用法?Java SubscriberExceptionContext怎么用?Java SubscriberExceptionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SubscriberExceptionContext类属于com.google.common.eventbus包,在下文中一共展示了SubscriberExceptionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: LoadController

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
public LoadController(Loader loader)
{
    this.loader = loader;
    this.masterChannel = new EventBus(new SubscriberExceptionHandler()
    {
        @Override
        public void handleException(Throwable exception, SubscriberExceptionContext context)
        {
            FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod());
        }
    });
    this.masterChannel.register(this);

    state = LoaderState.NOINIT;
    packageOwners = ArrayListMultimap.create();

}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:LoadController.java


示例2: unhandledExceptionInEventThreadCallsSubscriberExceptionHandler

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Test
public void unhandledExceptionInEventThreadCallsSubscriberExceptionHandler() {
  SubscriberExceptionHandler handler = mock(SubscriberExceptionHandler.class);
  EventBus bus = new EventBus(handler);

  final IllegalStateException exception = new IllegalStateException("Excepted Unhandled Exception");
  bus.register(new Object() {
    @Subscribe
    public void throwUnhandledException(TriggerUnhandledException event) {
      throw exception;
    }
  });

  bus.post(new TriggerUnhandledException());

  verify(handler).handleException(eq(exception), any(SubscriberExceptionContext.class));
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:18,代码来源:UnhandledExceptionEventTest.java


示例3: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable exception, SubscriberExceptionContext context) {
    loggers.get(context.getSubscriber().getClass()).log(
        Level.SEVERE,
        "Exception dispatching " + context.getEvent().getClass().getName() +
        " to " + context.getSubscriber().getClass().getName() +
        "#" + context.getSubscriberMethod().getName(),
        exception
    );
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:11,代码来源:EventExceptionHandler.java


示例4: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable throwable, SubscriberExceptionContext subscriberExceptionContext) {
  String eventName = subscriberExceptionContext.getEvent().getClass().getSimpleName();
  Class<?> subscriber = subscriberExceptionContext.getSubscriber().getClass();

  LogManager.getLogger(subscriber).error("An error occurred on event " + eventName + " in " + subscriber.getName(), throwable);
}
 
开发者ID:Juraji,项目名称:Biliomi,代码行数:8,代码来源:EventSubscriberExceptionHandler.java


示例5: buildModList

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (final ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        EventBus bus = new EventBus(new SubscriberExceptionHandler()
        {
            @Override
            public void handleException(final Throwable exception, final SubscriberExceptionContext context)
            {
                LoadController.this.errorOccurred(mod, exception);
            }
        });

        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
        modNames.put(mod.getModId(), mod.getName());
    }

    eventChannels = eventBus.build();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:LoadController.java


示例6: MentorEventBus

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
MentorEventBus() {
	this(Executors.newWorkStealingPool(), new SubscriberExceptionHandler() {
		@Override
		public void handleException(Throwable exception, SubscriberExceptionContext context) {
			Log.error("Error in event handler ({})", context, exception);
		}
	});
}
 
开发者ID:vsite-hr,项目名称:mentor,代码行数:9,代码来源:MentorEventBus.java


示例7: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable exception, SubscriberExceptionContext context)
{
    String message = "Event: "
        + context.getEvent()
        + "\r\nSubscriber: "
        + context.getSubscriber()
        + "\r\nSubscriber method:"
        + context.getSubscriberMethod();
    ErrorHandlerProvider.handle(context.getEventBus().toString(), message, exception);
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:12,代码来源:GuavaSubscriberExceptionHandler.java


示例8: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(final Throwable e, final SubscriberExceptionContext context) {
	if ((e instanceof ClassCastException) && e.getMessage().contains(PoisonPill.class.getName())) {
		LOG.debug("Poision Pill processed on: {}", context.getSubscriber().getClass().getSimpleName());
	} else {
		String msg = String.format("Could not call %s/%s on bus %s", context.getSubscriber().getClass().getSimpleName(),
				context.getSubscriberMethod().getName(), name);
		LOG.error(msg, e);
	}
}
 
开发者ID:phenopolis,项目名称:pheno4j,代码行数:11,代码来源:ManagedEventBus.java


示例9: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(final Throwable exception, final SubscriberExceptionContext context)
{
	String errmsg = "Could not dispatch event: " + context.getSubscriber() + " to " + context.getSubscriberMethod()
			+ "\n Event: " + context.getEvent()
			+ "\n Bus: " + context.getEventBus();
	logger.error(errmsg, exception);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:9,代码来源:EventBus.java


示例10: onSubscriberException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
protected void onSubscriberException(Throwable exception, @Nullable SubscriberExceptionContext
    exceptionContext) {
  if (exception instanceof InterruptedException) {
    logger.log(Level.FINE, "EventBus Subscriber threw InterruptedException", exception);
    Thread.currentThread().interrupt();
  } else {
    logger.log(Level.SEVERE, "An event subscriber threw an exception", exception);
    eventBus.post(new UnexpectedThrowableEvent(exception, "An event subscriber threw an "
        + "exception on thread '" + Thread.currentThread().getName() + "'"));
  }
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:12,代码来源:GripCoreModule.java


示例11: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable exception, SubscriberExceptionContext context) {
	Class<?> listenerClass = context.getSubscriber().getClass();
	String method = context.getSubscriberMethod().getName();
	String event = context.getEvent().getClass().getSimpleName();

	Logger logger = LoggerFactory.getLogger(listenerClass);
	logger.error("Error dispatching event '" + event + "' to '"
			+ listenerClass.getSimpleName() + "." + method + "'", exception);
}
 
开发者ID:sfera-labs,项目名称:sfera,代码行数:11,代码来源:Bus.java


示例12: EventBusThatPublishesUnhandledExceptionEvents

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
public EventBusThatPublishesUnhandledExceptionEvents() {
  super(new SubscriberExceptionHandler() {
    @Override
    public void handleException(Throwable throwable, SubscriberExceptionContext subscriberExceptionContext) {
      postUncaughtExceptionEvent(throwable);
    }
  });

  errorMessageBus.register(this);
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:11,代码来源:EventBusThatPublishesUnhandledExceptionEvents.java


示例13: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Subscribe
public void handleException(ExceptionEvent e)
{
    if (log.isErrorEnabled())
    {
        final String format = "当前事件为: %s\n当前订阅者为: %s\n订阅方法为: %s\nEventBus为: %s\n";
        String msg = "\n";
        log.error("检测到异常 :", e.getException());

        msg += "===================================\n";
        msg += "异常详细信息:\n";

        SubscriberExceptionContext ctx = e.getContext();
        if (ctx != null)
        {
            msg += String.format(format, ctx.getEvent(), ctx.getSubscriber(), ctx.getSubscriberMethod(), ctx
                    .getEventBus());
        } else
            msg += "无上下文信息.\n";

        if (e.getExtra() != null)
        {
            msg += String.format("附加信息为: %s \n", e.getExtra());
        } else
            msg += "无附加信息.\n";

        msg += "===================================";
        log.error(msg);
    }
}
 
开发者ID:wenerme,项目名称:tellets,代码行数:31,代码来源:AuxiliaryProcess.java


示例14: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable exception, SubscriberExceptionContext context)
{
    if (context.getEvent() instanceof ExceptionEvent)
    {
        log.error("处理错误过程中发生错误 上下文:" + context, exception);
        return;
    }
    ExceptionEvent event = new ExceptionEvent(exception, context);
    bus.post(event);
}
 
开发者ID:wenerme,项目名称:tellets,代码行数:12,代码来源:Events.java


示例15: AppEventBus

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
public AppEventBus() {
  eventbus = new EventBus(new SubscriberExceptionHandler() {
    @Override
    public void handleException(Throwable exception, SubscriberExceptionContext context) {
      log.error("Could not dispatch event: " + context.getSubscriber() + " to " + context.getSubscriberMethod());
      exception.printStackTrace();
    }
  });
}
 
开发者ID:rolandkrueger,项目名称:AppBaseForVaadin,代码行数:10,代码来源:AppEventBus.java


示例16: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable exception, SubscriberExceptionContext context) {
    handleError("error in thread '" + Thread.currentThread().getName()
            + "' dispatching event to " + context.getSubscriber().getClass() + "." + context.getSubscriberMethod().getName(), exception);
}
 
开发者ID:MineboxOS,项目名称:minebox,代码行数:6,代码来源:GlobalErrorHandler.java


示例17: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable thrwbl, SubscriberExceptionContext sec) {
    com.gmt2001.Console.err.println("Failed to dispatch event " + sec.getEvent().toString() + " to " + sec.getSubscriberMethod().toString());
    com.gmt2001.Console.err.printStackTrace(thrwbl);
}
 
开发者ID:GloriousEggroll,项目名称:quorrabot,代码行数:6,代码来源:ExceptionHandler.java


示例18: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public void handleException(Throwable throwable, SubscriberExceptionContext subscriberExceptionContext) {
    throwable.printStackTrace();
}
 
开发者ID:apache,项目名称:incubator-tamaya-sandbox,代码行数:5,代码来源:EventBus.java


示例19: handleException

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
@Override
public final void handleException(final Throwable exception,
        final SubscriberExceptionContext context) {
    exception.printStackTrace();
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:6,代码来源:DashboardEventBus.java


示例20: eventExceptionHandler

import com.google.common.eventbus.SubscriberExceptionContext; //导入依赖的package包/类
private static void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
{
	log.warn("uncaught exception in event subscriber", exception);
}
 
开发者ID:runelite,项目名称:runelite,代码行数:5,代码来源:RuneLiteModule.java



注:本文中的com.google.common.eventbus.SubscriberExceptionContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EvictionListener类代码示例发布时间:2022-05-21
下一篇:
Java IShowInSource类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap