code: public static synchronized void serializeSessionAttributes(final HttpSession session) {
  		if (session != null) {
  			File file = new File(SERIALIZE_SESSION_NAME);
  
  			if (!file.exists() || file.canWrite()) {
  				// Retrieve the session attributes
  				List data = new ArrayList();
  
  				for (Enumeration keyEnum = session.getAttributeNames();
  						keyEnum.hasMoreElements();) {
  					String attributeName = (String) keyEnum.nextElement();
  					Object attributeValue = session.getAttribute(attributeName);
  
  					if (attributeValue instanceof Serializable) {
  						data.add(attributeName);
  						data.add(attributeValue);
  					} else {
  						LOG.error(
  								"Skipping attribute \"" + attributeName
  								+ "\" as it is not Serializable");
  					}
  				}
  
  				// Write them to the file
  				FileOutputStream fos = null;
  				ObjectOutputStream oos = null;
  
  				try {
  					fos = new FileOutputStream(file);
  					oos = new ObjectOutputStream(fos);
  
  					oos.writeObject(data);
  				} catch (Exception e) {
  					LOG.error("Failed to write serialized session to " + file, e);
  				} finally {
  					if (oos != null) {
  						StreamUtil.safeClose(oos);
  					} else {
  						StreamUtil.safeClose(fos);
  					}
  				}
  			} else {
  				LOG.warn("Unable to write serialized session to " + file);
  			}
  		}
  	}
docs: Serializes the session attributes of the given session.
  
  @param session the session to persist.