From 51c1017b3dc60fa2a2242d73753734b9a0c2cc31 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 16 May 2013 15:39:50 +1000 Subject: [PATCH] 408077 HashSessionManager leaves file handles open after being stopped --- .../server/session/HashSessionManager.java | 55 +++++++++++-------- .../jetty/server/session/HashedSession.java | 19 +++---- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java index b6866a0dbef..4e643a15c71 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java @@ -37,6 +37,7 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Logger; @@ -520,8 +521,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) { @@ -568,30 +568,41 @@ public class HashSessionManager extends AbstractSessionManager * defaultReadObject */ DataInputStream in = new DataInputStream(is); - String clusterId = in.readUTF(); - in.readUTF(); // nodeId - long created = in.readLong(); - long accessed = in.readLong(); - int requests = in.readInt(); - - if (session == null) - session = (HashedSession)newSession(created, accessed, clusterId); - session.setRequests(requests); - int size = in.readInt(); - if (size>0) + try { - ClassLoadingObjectInputStream ois = new ClassLoadingObjectInputStream(in); - for (int i=0; i0) { - String key = ois.readUTF(); - Object value = ois.readObject(); - session.setAttribute(key,value); + ClassLoadingObjectInputStream ois = new ClassLoadingObjectInputStream(in); + try + { + for (int i=0; i