This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.github.ehlxr.did;
|
||||
|
||||
import io.github.ehlxr.did.common.Constants;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.github.ehlxr.did.server.Server;
|
||||
import io.github.ehlxr.did.server.http.HttpServer;
|
||||
import io.github.ehlxr.did.server.sdk.SdkServer;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package io.github.ehlxr.did;
|
||||
package io.github.ehlxr.did.generator;
|
||||
|
||||
/**
|
||||
* twitter 的 snowflake 算法 -- java 实现
|
@@ -1,6 +1,6 @@
|
||||
package io.github.ehlxr.did.server;
|
||||
|
||||
import io.github.ehlxr.did.SnowFlake;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.github.ehlxr.did.common.Try;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package io.github.ehlxr.did.server.http;
|
||||
|
||||
import io.github.ehlxr.did.SnowFlake;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.github.ehlxr.did.common.Constants;
|
||||
import io.github.ehlxr.did.common.Try;
|
||||
import io.github.ehlxr.did.server.BaseServer;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package io.github.ehlxr.did.server.http;
|
||||
|
||||
import io.github.ehlxr.did.SdkProto;
|
||||
import io.github.ehlxr.did.SnowFlake;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.github.ehlxr.did.common.Constants;
|
||||
import io.github.ehlxr.did.common.NettyUtil;
|
||||
import io.github.ehlxr.did.common.Result;
|
||||
@@ -66,14 +66,14 @@ public class HttpServerHandler extends SimpleChannelInboundHandler<FullHttpReque
|
||||
response.setStatus(status)
|
||||
.content().writeBytes(result.toString().getBytes());
|
||||
|
||||
logger.debug("http server handler write response {} restul {} to channel", status, result);
|
||||
logger.debug("http server handler write response {} result {} to channel", status, result);
|
||||
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
Channel channel = ctx.channel();
|
||||
logger.error("HttpServerHandler channel [{}] error and will be closed", NettyUtil.parseRemoteAddr(channel), cause);
|
||||
logger.error("channel {} will be closed, 'cause of ", NettyUtil.parseRemoteAddr(channel), cause);
|
||||
NettyUtil.closeChannel(channel);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package io.github.ehlxr.did.server.sdk;
|
||||
|
||||
import io.github.ehlxr.did.SnowFlake;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.github.ehlxr.did.adapter.MessageDecoder;
|
||||
import io.github.ehlxr.did.adapter.MessageEncoder;
|
||||
import io.github.ehlxr.did.common.Constants;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package io.github.ehlxr.did.server.sdk;
|
||||
|
||||
import io.github.ehlxr.did.SdkProto;
|
||||
import io.github.ehlxr.did.SnowFlake;
|
||||
import io.github.ehlxr.did.adapter.Message;
|
||||
import io.github.ehlxr.did.common.Constants;
|
||||
import io.github.ehlxr.did.common.NettyUtil;
|
||||
import io.github.ehlxr.did.generator.SnowFlake;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -56,7 +56,7 @@ public class SdkServerHandler extends SimpleChannelInboundHandler<Message<SdkPro
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
Channel channel = ctx.channel();
|
||||
logger.error("SdkServerHandler channel [{}] error and will be closed", NettyUtil.parseRemoteAddr(channel), cause);
|
||||
logger.error("channel {} will be closed, 'cause of ", NettyUtil.parseRemoteAddr(channel), cause);
|
||||
NettyUtil.closeChannel(channel);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user