MCPcopy Create free account
hub / github.com/e2wugui/zeze / realClose

Method realClose

ZezeJava/ZezeJava/src/main/java/Zeze/Net/TcpSocket.java:694–714  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

692 }
693
694 private void realClose() {
695 if ((byte)closedHandle.getAndSet(this, (byte)REAL_CLOSED) == REAL_CLOSED) // 阻止递归关闭
696 return;
697 try {
698 selectionKey.channel().close();
699 } catch (Exception e) {
700 logger.error("SocketChannel.close exception:", e);
701 }
702 selector.addTask(() -> { // 进selector线程调用
703 if (outputBuffer != null)
704 outputBuffer.close();
705 try {
706 getService().OnSocketDisposed(this);
707 } catch (Exception e) {
708 logger.error("service.OnSocketDisposed exception:", e);
709 }
710 });
711 selector.wakeup();
712 if (timeThrottle != null)
713 timeThrottle.close();
714 }
715
716 @Override
717 public boolean close(@Nullable Throwable ex, boolean gracefully) {

Callers 2

doWriteMethod · 0.95
closeMethod · 0.95

Calls 6

channelMethod · 0.80
addTaskMethod · 0.80
closeMethod · 0.65
OnSocketDisposedMethod · 0.45
getServiceMethod · 0.45
wakeupMethod · 0.45

Tested by

no test coverage detected