Commit 668fa3ad authored by zengtianlai3's avatar zengtianlai3

2.3.10 异常处理:泛化的抛出异常

parent f14c8f9c
...@@ -111,7 +111,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> { ...@@ -111,7 +111,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
} }
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception{
// TODO Auto-generated method stub // TODO Auto-generated method stub
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
log.debug("设备服务器,exceptionCaught:{}", ctx.channel().id().asLongText()); log.debug("设备服务器,exceptionCaught:{}", ctx.channel().id().asLongText());
......
...@@ -94,7 +94,7 @@ public class ForwardClientHandler extends SimpleChannelInboundHandler<Object> { ...@@ -94,7 +94,7 @@ public class ForwardClientHandler extends SimpleChannelInboundHandler<Object> {
} }
@Override @Override
public synchronized void userEventTriggered(ChannelHandlerContext ctx, Object obj) throws Exception { public synchronized void userEventTriggered(ChannelHandlerContext ctx, Object obj) {
log.debug("桥接客户端,userEventTriggered:{}", ctx.channel().id().asLongText()); log.debug("桥接客户端,userEventTriggered:{}", ctx.channel().id().asLongText());
} }
......
...@@ -17,7 +17,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -17,7 +17,7 @@ import lombok.extern.slf4j.Slf4j;
public class ForwardConnectionListener extends BaseConnectionListener { public class ForwardConnectionListener extends BaseConnectionListener {
@Override @Override
public void operationComplete(ChannelFuture channelFuture) throws Exception { public void operationComplete(ChannelFuture channelFuture) {
AlarmService alarmService = SpringUtil.getBean(AlarmService.class); AlarmService alarmService = SpringUtil.getBean(AlarmService.class);
if (!channelFuture.isSuccess()) { if (!channelFuture.isSuccess()) {
//TODO 失败进行告警 //TODO 失败进行告警
......
...@@ -21,14 +21,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -21,14 +21,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Override @Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
UserUtils.removeUser(); UserUtils.removeUser();
UserUtils.removeUri(); UserUtils.removeUri();
} }
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
response.setHeader("Set-Cookie","HttpOnly"); response.setHeader("Set-Cookie","HttpOnly");
return true; return true;
} }
......
...@@ -3,16 +3,18 @@ package iot.sixiang.license.net; ...@@ -3,16 +3,18 @@ package iot.sixiang.license.net;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data @Data
@Slf4j
public class BaseConnectionListener implements ChannelFutureListener { public class BaseConnectionListener implements ChannelFutureListener {
public String appId; public String appId;
public String host; public String host;
public int port; public int port;
@Override @Override
public void operationComplete(ChannelFuture future) throws Exception { public void operationComplete(ChannelFuture future) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
System.out.println("重写了operationComplete方法"); log.info("重写了operationComplete方法");
} }
} }
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