我正在制作一个Twitch机器人,该机器人通过聊天获取请求,并通过请求的链接通过jwebbrowser加载YouTube播放器,但是当我关闭应用程序时,我会得到插座异常(除非我删除删除用于显示jwebbrowser组件的组件)。这是堆栈:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readUnshared(Unknown Source)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:116)
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface$2.run(MessagingInterface.java:392)
我不知道要解决导致这种例外的问题是什么。谢谢。
这个例外是您的朋友。简而言之,这是关闭插座时read(...)
呼叫上阻塞的线程的机制。