update spi
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-02-09 22:45:13 +08:00
parent 5db4dbeba5
commit 10a11e2962
17 changed files with 93 additions and 347 deletions

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
package io.github.ehlxr.did;
package io.github.ehlxr.did.generator;
/**
* twitter snowflake 算法 -- java 实现

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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);
}
}