void processChannelEvent(ReactorChannelEvent reactorChannelEvent) { switch ( reactorChannelEvent.eventType() ) { case ReactorChannelEventTypes.CHANNEL_DOWN: case ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING: notifyClosedRecoverableStatusMessage(); break; default: break; } }
@Override void processChannelEvent( ReactorChannelEvent reactorChannelEvent) { switch ( reactorChannelEvent.eventType() ) { case ReactorChannelEventTypes.CHANNEL_DOWN: case ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING: if ( _itemWatchList != null ) _itemWatchList.processChannelEvent(reactorChannelEvent); break; default: break; } }
@Override void processChannelEvent(ReactorChannelEvent reactorChannelEvent) { switch ( reactorChannelEvent.eventType() ) { case ReactorChannelEventTypes.CHANNEL_DOWN: case ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING: userLock().lock(); if ( _itemWatchList != null ) _itemWatchList.processChannelEvent(reactorChannelEvent); if ( _activeConfig.removeItemsOnDisconnect ) removeItems(); _activeChannelInfo = null; userLock().unlock(); break; default: break; } }
switch(event.eventType())
private int sendChannelEventCallback(int eventType, ReactorChannel reactorChannel, ReactorErrorInfo errorInfo) { ReactorChannelEvent reactorChannelEvent = ReactorFactory.createReactorChannelEvent(); reactorChannelEvent.reactorChannel(reactorChannel); reactorChannelEvent.eventType(eventType); populateErrorInfo(reactorChannelEvent.errorInfo(), errorInfo.code(), errorInfo.location(), errorInfo.error().text()); int retval = reactorChannel.role().channelEventCallback().reactorChannelEventCallback(reactorChannelEvent); reactorChannelEvent.returnToPool(); return retval; }
@Override public int reactorChannelEventCallback(ReactorChannelEvent event) { if (event.eventType() == ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING) { /* Sleep for half a second before handling the event. */ do { try { Thread.sleep(1500); /* * Since the channel was active, the reactorChannel * should still have a selectableChannel and key. */ assertNotNull(_reactorChannel.selectableChannel()); assertNotNull(_reactorChannel.selectableChannel().keyFor(_testReactor._selector)); break; } catch (InterruptedException e) { /* * Interrupted while sleeping; ignore and sleep again. */} } while (true); } return super.reactorChannelEventCallback(event); } }
int eventType = event.eventType();
int eventType = event.eventType();
_statusMsg = new StatusMsgImpl(_baseImpl.objManager()); switch ( event.eventType() )
switch(event.eventType())
ReactorChannelEvent event = callbackHandler.lastChannelEvent(); assertNotNull(event); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN, event.eventType());
assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); assertEquals(ReactorChannelEventTypes.CHANNEL_READY, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); assertEquals(ReactorChannelEventTypes.CHANNEL_READY, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType());
assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING, channelEvent.eventType()); deviationTimeMs = Math.abs((event.nanoTime() - startTimeNano) / 1000000 - consumerInitializationTimeout * 1000); assertTrue("Initialization timeout was off by " + deviationTimeMs + "ms.", deviationTimeMs <= 2000); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType());
assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); assertEquals(pingTimeout, consumer.reactorChannel().channel().pingTimeout()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING, channelEvent.eventType()); deviationTimeMs = Math.abs((event.nanoTime() - startTimeNano) / 1000000 - pingTimeout * 1000); assertTrue("Ping timeout was off by " + deviationTimeMs + "ms.", deviationTimeMs <= 2000); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType());
ReactorChannelEvent event = callbackHandler.lastChannelEvent(); assertNotNull(event); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN, event.eventType());
assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_READY, channelEvent.eventType()); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_READY, channelEvent.eventType());
assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); ReactorChannelEvent channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_DOWN_RECONNECTING, channelEvent.eventType());