Description
Hi wicket devs!
I am currently working on an own implementation of a wicket failover-safe session store.
I know about http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit but want to get around the session affinity problem and avoid using the one pass rendering strategy.
There's still some way to go before my implementation could eventually work. However I am facing the problem that a critical method in AbstractHttpSessionStore is final.
public ___final___ String getSessionId(Request request, boolean create)
I am asking you guys if this final could be removed. I don't see much danger there or harm that could be done by making this method overridable.
Currently my approach to clustering is like that:
For efficiency's sake someone should use sticky sessions.
Whenever the session changes the delta (only the important parts of the session) should be replicated to a memcache instance (other distributed storage will work as well).
When a server dies another server will be called through the load balancer and should restore the user's session from memcache.
I figured out that the best place to restore a previous session would be AbstractHttpSessionStore.getSessionId()
The basic idea is like this:
MyCustomHttpStoreThatProvidesPrettyFailoverCapabilities.java
@Override
public String getSessionId(Request request, boolean create)
{
// check if session exists
String sessionId = super.getSessionId(request, false);
// no session there, but create required ... this could be a failover scenario
if (sessionId == null && create)
{
// save client's requested session id (this should contain the id of the lost session before failover)
WebRequest webRequest = toWebRequest(request);
String requestedSessionId = webRequest.getHttpServletRequest().getRequestedSessionId();
// create new session
sessionId = super.getSessionId(request, true);
// was a previous session id requested?
if (requestedSessionId != null)
{
String oldKey = memcachePrefix + SESSION_PREFIX + requestedSessionId;
FailoverSessionInfo savedState = (FailoverSessionInfo) memcache.get(oldKey);
// check if memcache contains the previous session
if (savedState != null)
}
}
return sessionId;
}
So I would really beg you to remove [final] from AbstractHttpSessionStore.getSessionId(..) in 1.4.x and 1.5.x
Best Regards
Peter