if (isCloseSession(invocation)) { closeSession(); } else { disconnectSession(); } resetThreadSession();
try { if (isCloseSession(invocation)) { closeSession(); } else { disconnectSession(); } } catch (Exception e) {  debug("Error while closing/disconnecting session.");  } finally { resetThreadSession();
    private Object doStateful(MethodInvocation invocation) throws Throwable    {        Object result = null;        try        {            newOrRestoredSession(invocation);            result = invocation.proceed();            return result;        }        finally        {            if (isCloseSession(invocation))            {                closeSession();            }            else            {                disconnectSession();            }            resetThreadSession();            // Everything successfully turned off. Decrement.            if (sessions.containsKey(invocation.getThis()))            {                sessions.get(invocation.getThis()).calls--;            }        }    }