@Test public void testIgnoresIOExceptionFromChannelWrite() throws IOException, InterruptedException { when(channel.write(any(ByteBuffer.class))).thenThrow(new IOException("buffer is full")); dispatcher.addWriteTask(new ApiCallAttemptMonitoringEvent().withApi("foo"), channel, 8192); dispatcher.addWriteTask(new ApiCallAttemptMonitoringEvent().withApi("foo"), channel, 8192); Thread.sleep(100); verify(channel, times(2)).write((any(ByteBuffer.class))); }
public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) { if (!initialized) { throw new IllegalStateException("Dispatcher is not initialized!"); } tasks.add(new WriteTask(event, channel, maxSize)); }
AsynchronousAgentDispatcher { public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) { if (!initialized) { throw new IllegalStateException("Dispatcher is not initialized!"); } tasks.add(new WriteTask(event, channel, maxSize)); } }
AsynchronousAgentDispatcher { public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) { if (!initialized) { throw new IllegalStateException("Dispatcher is not initialized!"); } tasks.add(new WriteTask(event, channel, maxSize)); } private  AsynchronousAgentDispatcher(); @SdkTestInternalApi  AsynchronousAgentDispatcher(ObjectWriter writer); }
AsynchronousAgentDispatcher { public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) { if (!initialized) { throw new IllegalStateException("Dispatcher is not initialized!"); } tasks.add(new WriteTask(event, channel, maxSize)); } private  AsynchronousAgentDispatcher(); @SdkTestInternalApi  AsynchronousAgentDispatcher(ObjectWriter writer); void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize); synchronized void init(); synchronized void release(); synchronized static AsynchronousAgentDispatcher getInstance(); }
AsynchronousAgentDispatcher { public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) { if (!initialized) { throw new IllegalStateException("Dispatcher is not initialized!"); } tasks.add(new WriteTask(event, channel, maxSize)); } private  AsynchronousAgentDispatcher(); @SdkTestInternalApi  AsynchronousAgentDispatcher(ObjectWriter writer); void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize); synchronized void init(); synchronized void release(); synchronized static AsynchronousAgentDispatcher getInstance();  }