]> source.dussan.org Git - vaadin-framework.git/commitdiff
Revert "Verify that lock is held when accessing state (#9515)"
authorLeif Åstrand <leif@vaadin.com>
Mon, 10 Sep 2012 09:02:14 +0000 (12:02 +0300)
committerLeif Åstrand <leif@vaadin.com>
Mon, 10 Sep 2012 09:02:50 +0000 (12:02 +0300)
This reverts commit 998c9c97b4b7d9531028b442df4c38a33b60e5f0.

server/src/com/vaadin/server/AbstractClientConnector.java
server/src/com/vaadin/server/VaadinSession.java
server/src/com/vaadin/ui/ConnectorTracker.java
server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java

index 2fb468bd1cc8007be8be240906e5f1a519b2bedb..4c22a96782150bd110a5e6aca5e4c752777c0773 100644 (file)
@@ -146,8 +146,6 @@ public abstract class AbstractClientConnector implements ClientConnector {
     }
 
     protected SharedState getState() {
-        assert getSession() == null
-                || getSession().getLock().isHeldByCurrentThread() : VaadinSession.SESSION_LOCK_MESSAGE;
         if (null == sharedState) {
             sharedState = createState();
         }
index 03e64200080896eab85ce31e1eb3de60057c3de2..a91c011ddfce6653012cb771fa2065e70ac33a0a 100644 (file)
@@ -28,6 +28,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Logger;
 
@@ -70,8 +71,6 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      */
     public static final String UI_PARAMETER = "UI";
 
-    public static final String SESSION_LOCK_MESSAGE = "You are accessing UI state without proper synchronization!";
-
     private static final Method BOOTSTRAP_FRAGMENT_METHOD = ReflectTools
             .findMethod(BootstrapListener.class, "modifyBootstrapFragment",
                     BootstrapFragmentResponse.class);
@@ -79,7 +78,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
             .findMethod(BootstrapListener.class, "modifyBootstrapPage",
                     BootstrapPageResponse.class);
 
-    private final ReentrantLock lock = new ReentrantLock();
+    private final Lock lock = new ReentrantLock();
 
     /**
      * An event sent to {@link #start(SessionStartEvent)} when a new Application
@@ -207,10 +206,6 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
 
     private final Map<String, Object> attributes = new HashMap<String, Object>();
 
-    public VaadinSession() {
-        // TODO Auto-generated constructor stub
-    }
-
     /**
      * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)
      */
@@ -1309,7 +1304,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      * 
      * @return the lock that should be used for synchronization
      */
-    public ReentrantLock getLock() {
+    public Lock getLock() {
         return lock;
     }
 
index dbada63a4770060e77f38d80d83fcdbe2d677cb1..d454df98ee4e08b2579c2c37625fd73719fd06b9 100644 (file)
@@ -29,7 +29,6 @@ import com.vaadin.server.AbstractClientConnector;
 import com.vaadin.server.AbstractCommunicationManager;
 import com.vaadin.server.ClientConnector;
 import com.vaadin.server.GlobalResourceHandler;
-import com.vaadin.server.VaadinSession;
 
 /**
  * A class which takes care of book keeping of {@link ClientConnector}s for a
@@ -287,8 +286,6 @@ public class ConnectorTracker implements Serializable {
      *            The connector that should be marked clean.
      */
     public void markDirty(ClientConnector connector) {
-        assert uI.getSession() == null
-                || uI.getSession().getLock().isHeldByCurrentThread() : VaadinSession.SESSION_LOCK_MESSAGE;
         if (isWritingResponse()) {
             throw new IllegalStateException(
                     "A connector should not be marked as dirty while a response is being written.");
index bc5846acf002b92aa1b2303e3b878345fc498fa1..b64514ea14687c4c7464a88f2dd9a7b17a10cfd1 100644 (file)
@@ -69,7 +69,6 @@ public class ConverterFactory extends TestCase {
         final VaadinSession appWithCustomIntegerConverter = new VaadinSession();
         appWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
-        appWithCustomIntegerConverter.getLock().lock();
 
         TextField tf = new TextField("", "123") {
             @Override
@@ -98,7 +97,6 @@ public class ConverterFactory extends TestCase {
 
     public void testApplicationConverterFactoryForDifferentThanCurrentApplication() {
         final VaadinSession fieldAppWithCustomIntegerConverter = new VaadinSession();
-        fieldAppWithCustomIntegerConverter.getLock().lock();
         fieldAppWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
         VaadinSession.setCurrent(new VaadinSession());
index 031e0c80bdb7a2e809ec098be4ee3e5e09f996ed..b48ad62bccb384fd6cf09a00c65d88f2ae3241a0 100644 (file)
@@ -187,7 +187,6 @@ public class AbstractFieldValueConversions extends TestCase {
 
     public void testNumberDoubleConverterChange() {
         final VaadinSession a = new VaadinSession();
-        a.getLock().lock();
         VaadinSession.setCurrent(a);
         TextField tf = new TextField() {
             @Override
index f259e156ffa7ca6e464416f2309925fe75768841..c9f579a88724355d5679a4940bf0ff0475cc42c4 100644 (file)
@@ -19,11 +19,10 @@ public class RemoveListenersOnDetach {
 
     AbstractField field = new AbstractField() {
         final private VaadinSession application = new VaadinSession() {
-            {
-                getLock().lock();
-            }
+
         };
         private UI uI = new UI() {
+
             @Override
             protected void init(WrappedRequest request) {