Why are we getting ClosedByInterruptException from FileChannel.map in Java 1.6?

假如想象 提交于 2019-12-17 16:43:19

问题


A customer of ours complains that, sporadically, calls of ours to FileChannel.map fail with a ClosedByInterruptException. The Javadoc does not list this as a legitimate possibility. Does anyone know what might be going on here?

Cause0: java.nio.channels.ClosedByInterruptException
Cause0-StackTrace:
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:772)

回答1:


Channel operations are bound to the thread doing the operations. If this thread is interrupted, the stream / channel is closed due to IO safety issues.




回答2:


The last comment contains the answer. There was a thread pool in use, and at shutdown interrupts were delivered.



来源:https://stackoverflow.com/questions/1161297/why-are-we-getting-closedbyinterruptexception-from-filechannel-map-in-java-1-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!