プログラミング言語Javaのtry-with-resources構文で用いるAutoClosableインタフェース仕様では、closeメソッドのべき等(idempotent)性は要求されない。(実装時には"べき等"が強く推奨される)
void close() throws ExceptionCloses this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.
https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html#close--
(snip)
Note that unlike theclosemethod ofCloseable, thisclosemethod is not required to be idempotent. In other words, calling thisclosemethod more than once may have some visible side effect, unlikeCloseable.closewhich is required to have no effect if called more than once. However, implementers of this interface are strongly encouraged to make theirclosemethods idempotent.
void close() throws IOExceptionCloses this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.
https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html#close--
関連URL