Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEclipse
try (SessionWrapper sessionWrapper = new SessionWrapper(mySessionManager)) {
	Session session = sessionWrapper.getSession();
	// your logic here
} catch (IOException e) {
    // Handle the exception
}

Please note that the getSession() should be called outside of the try-with-resources statement. This is because the SessionWrapper should be in control of closing the session. If you place the sessionWrapper.getSession() within the try-with-resources the session might be auto-closed, leading to errors.

Back to Top