Java docs of close() method of java.lang.AutoCloseable says
Note that unlike the
close()
method of Closeable, thisclose()
method is not required to be idempotent. In other words, calling this close method more than once may have some visible side effect, unlikeCloseable#close()
which is required to have no effect if called more than once. However, implementers of this interface are strongly encouraged to make their close methods idempotent.
What do they mean by idempotent method and what are the side effects of calling this close()
method twice?
And since interface Closeable
extends AutoCloseable
why are the side effects not to be seen in the close of Closeable
interface?