public int close(String uuid) { SessionContext ctx; try { ctx = cache.getSessionContext(uuid); } catch (SessionException se) { log.info("closeSession called but doesn't exist: " + uuid); return -1; // EARLY EXIT! } int refCount = ctx.count().decrement(); if (refCount < 1) { log.info("closeSession called and no more references: " + uuid); cache.removeSession(uuid); return -2; } else { log.info("closeSession called but " + refCount + " more references: " + uuid); return refCount; } }
public int detach(String uuid) { SessionContext ctx = cache.getSessionContext(uuid); return ctx.count().decrement(); }