]> source.dussan.org Git - vaadin-framework.git/commitdiff
Always unlock the same session instance that was locked (#12481)
authorLeif Åstrand <leif@vaadin.com>
Fri, 30 Aug 2013 11:38:48 +0000 (14:38 +0300)
committerLeif Åstrand <leif@vaadin.com>
Fri, 30 Aug 2013 11:38:48 +0000 (14:38 +0300)
Change-Id: I15ff1177d827bc8fee9f8f723f9a288b0c3aea71

server/src/com/vaadin/server/AbstractClientConnector.java
server/src/com/vaadin/server/FileDownloader.java
server/src/com/vaadin/ui/AbstractMedia.java

index 91a9e41522ed5e2975640cebd8ea50cff086ea0a..a73ca3d985b9f22700fa25eed9a96dc1f67e514e 100644 (file)
@@ -625,7 +625,8 @@ public abstract class AbstractClientConnector implements ClientConnector,
         String[] parts = path.split("/", 2);
         String key = parts[0];
 
-        getSession().lock();
+        VaadinSession session = getSession();
+        session.lock();
         try {
             ConnectorResource resource = (ConnectorResource) getResource(key);
             if (resource == null) {
@@ -633,7 +634,7 @@ public abstract class AbstractClientConnector implements ClientConnector,
             }
             stream = resource.getStream();
         } finally {
-            getSession().unlock();
+            session.unlock();
         }
         stream.writeResponse(request, response);
         return true;
index 9b49ad8edddd0186bb9c8cb9fc21ac95a2a08e15..bd7d9caafdbb5a4cf5aabc3d515ea7e27920486d 100644 (file)
@@ -129,7 +129,9 @@ public class FileDownloader extends AbstractExtension {
             // Ignore if it isn't for us
             return false;
         }
-        getSession().lock();
+        VaadinSession session = getSession();
+
+        session.lock();
         DownloadStream stream;
 
         try {
@@ -151,7 +153,7 @@ public class FileDownloader extends AbstractExtension {
                 stream.setContentType("application/octet-stream;charset=UTF-8");
             }
         } finally {
-            getSession().unlock();
+            session.unlock();
         }
         stream.writeResponse(request, response);
         return true;
index 97947b568d72ef29f718f038206bc02912ed8ae3..d7d593c29ee6028d78a398ab8e15c19b708b9567 100644 (file)
@@ -30,6 +30,7 @@ import com.vaadin.server.Resource;
 import com.vaadin.server.ResourceReference;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinResponse;
+import com.vaadin.server.VaadinSession;
 import com.vaadin.shared.communication.URLReference;
 import com.vaadin.shared.ui.AbstractMediaState;
 import com.vaadin.shared.ui.MediaControl;
@@ -90,7 +91,8 @@ public abstract class AbstractMedia extends AbstractComponent {
 
         DownloadStream stream;
 
-        getSession().lock();
+        VaadinSession session = getSession();
+        session.lock();
         try {
             List<URLReference> sources = getState().sources;
 
@@ -108,7 +110,7 @@ public abstract class AbstractMedia extends AbstractComponent {
                     .getResource(reference);
             stream = resource.getStream();
         } finally {
-            getSession().unlock();
+            session.unlock();
         }
 
         stream.writeResponse(request, response);