/** * @see org.eclipse.jetty.server.session.AbstractSessionDataStore#doStore(java.lang.String, org.eclipse.jetty.server.session.SessionData, long) */ @Override public void doStore(String id, SessionData data, long lastSaveTime) throws Exception { File file = null; if (_storeDir != null) { delete(id); //make a fresh file using the latest session expiry String filename = getIdWithContextAndExpiry(data); String idWithContext = getIdWithContext(id); file = new File(_storeDir, filename); try(FileOutputStream fos = new FileOutputStream(file,false)) { save(fos, id, data); _sessionFileMap.put(idWithContext, filename); } catch (Exception e) { if (file != null) file.delete(); // No point keeping the file if we didn't save the whole session throw new UnwriteableSessionDataException(id, _context,e); } } }