[weld-commits] Weld SVN: r6398 - in core/trunk/impl/src/main/java/org/jboss/weld: context and 2 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Thu Jun 3 10:26:53 EDT 2010
Author: pete.muir at jboss.org
Date: 2010-06-03 10:26:51 -0400 (Thu, 03 Jun 2010)
New Revision: 6398
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
Log:
various fixes
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-06-03 14:25:11 UTC (rev 6397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-06-03 14:26:51 UTC (rev 6398)
@@ -335,14 +335,17 @@
public BeanManagerImpl getManager(BeanDeploymentArchive beanDeploymentArchive)
{
- if (beanDeployments.containsKey(beanDeploymentArchive))
+ synchronized (this)
{
- return beanDeployments.get(beanDeploymentArchive).getBeanManager();
+ if (beanDeployments.containsKey(beanDeploymentArchive))
+ {
+ return beanDeployments.get(beanDeploymentArchive).getBeanManager();
+ }
+ else
+ {
+ return null;
+ }
}
- else
- {
- return null;
- }
}
public Bootstrap startInitialization()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2010-06-03 14:25:11 UTC (rev 6397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2010-06-03 14:26:51 UTC (rev 6398)
@@ -38,6 +38,8 @@
import org.jboss.weld.serialization.spi.ContextualStore;
import org.slf4j.cal10n.LocLogger;
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+
/**
* Base for the Context implementations. Delegates calls to the abstract
* getBeanStorage and getActive to allow for different implementations (storage
@@ -75,6 +77,7 @@
*
* @see javax.enterprise.context.spi.Context#get(BaseBean, boolean)
*/
+ @SuppressWarnings(value="UL_UNRELEASED_LOCK", justification="False positive from FindBugs")
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
{
if (!isActive())
@@ -102,6 +105,7 @@
{
if (needCreationLock)
{
+
creationLock.lock();
beanInstance = getBeanStore().get(id);
if (beanInstance != null)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualImpl.java 2010-06-03 14:25:11 UTC (rev 6397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualImpl.java 2010-06-03 14:26:51 UTC (rev 6398)
@@ -24,6 +24,8 @@
import org.jboss.weld.serialization.spi.ContextualStore;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+
/**
* A serializable version of contextual that knows how to restore the
* original bean if necessary
@@ -44,7 +46,7 @@
// A directly serializable contextual
private C serialiazable;
-
+ @SuppressWarnings(value="SE_TRANSIENT_FIELD_NOT_RESTORED", justification="A cache which is lazily loaded")
// A cached, transient version of the contextual
private transient C cached;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java 2010-06-03 14:25:11 UTC (rev 6397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java 2010-06-03 14:26:51 UTC (rev 6398)
@@ -24,35 +24,35 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.PassivationCapable;
+import org.jboss.weld.context.SerializableContextualImpl;
+import org.jboss.weld.context.SerializableContextualInstanceImpl;
+import org.jboss.weld.serialization.spi.ContextualStore;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextualInstance;
+
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Maps;
-import org.jboss.weld.serialization.spi.ContextualStore;
-import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
-import org.jboss.weld.serialization.spi.helpers.SerializableContextualInstance;
-import org.jboss.weld.context.SerializableContextualImpl;
-import org.jboss.weld.context.SerializableContextualInstanceImpl;
-
/**
* Implementation of {@link org.jboss.weld.serialization.spi.ContextualStore}
- *
+ *
* @author Pete Muir
- *
+ *
*/
public class ContextualStoreImpl implements ContextualStore
{
-
+
private static final String GENERATED_ID_PREFIX = ContextualStoreImpl.class.getName();
-
+
// The map containing container-local contextuals
private final BiMap<Contextual<?>, String> contextuals;
-
+
// The map containing passivation capable contextuals
private final ConcurrentMap<String, Contextual<?>> passivationCapableContextuals;
-
+
private final AtomicInteger idGenerator;
-
+
public ContextualStoreImpl()
{
this.idGenerator = new AtomicInteger(0);
@@ -82,15 +82,16 @@
return (C) passivationCapableContextuals.get(id);
}
}
-
+
/**
- * Add a contextual (if not already present) to the store, and return
- * it's id. If the contextual is passivation capable, it's id will
- * be used, otherwise an id will be generated
+ * Add a contextual (if not already present) to the store, and return it's
+ * id. If the contextual is passivation capable, it's id will be used,
+ * otherwise an id will be generated
*
* @param contextual the contexutal to add
* @return the current id for the contextual
*/
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED", justification="Using non-standard semantics of putIfAbsent")
public String putIfAbsent(Contextual<?> contextual)
{
if (contextual instanceof PassivationCapable)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-06-03 14:25:11 UTC (rev 6397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-06-03 14:26:51 UTC (rev 6398)
@@ -26,7 +26,6 @@
import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Collections;
@@ -190,11 +189,10 @@
private void loadServiceFile(URL serviceFile)
{
- InputStream is = null;
+ BufferedReader reader = null;
try
{
- is = serviceFile.openStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ reader = new BufferedReader(new InputStreamReader(serviceFile.openStream(), "UTF-8"));
String serviceClassName = null;
while ((serviceClassName = reader.readLine()) != null)
{
@@ -212,11 +210,11 @@
}
finally
{
- if (is != null)
+ if (reader != null)
{
try
{
- is.close();
+ reader.close();
}
catch (IOException e)
{
More information about the weld-commits
mailing list