Commit efed4bac by huangfusuper

还原日志

parent a866ca24
......@@ -7,13 +7,11 @@ import com.byit.param.PluginBeat;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;
/**
* Netty客户端业务处理类
* @author huangfu
*/
@Slf4j
public class NettyClientHandler extends SimpleChannelInboundHandler<PluginRpcResponsePacket> {
private PluginClientInitialization pluginClientInitialization;
private PluginConnectClient pluginConnectClient;
......@@ -34,7 +32,6 @@ public class NettyClientHandler extends SimpleChannelInboundHandler<PluginRpcRes
//判断事件是否是心跳事件
if( evt instanceof IdleStateEvent){
pluginConnectClient.send(PluginBeat.PLUGIN_RPC_REQUEST_PACKET);
log.debug("------客户端发送心跳请求-----");
}else{
super.userEventTriggered(ctx, evt);
}
......
......@@ -6,7 +6,6 @@ import com.byit.handler.PacketEncodeHandler;
import com.byit.init.PluginClientInitialization;
import com.byit.packet.request.PluginRpcRequestPacket;
import com.byit.param.PluginBeat;
import com.byit.rpc.remoting.net.params.Beat;
import com.byit.utils.IpUtil;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
......@@ -14,7 +13,6 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.TimeUnit;
......@@ -22,7 +20,6 @@ import java.util.concurrent.TimeUnit;
* netty客户端
* @author huangfu
*/
@Slf4j
public class NettyPluginConnectionClient extends PluginConnectClient {
private EventLoopGroup group;
private Channel channel;
......@@ -57,7 +54,7 @@ public class NettyPluginConnectionClient extends PluginConnectClient {
this.channel = bootstrap.connect(ip, port).sync().channel();
// valid
if (!isValidate()) {
log.debug("------关闭链接--------");
System.err.println("------关闭链接--------");
close();
}
......@@ -66,7 +63,7 @@ public class NettyPluginConnectionClient extends PluginConnectClient {
@Override
public void close() {
if(this.channel !=null && isValidate()){
log.warn("------关闭链接{}------",channel.id().asShortText());
System.err.println(String.format("------关闭链接%s------", channel.id().asShortText()));
this.channel.close();
}
......
......@@ -2,7 +2,6 @@ package com.byit.factory;
import com.byit.task.annotations.TaskHandler;
import com.byit.task.handler.interfaces.IJobHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AdvisedSupport;
import org.springframework.aop.framework.AopProxy;
......@@ -21,7 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
* spring实现
* @author huangfu
*/
@Slf4j
public class RpcSpringPluginServerFactory extends PluginServerFactory implements ApplicationContextAware, InitializingBean, DisposableBean {
private String address;
private String biz;
......@@ -70,7 +68,7 @@ public class RpcSpringPluginServerFactory extends PluginServerFactory implements
}
}
}else{
log.warn("警告!bean {} 不是【com.byit.task.handler.interfaces.IJobHandler】类型!忽略该bean!",key);
System.out.println(String.format("警告!bean %s 不是【com.byit.task.handler.interfaces.IJobHandler】类型!忽略该bean!",key));
}
});
}
......@@ -90,7 +88,7 @@ public class RpcSpringPluginServerFactory extends PluginServerFactory implements
}
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
log.warn("{}:-------该对象为cglib代理对象-------",proxy);
System.out.println(String.format("%s:-------该对象为cglib代理对象-------", proxy));
Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
h.setAccessible(true);
Object dynamicAdvisedInterceptor = h.get(proxy);
......@@ -105,7 +103,7 @@ public class RpcSpringPluginServerFactory extends PluginServerFactory implements
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
log.debug("-------{},该对象为jdk代理对象-------",proxy);
System.out.println(String.format("-------%s,该对象为jdk代理对象-------", proxy));
Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
h.setAccessible(true);
AopProxy aopProxy = (AopProxy) h.get(proxy);
......
......@@ -14,7 +14,6 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
......@@ -23,7 +22,6 @@ import java.util.concurrent.TimeUnit;
* main方法启动
* @author huangfu
*/
@Slf4j
public class MainNettyPluginServer extends PluginServer {
@Override
public void start(PluginServerFactory pluginServerFactory) {
......@@ -55,7 +53,7 @@ public class MainNettyPluginServer extends PluginServer {
ChannelFuture closeFuture = channelFuture.channel().closeFuture().sync();
closeFuture.addListener(future ->{
if (future.isSuccess()) {
log.warn("--------服务关闭---------");
System.err.println("--------服务关闭---------");
}
});
}catch (Exception e){
......@@ -80,7 +78,7 @@ public class MainNettyPluginServer extends PluginServer {
@Override
public void stop() {
log.warn("--------服务关闭---------");
System.err.println("--------服务关闭---------");
super.onStop();
}
}
......@@ -13,7 +13,6 @@ import com.byit.task.handler.interfaces.IJobHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
......@@ -22,7 +21,6 @@ import java.util.concurrent.ThreadPoolExecutor;
* netty rpc服务器的业务处理
* @author huangfu
*/
@Slf4j
public class NettyPluginServerHandler extends SimpleChannelInboundHandler<PluginRpcRequestPacket> {
public static final String TOKEN_NAME = "token";
......@@ -44,7 +42,6 @@ public class NettyPluginServerHandler extends SimpleChannelInboundHandler<Plugin
@Override
protected void channelRead0(ChannelHandlerContext ctx, PluginRpcRequestPacket msg) {
if(PluginBeat.BEAT_ID.equals(msg.getRequestId())){
log.info("------接收到客户端的心跳连接-------");
return;
}
PluginRpcResponsePacket transferPluginRpcResponse = new PluginRpcResponsePacket();
......@@ -98,7 +95,7 @@ public class NettyPluginServerHandler extends SimpleChannelInboundHandler<Plugin
post.header(HEADER_TOKEN_NAME, "Token");
post.header(HEADER_CONTENT_TYPE,"application/json");
post.body(responseStr).execute();
log.debug("-------消息回复成功-----------");
System.out.println("-------消息回复成功-----------");
}
/**
......@@ -116,7 +113,7 @@ public class NettyPluginServerHandler extends SimpleChannelInboundHandler<Plugin
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof IdleStateEvent){
ctx.channel().close();
log.debug("-------心跳超时,关闭链接-------");
System.err.println("-------心跳超时,关闭链接-------");
} else {
super.userEventTriggered(ctx, evt);
}
......
......@@ -29,21 +29,5 @@
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment