(@Nullable Throwable ex, boolean gracefully)
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public boolean close(@Nullable Throwable ex, boolean gracefully) { |
| 57 | if (!closedHandle.compareAndSet(this, (byte)0, (byte)1)) // 阻止递归关闭 |
| 58 | return false; |
| 59 | |
| 60 | if (ex != null) { |
| 61 | if (ex instanceof IOException) |
| 62 | logger.info("close: {} {}", this, ex); |
| 63 | else |
| 64 | logger.warn("close: {} exception:", this, ex); |
| 65 | } else |
| 66 | logger.info("close: {}{}", this, gracefully ? " gracefully" : ""); |
| 67 | |
| 68 | try { |
| 69 | getService().OnSocketClose(this, ex); |
| 70 | } catch (Exception e) { |
| 71 | logger.error("Service.OnSocketClose exception:", e); |
| 72 | } |
| 73 | if (null == ex) |
| 74 | x.closeConnectionOnFlush(null); // 总是gracefully |
| 75 | else |
| 76 | x.closeConnectionNow(); |
| 77 | |
| 78 | if (timeThrottle != null) |
| 79 | timeThrottle.close(); |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | void processInput(ByteBuf buf) throws Exception { |
| 84 | int n = buf.readableBytes(); |
nothing calls this directly
no test coverage detected