Merge remote-tracking branch 'origin/jetty-8'

Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java
	jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java
This commit is contained in:
Jan Bartel 2013-05-16 16:06:41 +10:00
commit 67a1b2a18f
2 changed files with 11 additions and 14 deletions

View File

@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.ClassLoadingObjectInputStream;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Logger;
@ -551,8 +552,7 @@ public class HashSessionManager extends AbstractSessionManager
}
finally
{
if (in != null)
try {in.close();} catch (Exception x) {__log.ignore(x);}
if (in != null) IO.close(in);
if (error != null)
{

View File

@ -150,18 +150,14 @@ public class HashedSession extends AbstractSession
file.createNewFile();
fos = new FileOutputStream(file);
save(fos);
IO.close(fos);
}
catch (Exception e)
{
saveFailed();
if (fos != null)
{
// Must not leave the file open if the saving failed
IO.close(fos);
// No point keeping the file if we didn't save the whole session
file.delete();
throw e;
}
saveFailed(); // We won't try again for this session
if (fos != null) IO.close(fos);
if (file != null) file.delete(); // No point keeping the file if we didn't save the whole session
throw e;
}
}
}
@ -219,17 +215,18 @@ public class HashedSession extends AbstractSession
fis = new FileInputStream(file);
_idled = false;
_hashSessionManager.restoreSession(fis, this);
IO.close(fis);
didActivate();
// If we are doing period saves, then there is no point deleting at this point
// If we are doing period saves, then there is no point deleting at this point
if (_hashSessionManager._savePeriodMs == 0)
file.delete();
}
catch (Exception e)
{
LOG.warn("Problem de-idling session " + super.getId(), e);
IO.close(fis);
if (fis != null) IO.close(fis);//Must ensure closed before invalidate
invalidate();
}
}