| StatelessSession and Session both implement java.io.Closeabe, but their implementation is not idempotent according to Javadoc. Javadoc: https://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html#close()
Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.
SessionImpl line 311:
if (this.isClosed()) {
throw new SessionException("Session was already closed");
The above is not compliant with java.io.Closeable contract. Request is to do nothing if session is already close or to consistently expose isClosed() method to Session and StatelessSession. Currently isClosed() is a method of SessionImplementor, to which I must cast my session. I have library code that tries to close session multiple times to ensure the developer did not forget to close the session in the outer-most object. And also calls to close() from finalizers to make 100% sure |