Refactor AbstractSession to remove _jdbcAttributes
This commit is contained in:
parent
bf1966ca94
commit
f6c1ade82f
|
@ -65,8 +65,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
||||||
private boolean _newSession;
|
private boolean _newSession;
|
||||||
private int _requests;
|
private int _requests;
|
||||||
|
|
||||||
// TODO remove this.
|
|
||||||
protected final Map<String,Object> _jdbcAttributes=_attributes;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
protected AbstractSession(AbstractSessionManager abstractSessionManager, HttpServletRequest request)
|
protected AbstractSession(AbstractSessionManager abstractSessionManager, HttpServletRequest request)
|
||||||
|
@ -255,6 +254,18 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
||||||
return (String[])_attributes.keySet().toArray(a);
|
return (String[])_attributes.keySet().toArray(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
protected Map<String,Object> getAttributeMap ()
|
||||||
|
{
|
||||||
|
return _attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
protected void addAttributes(Map<String,Object> map)
|
||||||
|
{
|
||||||
|
_attributes.putAll(map);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected boolean access(long time)
|
protected boolean access(long time)
|
||||||
|
|
|
@ -265,7 +265,8 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||||
private static final long serialVersionUID = 5208464051134226143L;
|
private static final long serialVersionUID = 5208464051134226143L;
|
||||||
private final SessionData _data;
|
private final SessionData _data;
|
||||||
private boolean _dirty=false;
|
private boolean _dirty=false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session from a request.
|
* Session from a request.
|
||||||
*
|
*
|
||||||
|
@ -274,7 +275,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||||
protected Session (HttpServletRequest request)
|
protected Session (HttpServletRequest request)
|
||||||
{
|
{
|
||||||
super(JDBCSessionManager.this,request);
|
super(JDBCSessionManager.this,request);
|
||||||
_data = new SessionData(getClusterId(),_jdbcAttributes);
|
_data = new SessionData(getClusterId(),getAttributeMap());
|
||||||
if (_dftMaxIdleSecs>0)
|
if (_dftMaxIdleSecs>0)
|
||||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||||
_data.setCanonicalContext(canonicalize(_context.getContextPath()));
|
_data.setCanonicalContext(canonicalize(_context.getContextPath()));
|
||||||
|
@ -284,18 +285,18 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session restored in database.
|
* Session restored in database.
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
protected Session (long accessed, SessionData data)
|
protected Session (long accessed, SessionData data)
|
||||||
{
|
{
|
||||||
super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId());
|
super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId());
|
||||||
_data=data;
|
_data=data;
|
||||||
if (_dftMaxIdleSecs>0)
|
if (_dftMaxIdleSecs>0)
|
||||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||||
_jdbcAttributes.putAll(_data.getAttributeMap());
|
addAttributes(_data.getAttributeMap());
|
||||||
_data.setAttributeMap(_jdbcAttributes);
|
_data.setAttributeMap(getAttributeMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAttribute (String name, Object value)
|
public void setAttribute (String name, Object value)
|
||||||
|
|
Loading…
Reference in New Issue