RedisSession extends StandardSession { @Override public void removeAttribute(String name) { super.removeAttribute(name); if (!saveOnChange()) { this.dirty = true; if (log.isTraceEnabled()) { log.trace("Marking session as dirty. Attr [" + name + "] was removed"); } } else { log.debug("Saved session onchange; Attr [" + name + "] was removed"); } } protected  RedisSession();  RedisSession(RedisSessionManager manager); boolean isDirty(); void clearDirty(); @Override RedisSessionManager getManager(); @Override void setId(String id); @Override void setAttribute(String key, Object value); @Override void removeAttribute(String name); @Override void setPrincipal(Principal principal); void postDeserialization(RedisSessionManager manager); static final String SAVE_IMMEDIATELY_ATTR; }
@Test public void testRemoveAttribute() { RedisSession rs = session(); rs.removeAttribute("foo"); Assert.assertTrue(rs.isDirty()); rs.clearDirty(); rs.removeAttribute("foo"); Assert.assertTrue(rs.isDirty()); rs.removeAttribute("foo"); Assert.assertTrue(rs.isDirty()); }