Author: asoldano
Date: 2013-12-05 19:43:37 -0500 (Thu, 05 Dec 2013)
New Revision: 18145
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/AbstractExtensible.java
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/WSFServlet.java
Log:
Adding few comments on thread safety analysis
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/AbstractExtensible.java
===================================================================
---
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/AbstractExtensible.java 2013-12-05
16:09:03 UTC (rev 18144)
+++
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/AbstractExtensible.java 2013-12-06
00:43:37 UTC (rev 18145)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -27,9 +27,16 @@
import java.util.Set;
/**
- * A general extendible artifact
+ * A general extendible artifact; please note the 'attachments' and
'properties' fields are not meant to be modified concurrently,
+ * as they are initialied to plain HashMap instances. Extensions of this class should
override the methods accessing those fields
+ * and add synchronized keyword.
+ * Most of the time, though, there will only be a single thread writing/deleting stuff in
this class at the same time, for example
+ * because that only happens during deployment processing (which executes in the same
thread for deployment processors / aspects
+ * and only the last aspect installs a service for each endpoint that run very limited
stuff in different threads).
+ * Visibility is ensured by the fields being final.
*
* @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
* @since 20-Apr-2007
*/
public abstract class AbstractExtensible implements Extensible
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/WSFServlet.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/WSFServlet.java 2013-12-05
16:09:03 UTC (rev 18144)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/WSFServlet.java 2013-12-06
00:43:37 UTC (rev 18145)
@@ -45,6 +45,10 @@
public static final String STACK_SERVLET_DELEGATE_CLASS =
"org.jboss.wsf.spi.deployment.stackServletDelegateClass";
public static final String INTEGRATION_CLASSLOADER =
"org.jboss.wsf.spi.deployment.integrationClassLoader";
+ //Besides for the obvious visibility consequence on the actual field, the
'volatile' keyword here also
+ //establishes a "happens-before" relationship between what happened on the
WS model during deployment
+ //and the model usage for serving requests. Everything that is only written during
deployment, can be
+ //safely read after this point without visibility issues related to different threads
serving requests.
private volatile ServletDelegate delegate = null;
@Override
Show replies by date