本文整理汇总了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());
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
}
示例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());
}
示例7: logDeadEvent
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void logDeadEvent(DeadEvent event) {
log.warn(String.format(DEAD_EVENT_MESSAGE, event.getEvent()));
}
示例8: listen
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void listen(DeadEvent event) {
notDelivered = true;
}
示例9: handleDeadEvent
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleDeadEvent(DeadEvent deadEvent) {
System.out.println("dead event: " + deadEvent.getSource().toString());
}
示例10: deadEventReceived
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
void deadEventReceived(DeadEvent deadEvent);
示例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);
}
示例12: getDeadEvents
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
public List<DeadEvent> getDeadEvents() {
return deadEvents;
}
示例13: handleDeadEvent
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
public void handleDeadEvent(DeadEvent event) {
log.warn("Unhandled Event: ", event);
}
示例14: handleUnsubscribedEvent
import com.google.common.eventbus.DeadEvent; //导入依赖的package包/类
@Subscribe
public void handleUnsubscribedEvent(DeadEvent deadEvent) {
log.warn("No subscribers for {}", deadEvent.getEvent());
}
示例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();
}