There is no need to call getSession(false) and getSession(true) separately. You can do one single call getSession(true). Internally it will do same thing that you are doing.