-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gregory,
On 2/16/12 10:34 AM, Gregory Werner wrote:
> I didn't know that either. It is simply a case of looking for the
> wrong keywords. I said application score replication they said
> context attribute replication. I gotta learn how to speak their
> language.
>
> Even after I put <Context
> className="*org.apache.catalina.ha.context.ReplicatedContext*"> in
> my context.xml
>
> and make sure that my application's web.xml has *<distributable
> />* * * the following:
>
> 1. Map<String, Date> userCache = (Map<String, Date>)
> context.getAttribute("userCache"); 2.
> userCache.remove(remoteUserName);
>
> returns a null userCache object (context is set in the
> ServletContextAware method, setServletContext).
Is this all on the same server, or are you setting the attribute in
one context and watching for it's value to be available in a different
(replicated) one?
Just trying to understand the test case, here.
> When I enumerate through all the context attributes, I cannot see
> the stuff I am putting in it, just like the default entries which
> wind up there. Too weird.
Remember that it's not magic replication: Tomcat doesn't know when you
modify the object itself. I suspect that if you modify the object
itself (say, by adding elements to the cache) you'll have to do this:
context.setAttribute("userCache", userCache);
...in order to trigger a re-replication across the cluster.
You might want to consider using something like memcached or even a
traditional database to share this kind of information: IMO they are
much better equipped to do the kinds of things you want to do (and
they are separated from the servlet API, which can either be a good
thing or a bad thing for you).
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk89JAwACgkQ9CaO5/Lv0PA4RQCfR7uhnaYwJyE6eHrINKmWS0EJ
mbAAnA+7E3GV2CHgpvSnikQkfypDcCIc
=+iC3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]