List of usage examples for io.netty.channel ChannelPromise await
@Override
ChannelPromise await() throws InterruptedException;
From source file:org.tinygroup.nettyremote.impl.ClientImpl.java
License:GNU General Public License
public void write(Object o) { if (o instanceof Event) { Event event = (Event) o; LOGGER.logMessage(LogLevel.DEBUG, "?:eventId:{},serviceId:{}", event.getEventId(), event.getServiceRequest().getServiceId()); }//from w w w . j ava 2s . co m if (future == null || future.channel() == null) { throw new RuntimeException(""); } ChannelFuture f = future.channel().writeAndFlush(o); if (f instanceof ChannelPromise) { ChannelPromise p = (ChannelPromise) f; try { p.await(); } catch (InterruptedException e) { LOGGER.logMessage(LogLevel.WARN, "?"); } if (p.isSuccess()) { LOGGER.logMessage(LogLevel.DEBUG, "??{}", p.isSuccess()); } else { LOGGER.logMessage(LogLevel.WARN, "??false"); throw new RuntimeException(p.cause()); } } }