当前位置: 首页>>代码示例>>Java>>正文


Java DeadEvent类代码示例

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


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

示例1: recordEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
/**
 * @param pathEvent
 */
/*@Subscribe
public void recordEvent(PathEvent pathEvent) {
	if (pathEvent == null)
		return;
	if (pathEvent.getPath() == null)
		return;
	//if (logger.isTraceEnabled())logger.trace(this.wsSession + " received event " + pathEvent.getPath());
	if(logger.isDebugEnabled())logger.debug(this.wsSession + " received event " + pathEvent.getPath());
	// do we care?
	for (Subscription s : manager.getSubscriptions(wsSession)) {
		if (s.isActive() && !POLICY_FIXED.equals(s.getPolicy()) && s.isSubscribed(pathEvent.getPath())) {
			if(logger.isDebugEnabled())logger.debug("Adding to send queue : "+pathEvent.getPath());
			queue.add(pathEvent.getPath());
			sender.startSender();
			break;
		}
	}

}*/
@Subscribe
public void recordEvent(DeadEvent e) {
	logger.debug("Received dead event" + e.getSource());
}
 
开发者ID:SignalK,项目名称:signalk-server-java,代码行数:27,代码来源:FullExportProcessor.java

示例2: post

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
/**
 * Posts an event to all registered handlers. This method will return
 * successfully after the event has been posted to all handlers, and
 * regardless of any exceptions thrown by handlers.
 * 
 * <p>
 * If no handlers have been subscribed for {@code event}'s class, and {@code event} is not already a {@link DeadEvent}, it will be wrapped in a DeadEvent
 * and reposted.
 * 
 * @param event
 *            event to post.
 */
public void post(Object event) {
	Set<Class<?>> dispatchTypes = flattenHierarchy(event.getClass());

	boolean dispatched = false;
	for (Class<?> eventType : dispatchTypes) {
		Set<EventHandler> wrappers = getHandlersForEventType(eventType);

		if (wrappers != null && !wrappers.isEmpty()) {
			dispatched = true;
			for (EventHandler wrapper : wrappers) {
				enqueueEvent(event, wrapper);
			}
		}
	}

	if (!dispatched && !(event instanceof DeadEvent)) {
		post(new DeadEvent(this, event));
	}

	dispatchQueuedEvents();
}
 
开发者ID:nomis,项目名称:cursus-ui,代码行数:34,代码来源:WeakEventBus.java

示例3: shouldForwardMessageToCamel

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Test
public void shouldForwardMessageToCamel() throws InterruptedException {
    // Given
    Date message = new Date();

    // When
    eventBus.post(message);

    // Then
    getMockEndpoint("mock:customListenerEvents").setExpectedMessageCount(0);
    assertMockEndpointsSatisfied();
    getMockEndpoint("mock:deadEvents").setExpectedMessageCount(1);
    assertMockEndpointsSatisfied();
    assertEquals(message, getMockEndpoint("mock:deadEvents").getExchanges().get(0).getIn().getBody(DeadEvent.class).getEvent());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:GuavaEventBusConsumingDeadEventsTest.java

示例4: onDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
@AllowConcurrentEvents
public void onDeadEvent(final DeadEvent deadEvent) {
    final Object event = deadEvent.getEvent();
    if (event instanceof IEvent) {
        final IEvent eventInterface = (IEvent) event;
        eventInterface.getEndpoint().emit("dead event", "\"" + eventInterface + "\"");
    }
    else System.out.println(deadEvent.getEvent());
}
 
开发者ID:arie-benichou,项目名称:blockplus,代码行数:11,代码来源:BlockplusServer.java

示例5: onDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Subscribe public void onDeadEvent(final DeadEvent event) {
          if (event.getEvent() instanceof ExceptionEvent) {
              final ExceptionEvent e = (ExceptionEvent) event.getEvent();
              
              ((Log) Loggers.from(e.source().getClass())).error(String
              		.format("Unhandled ExceptionEvent on %s", wrapObj(e.source())), e.exception());
          }
      }
 
开发者ID:jronrun,项目名称:benayn,代码行数:10,代码来源:Events.java

示例6: deadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void deadEvent(DeadEvent event)
{
	System.out.println("Dead Event");
	System.out.println(event.getEvent());
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:7,代码来源:Main.java

示例7: logDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void logDeadEvent(DeadEvent event) {
  log.warn(String.format(DEAD_EVENT_MESSAGE, event.getEvent()));
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:PubsubEventModule.java

示例8: listen

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void listen(DeadEvent event) {
    notDelivered = true;
}
 
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:5,代码来源:DeadEventListener.java

示例9: handleDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleDeadEvent(DeadEvent deadEvent) {
	System.out.println("dead event: " + deadEvent.getSource().toString());
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:5,代码来源:EventBusExperiments.java

示例10: deadEventReceived

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
void deadEventReceived(DeadEvent deadEvent);
 
开发者ID:HydAu,项目名称:Camel,代码行数:3,代码来源:DeadEventListener.java

示例11: handleUnsubscribedEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleUnsubscribedEvent(DeadEvent deadEvent){
    System.out.println("No subscribers for "+deadEvent.getEvent());
    deadEvents.add(deadEvent);
}
 
开发者ID:wsldl123292,项目名称:testeverything,代码行数:6,代码来源:DeadEventSubscriber.java

示例12: getDeadEvents

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
public List<DeadEvent> getDeadEvents() {
    return deadEvents;
}
 
开发者ID:wsldl123292,项目名称:testeverything,代码行数:4,代码来源:DeadEventSubscriber.java

示例13: handleDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
public void handleDeadEvent(DeadEvent event) {
    log.warn("Unhandled Event: ", event);
}
 
开发者ID:OpenSageTV,项目名称:sagetv-miniclient,代码行数:4,代码来源:DesktopBus.java

示例14: handleUnsubscribedEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleUnsubscribedEvent(DeadEvent deadEvent) {
    log.warn("No subscribers for {}", deadEvent.getEvent());
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:5,代码来源:DeadEventsSubscriber.java

示例15: handleDeadEvent

import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleDeadEvent(final DeadEvent deadEvent) {
    LOG.warn("Ooops, no listener found for this event: {}", deadEvent.getEvent());
    latch.countDown();
}
 
开发者ID:zalando-stups,项目名称:booties,代码行数:6,代码来源:LoggingDeadEventListener.java


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