下面列出了io.netty.channel.ChannelHandlerContext#flush ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void syncAll(ChannelHandlerContext ctx, int msgId, Profile profile, DashBoard dash, int deviceId) {
//return all widgets state
for (Widget widget : dash.widgets) {
//one exclusion, no need to sync RTC
if (widget instanceof HardwareSyncWidget && !(widget instanceof RTC) && ctx.channel().isWritable()) {
((HardwareSyncWidget) widget).sendHardSync(ctx, msgId, deviceId);
}
}
for (Map.Entry<DashPinStorageKey, PinStorageValue> entry : profile.pinsStorage.entrySet()) {
DashPinStorageKey key = entry.getKey();
if (deviceId == key.deviceId
&& dash.id == key.dashId
&& !(key instanceof DashPinPropertyStorageKey)
&& ctx.channel().isWritable()) {
for (String value : entry.getValue().values()) {
String body = key.makeHardwareBody(value);
ctx.write(makeUTF8StringMessage(HARDWARE, msgId, body), ctx.voidPromise());
}
}
}
ctx.flush();
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
// Send greeting for a new connection.
ctx.write("환영합니다2. "
+ InetAddress.getLocalHost().getHostName() + "에 접속하셨습니다!\r\n");
ctx.write("현재 시간은 " + new Date() + " 입니다2.\r\n");
ctx.flush();
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
super.write(ctx, msg, promise);
if (shouldFlush.compareAndSet(true, false)) {
ctx.flush();
}
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
ctx.fireChannelReadComplete();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void flush(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}