393494 HashSessionManager can't delete unrestorable sessions on Windows
This commit is contained in:
parent
36ddd3f5d6
commit
fff825a997
|
@ -482,32 +482,40 @@ public class HashSessionManager extends AbstractSessionManager
|
|||
protected synchronized HashedSession restoreSession(String idInCuster)
|
||||
{
|
||||
File file = new File(_storeDir,idInCuster);
|
||||
FileInputStream in = null;
|
||||
Exception error = null;
|
||||
try
|
||||
{
|
||||
if (file.exists())
|
||||
{
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
in = new FileInputStream(file);
|
||||
HashedSession session = restoreSession(in, null);
|
||||
in.close();
|
||||
addSession(session, false);
|
||||
session.didActivate();
|
||||
file.delete();
|
||||
return session;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
if (isDeleteUnrestorableSessions())
|
||||
error = e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (in != null)
|
||||
try {in.close();} catch (Exception x) {__log.ignore(x);}
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
if (file.exists())
|
||||
if (isDeleteUnrestorableSessions() && file.exists())
|
||||
{
|
||||
file.delete();
|
||||
__log.warn("Deleting file for unrestorable session "+idInCuster, e);
|
||||
__log.warn("Deleting file for unrestorable session "+idInCuster, error);
|
||||
}
|
||||
else
|
||||
__log.warn("Problem restoring session "+idInCuster, error);
|
||||
}
|
||||
else
|
||||
__log.warn("Problem restoring session "+idInCuster, e);
|
||||
file.delete(); //delete successfully restored file
|
||||
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue