简体   繁体   English

为什么我们从Java 1.6中的FileChannel.map获取ClosedByInterruptException?

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

A customer of ours complains that, sporadically, calls of ours to FileChannel.map fail with a ClosedByInterruptException . 我们的客户抱怨,偶尔,我们对FileChannel.map调用因ClosedByInterruptException失败。 The Javadoc does not list this as a legitimate possibility. Javadoc并未将此列为合法可能性。 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)

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. 如果此线程中断,则由于IO安全问题,流/通道将关闭。

The last comment contains the answer. 最后一条评论包含答案。 There was a thread pool in use, and at shutdown interrupts were delivered. 正在使用一个线程池,并在关闭中断时交付。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM