Serializing CAS 2 Ticket Caches
If you want more than one CAS server for failover purposes, see Clustering the CAS server.
To modify CAS 2 to serialize ticket caches and restore them on initialization, the basic strategy is this:
- Modify CacheInit (a ServletContextListener) to persist the caches on shutdown, and attempt to restore them on initialization
- Storing serialized data into files
- web.xml has a new parameter for directory location
- Make Ticket as Serializable
- Make the caches Serializable
- Use custom serialization since their implementations use a WeakHashMap which is not serializable
Attached is CAS:a patch file of the differences in the code. Note that this implementation was previously modified so that 'tolerance' (timeout) is a long instead of an int in the caches.
The CAS:CacheInit.java file has been updated to serialize to files instead of the the Java Preferences API. Replace the patch file's CacheInit.java with the attached one.