Netty:关闭频道时的ClosedChannelException

时间:2012-01-15 18:16:39

标签: java netty channels

为什么当我试图关闭频道时,我抛出了ChannelClosedException? 关闭Channel.close(),异常的stacktrace:

java.nio.channels.ClosedChannelException
    at org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:645)
    at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:601)
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:119)
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76)
    at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60)
    at org.jboss.netty.channel.Channels.close(Channels.java:720)
    at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:200)
    at ru.greencubes.player.PlayerWorkerThread.closeConnection(PlayerWorkerThread.java:107)
    at ru.greencubes.player.PlayerWorkerThread.shutDown(PlayerWorkerThread.java:282)
    at ru.greencubes.player.NetworkPlayerThread.disconnect(NetworkPlayerThread.java:1289)
    at ru.greencubes.player.NetworkPlayerThread.disconnect(NetworkPlayerThread.java:1272)
    at ru.greencubes.server.Server.run(Server.java:1590)
    at ru.greencubes.server.ServerThread.run(ServerThread.java:12)

1 个答案:

答案 0 :(得分:3)

我认为你应该忽略这一点。它只是告诉你,当它试图将剩余的字节写入通道时,通道已经关闭。所以无需担心。