@Ignore @Test public void testRunFinally() throws Exception { EventLogImpl eventLog = new EventLogImpl(1, 1); EventLogEvent eventLogEvent = Mockito.mock(EventLogEvent.class); final int eventCount = 100; for (int i = 0; i < eventCount; ++i) { eventLog.postEvent(eventLogEvent); } Assert.assertEquals("Number of elements in deque is incorrect.", eventCount, eventLog.eventDeque.size()); runThread(eventLog).interrupt(); int time = 0; while (eventLog.eventDeque.size() > 0) { Thread.sleep(50); time += 50; if (time > 5000) { break; } } Assert.assertEquals("There are still elements in the deque.", 0, eventLog.eventDeque.size()); }
@Override public void postEvent(EventLogEvent event) { if (event == null) { LOGGER.warn("skipping null EventLogEvent"); return; } eventDeque.offerLast(event); }
EventLogImpl implements EventLog { @Override public void postEvent(EventLogEvent event) { if (event == null) { LOGGER.warn("skipping null EventLogEvent"); return; } eventDeque.offerLast(event); } }
EventLogImpl implements EventLog { @Override public void postEvent(EventLogEvent event) { if (event == null) { LOGGER.warn("skipping null EventLogEvent"); return; } eventDeque.offerLast(event); } @Inject  EventLogImpl(@Named("eventlog.threadpoolsize.core") int threadPoolSizeCore,
                        @Named("eventlog.threadpoolsize.max") int threadPoolSizeMax); }
EventLogImpl implements EventLog { @Override public void postEvent(EventLogEvent event) { if (event == null) { LOGGER.warn("skipping null EventLogEvent"); return; } eventDeque.offerLast(event); } @Inject  EventLogImpl(@Named("eventlog.threadpoolsize.core") int threadPoolSizeCore,
                        @Named("eventlog.threadpoolsize.max") int threadPoolSizeMax); @Override void register(EventLogListener listener); @Override void register(EventLogListener listener, List<Class<? extends EventLogEvent>> events); @Override @SuppressWarnings("unchecked") void register(EventLogListener listener, String... events); @Override void postEvent(EventLogEvent event); @Override void run(); }
EventLogImpl implements EventLog { @Override public void postEvent(EventLogEvent event) { if (event == null) { LOGGER.warn("skipping null EventLogEvent"); return; } eventDeque.offerLast(event); } @Inject  EventLogImpl(@Named("eventlog.threadpoolsize.core") int threadPoolSizeCore,
                        @Named("eventlog.threadpoolsize.max") int threadPoolSizeMax); @Override void register(EventLogListener listener); @Override void register(EventLogListener listener, List<Class<? extends EventLogEvent>> events); @Override @SuppressWarnings("unchecked") void register(EventLogListener listener, String... events); @Override void postEvent(EventLogEvent event); @Override void run();  }