[webbeans-commits] Webbeans SVN: r1769 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: conversation and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Mar 5 02:53:42 EST 2009


Author: nickarls
Date: 2009-03-05 02:53:41 -0500 (Thu, 05 Mar 2009)
New Revision: 1769

Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
Log:
Conversation changes. Still something strange in the lifecycle with conversation switching...

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -22,7 +22,6 @@
 import javax.context.ContextNotActiveException;
 import javax.context.Contextual;
 import javax.context.CreationalContext;
-import javax.inject.manager.Bean;
 
 import org.jboss.webbeans.context.api.BeanStore;
 import org.jboss.webbeans.log.LogProvider;

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -36,8 +36,8 @@
 {
    private static LogProvider log = Logging.getLogProvider(ConversationEntry.class);
 
-   // The conversation ID
-   private String cid;
+   // The conversation
+   private ConversationImpl conversation;
    // The handle to the asynchronous timeout task
    private Future<?> terminationHandle;
    // The lock for concurrent access prevention
@@ -49,12 +49,13 @@
     * @param cid The conversation ID
     * @param terminationHandle The timeout termination handle
     */
-   protected ConversationEntry(String cid, Future<?> terminationHandle)
+   protected ConversationEntry(ConversationImpl conversation, Future<?> terminationHandle)
    {
-      this.cid = cid;
+      // conversation is a proxy so we need to make a "real" instance
+      this.conversation = new ConversationImpl(conversation);
       this.terminationHandle = terminationHandle;
       this.concurrencyLock = new ReentrantLock();
-      log.trace("Created new conversation entry for conversation " + cid);
+      log.trace("Created new conversation entry for conversation " + conversation);
    }
 
    /**
@@ -64,9 +65,9 @@
     * @param terminationHandle The timeout termination handle
     * @return A new conversation entry
     */
-   public static ConversationEntry of(String cid, Future<?> terminationHandle)
+   public static ConversationEntry of(ConversationImpl conversation, Future<?> terminationHandle)
    {
-      return new ConversationEntry(cid, terminationHandle);
+      return new ConversationEntry(conversation, terminationHandle);
    }
 
    /**
@@ -79,11 +80,11 @@
       boolean success = terminationHandle.cancel(false);
       if (success)
       {
-         log.trace("Termination of conversation " + cid + " cancelled");
+         log.trace("Termination of conversation " + conversation + " cancelled");
       }
       else
       {
-         log.warn("Failed to cancel termination of conversation " + cid);
+         log.warn("Failed to cancel termination of conversation " + conversation);
       }
       return success;
    }
@@ -95,51 +96,53 @@
     */
    public void destroy(HttpSession session)
    {
-      log.debug("Destroying conversation " + cid);
+      log.debug("Destroying conversation " + conversation);
       if (!terminationHandle.isCancelled())
       {
          cancelTermination();
       }
       ConversationContext terminationContext = new ConversationContext();
-      terminationContext.setBeanStore(new ConversationBeanStore(session, cid));
+      terminationContext.setBeanStore(new ConversationBeanStore(session, conversation.getId()));
       terminationContext.destroy();
-      log.trace("Conversation " + cid + " destroyed");
+      log.trace("Conversation " + conversation + " destroyed");
    }
 
    /**
     * Attempts to lock the conversation for exclusive usage
     * 
-    * @param timeoutInMilliseconds The time in milliseconds to wait on the lock
+    * @param timeout The time in milliseconds to wait on the lock
     * @return True if lock was successful, false otherwise
     * @throws InterruptedException If the lock operation was unsuccessful
     */
-   public boolean lock(long timeoutInMilliseconds) throws InterruptedException
+   public boolean lock(long timeout) throws InterruptedException
    {
-      boolean success = concurrencyLock.tryLock(timeoutInMilliseconds, TimeUnit.MILLISECONDS);
+      boolean success = concurrencyLock.tryLock(timeout, TimeUnit.MILLISECONDS);
       if (success)
       {
-         log.trace("Conversation " + cid + " locked");
+         log.trace("Conversation " + conversation + " locked");
       }
       else
       {
-         log.warn("Failed to lock conversation " + cid + " in " + timeoutInMilliseconds + "ms");
+         log.warn("Failed to lock conversation " + conversation + " in " + timeout + "ms");
       }
       return success;
    }
 
    /**
     * Attempts to unlock the conversation
+    * 
+    * @return true if the unlock was successful, false otherwise
     */
    public boolean unlock()
    {
       if (concurrencyLock.isHeldByCurrentThread())
       {
-         log.trace("Unlocked conversation " + cid);
          concurrencyLock.unlock();
+         log.trace("Unlocked conversation " + conversation);
       }
       else
       {
-         log.warn("Unlock attempt by non-owner on conversation " + cid);
+         log.warn("Unlock attempt by non-owner on conversation " + conversation);
       }
       return !concurrencyLock.isLocked();
    }
@@ -151,8 +154,12 @@
     */
    public void reScheduleTermination(Future<?> terminationHandle)
    {
-      log.trace("Conversation " + cid + " re-scheduled for termination");
       this.terminationHandle = terminationHandle;
+      log.trace("Conversation " + conversation + " re-scheduled for termination");
    }
 
+   public ConversationImpl getConversation()
+   {
+      return conversation;
+   }
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -47,8 +47,8 @@
    private String originalCid;
    // Is the conversation long-running?
    private boolean longRunning;
-   // The inactivity timeout in milliseconds
-   private long timeoutInMilliseconds;
+   // The timeout in milliseconds
+   private long timeout;
 
    /**
     * Creates a new conversation
@@ -58,16 +58,28 @@
    }
 
    /**
+    * Creates a new conversation from an existing one.
+    *  
+    * @param conversation The old conversation
+    */
+   public ConversationImpl(ConversationImpl conversation)
+   {
+      this.cid = conversation.getId();
+      this.longRunning = conversation.isLongRunning();
+      this.timeout = conversation.getTimeout();
+   }
+
+   /**
     * Initializes a new conversation
     * 
     * @param conversationIdGenerator The conversation ID generator
-    * @param timeoutInMilliseconds The inactivity timeout in milliseconds
     */
    @Initializer
-   public void init(ConversationIdGenerator conversationIdGenerator, @ConversationInactivityTimeout long timeoutInMilliseconds)
+   public void init(ConversationIdGenerator conversationIdGenerator, @ConversationInactivityTimeout long timeout)
    {
       this.cid = conversationIdGenerator.nextId();
-      this.timeoutInMilliseconds = timeoutInMilliseconds;
+      this.timeout = timeout;
+      this.longRunning = false;
       log.debug("Created a new conversation " + this);
    }
 
@@ -100,7 +112,7 @@
 
    public long getTimeout()
    {
-      return timeoutInMilliseconds;
+      return timeout;
    }
 
    public boolean isLongRunning()
@@ -110,30 +122,28 @@
 
    public void setTimeout(long timeout)
    {
-      log.debug("Set timeout of conversation " + cid + " to " + timeout);
-      this.timeoutInMilliseconds = timeout;
+      this.timeout = timeout;
    }
 
    /**
     * Assumes the identity of another conversation
     * 
-    * @param cid The new conversation ID
-    * @param longRunning The new long-running status
-    * @param timeout The new inactivity timeout in milliseconds
+    * @param conversation The new conversation identity
+    * 
     */
-   public void switchTo(String cid, boolean longRunning, long timeoutInMilliseconds)
+   public void switchTo(Conversation conversation)
    {
       log.debug("Switched conversation from " + this);
-      this.cid = cid;
-      this.longRunning = longRunning;
-      this.timeoutInMilliseconds = timeoutInMilliseconds;
-      log.debug("to " + this);
+      cid = conversation.getId();
+      longRunning = conversation.isLongRunning();
+      timeout = conversation.getTimeout();
+      log.debug(" to " + this);
    }
 
    @Override
    public String toString()
    {
-      return "ID: " + cid + ", long-running: " + longRunning + ", timeout: " + timeoutInMilliseconds;
+      return "ID: " + cid + ", long-running: " + longRunning + ", timeout: " + timeout;
    }
 
    public void setLongRunning(boolean longRunning)
@@ -142,6 +152,11 @@
       this.longRunning = longRunning;
    }
 
+   /**
+    * Gets the original ID of the conversation
+    * 
+    * @return The id
+    */
    public String getOriginalCid()
    {
       return originalCid;

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -16,6 +16,10 @@
  */
 package org.jboss.webbeans.conversation;
 
+import java.util.Set;
+
+import javax.context.Conversation;
+
 /**
  * A conversation manager responsible for starting, resuming and ending conversations
  * 
@@ -42,4 +46,11 @@
     */
    public abstract void destroyAllConversations();
    
+   /**
+    * Gets the currently managed long-running conversations
+    * 
+    * @return the conversations
+    */
+   public abstract Set<Conversation> getLongRunningConversations();
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -17,10 +17,14 @@
 package org.jboss.webbeans.conversation;
 
 import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Future;
 
+import javax.context.Conversation;
 import javax.context.SessionScoped;
 import javax.inject.Current;
 import javax.inject.Produces;
@@ -65,10 +69,6 @@
    @ConversationConcurrentAccessTimeout
    private long concurrentAccessTimeout;
 
-   // The conversation inactivity timeout in milliseconds
-   @ConversationInactivityTimeout
-   private long inactivityTimeout;
-
    // A map of current active long-running conversation entries
    private Map<String, ConversationEntry> longRunningConversations;
 
@@ -125,13 +125,13 @@
          log.info("Could not restore long-running conversation " + cid);
          return;
       }
+      ConversationEntry resumedConversationEntry = longRunningConversations.get(cid);
       // Try to get a lock to the requested conversation, log and return to
       // continue with a transient conversation if we fail
       try
       {
-         if (!longRunningConversations.get(cid).lock(concurrentAccessTimeout))
+         if (!resumedConversationEntry.lock(concurrentAccessTimeout))
          {
-            log.debug("Could not acquire conversation lock in " + concurrentAccessTimeout + "ms, giving up");
             return;
          }
       }
@@ -143,16 +143,16 @@
       // If we can't cancel the termination, release the lock, return and
       // continue
       // with a transient conversation
-      if (!longRunningConversations.get(cid).cancelTermination())
+      if (!resumedConversationEntry.cancelTermination())
       {
-         longRunningConversations.get(cid).unlock();
+         resumedConversationEntry.unlock();
       }
       else
       {
          // If all goes well, set the identity of the current conversation to
          // match the fetched long-running one
          String oldConversation = currentConversation.toString();
-         currentConversation.switchTo(cid, true, inactivityTimeout);
+         currentConversation.switchTo(resumedConversationEntry.getConversation());
          log.trace("Conversation switched from " + oldConversation + " to " + currentConversation);
       }
    }
@@ -161,11 +161,11 @@
    // long-running conversations
    public void cleanupConversation()
    {
+      log.trace("Cleaning up conversation for " + currentConversation);
       String cid = currentConversation.getId();
-      log.trace("Cleaning up conversations for cid " + cid);
       if (currentConversation.isLongRunning())
       {
-         Future<?> terminationHandle = scheduleForTermination(cid);
+         Future<?> terminationHandle = scheduleForTermination(cid, currentConversation.getTimeout());
          // When the conversation ends, a long-running conversation needs to
          // start its self-destruct. We can have the case where the conversation
          // is a previously known conversation (that had it's termination
@@ -179,7 +179,7 @@
          }
          else
          {
-            ConversationEntry conversationEntry = ConversationEntry.of(cid, terminationHandle);
+            ConversationEntry conversationEntry = ConversationEntry.of(currentConversation, terminationHandle);
             longRunningConversations.put(cid, conversationEntry);
          }
          log.trace("Scheduled " + currentConversation + " for termination, there are now " + longRunningConversations.size() + " long-running conversations");
@@ -192,19 +192,27 @@
          log.trace("Destroying transient conversation " + currentConversation);
          if (longRunningConversations.containsKey(cid))
          {
-            longRunningConversations.get(cid).cancelTermination();
-            longRunningConversations.get(cid).unlock();
+            ConversationEntry removedConversationEntry = longRunningConversations.remove(cid);
+            if (removedConversationEntry != null)
+            {
+               removedConversationEntry.cancelTermination();
+               removedConversationEntry.unlock();
+            }
+            else
+            {
+               log.debug("Failed to remove long-running conversation " + cid + " from list");
+            }
          }
          ConversationContext.INSTANCE.destroy();
       }
-      // If Conversation.begin(String) is called, it might be that the
-      // conversation will be switched. We need to unlock this original 
-      // conversation and re-schedule it for termination
+      // If the conversation has been switched from one long running-conversation to another with 
+      // Conversation.begin(String), we need to unlock the original conversation and re-schedule 
+      // it for termination
       String originalCid = currentConversation.getOriginalCid();
       if (originalCid != null && longRunningConversations.containsKey(originalCid))
       {
          longRunningConversations.get(originalCid).unlock();
-         longRunningConversations.get(originalCid).reScheduleTermination(scheduleForTermination(originalCid));
+         longRunningConversations.get(originalCid).reScheduleTermination(scheduleForTermination(originalCid, currentConversation.getTimeout()));
       }
    }
 
@@ -214,11 +222,11 @@
     * @param cid The id of the conversation to terminate
     * @return The asynchronous job handle
     */
-   private Future<?> scheduleForTermination(String cid)
+   private Future<?> scheduleForTermination(String cid, long timeout)
    {
       HttpSession session = CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).getSession();
       Runnable terminationTask = new TerminationTask(cid, session);
-      return conversationTerminator.scheduleForTermination(terminationTask, inactivityTimeout);
+      return conversationTerminator.scheduleForTermination(terminationTask, timeout);
    }
 
    /**
@@ -266,4 +274,14 @@
       longRunningConversations.clear();
    }
 
+   public Set<Conversation> getLongRunningConversations()
+   {
+      Set<Conversation> conversations = new HashSet<Conversation>();
+      for (ConversationEntry conversationEntry : longRunningConversations.values())
+      {
+         conversations.add(conversationEntry.getConversation());
+      }
+      return Collections.unmodifiableSet(conversations);
+   }
+
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,80 +1,78 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.introspector;
-
-import java.lang.reflect.Field;
-
-import javax.inject.manager.Manager;
-
-/**
- * AnnotatedField provides a uniform access to the annotations on an annotated
- * field 
- * 
- * @author Pete Muir
- *
- */
-public interface AnnotatedField<T> extends AnnotatedMember<T, Field>
-{
-   
-   /**
-    * Gets the annotated field
-    * 
-    * @return The annotated field
-    */
-   public Field getAnnotatedField();
-   
-   /**
-    * Injects an instance
-    * 
-    * 
-    * @param declaringInstance The instance to inject into
-    * @param value The value to inject
-    */
-   public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
-   
-   /**
-    * Injects into the field using the value provided by the manager
-    * 
-    * Unlike {@link #set(Object, Manager)} the field injected into is 
-    * discovered from the declaring instance. This is slower, but safe to use
-    * with proxies.
-    * 
-    * @param declaringInstance The instance to inject into
-    * @param value The value to inject
-    */
-   public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException;
-   
-   public T get(Object instance);
-   
-   /**
-    * Gets an abstraction of the declaring class
-    * 
-    * @return The declaring class
-    */
-   public AnnotatedType<?> getDeclaringClass();
-   
-   /**
-    * Gets the property name of the field
-    * 
-    * @return The name
-    */
-   public String getPropertyName();
-
-   public boolean isTransient();
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Field;
+
+/**
+ * AnnotatedField provides a uniform access to the annotations on an annotated
+ * field 
+ * 
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedField<T> extends AnnotatedMember<T, Field>
+{
+   
+   /**
+    * Gets the annotated field
+    * 
+    * @return The annotated field
+    */
+   public Field getAnnotatedField();
+   
+   /**
+    * Injects an instance
+    * 
+    * 
+    * @param declaringInstance The instance to inject into
+    * @param value The value to inject
+    */
+   public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
+   
+   /**
+    * Injects into the field using the value provided by the manager
+    * 
+    * Unlike {@link #set(Object, Manager)} the field injected into is 
+    * discovered from the declaring instance. This is slower, but safe to use
+    * with proxies.
+    * 
+    * @param declaringInstance The instance to inject into
+    * @param value The value to inject
+    */
+   public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException;
+   
+   public T get(Object instance);
+   
+   /**
+    * Gets an abstraction of the declaring class
+    * 
+    * @return The declaring class
+    */
+   public AnnotatedType<?> getDeclaringClass();
+   
+   /**
+    * Gets the property name of the field
+    * 
+    * @return The name
+    */
+   public String getPropertyName();
+
+   public boolean isTransient();
+
+}

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,264 +1,263 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedConstructor;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.util.Names;
-
-/**
- * Represents an annotated constructor
- * 
- * This class is immutable, and therefore threadsafe
- * 
- * @author Pete Muir
- * 
- * @param <T>
- */
-public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
-{
-   
-   
-   // The type arguments
-   private static final Type[] actualTypeArguments = new Type[0];
-   // The underlying constructor
-   private final Constructor<T> constructor;
-
-   // The list of parameter abstractions
-   private final List<AnnotatedParameter<?>> parameters;
-   // The mapping of annotation -> parameter abstraction
-   private final AnnotatedParameterMap annotatedParameters;
-
-   // The declaring class abstraction
-   private final AnnotatedType<T> declaringClass;
-
-   // Cached string representation
-   private String toString;
-   
-   public static <T> AnnotatedConstructor<T> of(Constructor<T> constructor, AnnotatedType<T> declaringClass)
-   {
-      return new AnnotatedConstructorImpl<T>(constructor, declaringClass);
-   }
-
-   /**
-    * Constructor
-    * 
-    * Initializes the superclass with the build annotations map
-    * 
-    * @param constructor The constructor method
-    * @param declaringClass The declaring class
-    */
-   public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
-   {
-      super(AnnotationStore.of(constructor), constructor);
-      this.constructor = constructor;
-      this.declaringClass = declaringClass;
-
-      this.parameters = new ArrayList<AnnotatedParameter<?>>();
-      annotatedParameters = new AnnotatedParameterMap();
-      for (int i = 0; i < constructor.getParameterTypes().length; i++)
-      {
-         if (constructor.getParameterAnnotations()[i].length > 0)
-         {
-            Class<?> clazz = constructor.getParameterTypes()[i];
-            AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, this);
-            parameters.add(parameter);
-
-            for (Annotation annotation : parameter.getAnnotationsAsSet())
-            {
-               annotatedParameters.put(annotation.annotationType(), parameter);
-            }
-         }
-         else
-         {
-            Class<?> clazz = constructor.getParameterTypes()[i];
-            AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(new Annotation[0], clazz, this);
-            parameters.add(parameter);
-
-            for (Annotation annotation : parameter.getAnnotationsAsSet())
-            {
-               annotatedParameters.put(annotation.annotationType(), parameter);
-            }
-         }
-      }
-   }
-
-   /**
-    * Gets the constructor
-    * 
-    * @return The constructor
-    */
-   public Constructor<T> getAnnotatedConstructor()
-   {
-      return constructor;
-   }
-
-   /**
-    * Gets the delegate (constructor)
-    * 
-    * @return The delegate
-    */
-   public Constructor<T> getDelegate()
-   {
-      return constructor;
-   }
-
-   /**
-    * Gets the type of the constructor
-    * 
-    * @return The type of the constructor
-    */
-   public Class<T> getType()
-   {
-      return constructor.getDeclaringClass();
-   }
-
-   /**
-    * Gets the actual type arguments
-    * 
-    * @return The type arguments
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getActualTypeArguments()
-    */
-   public Type[] getActualTypeArguments()
-   {
-      return actualTypeArguments;
-   }
-
-   /**
-    * Gets the abstracted parameters
-    * 
-    * If the parameters are null, initalize them first
-    * 
-    * @return A list of annotated parameter abstractions
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getParameters()
-    */
-   public List<AnnotatedParameter<?>> getParameters()
-   {
-      return Collections.unmodifiableList(parameters);
-   }
-
-   /**
-    * Gets parameter abstractions with a given annotation type.
-    * 
-    * If the parameters are null, they are initializes first.
-    * 
-    * @param annotationType The annotation type to match
-    * @return A list of matching parameter abstractions. An empty list is
-    *         returned if there are no matches.
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getAnnotatedParameters(Class)
-    */
-   public List<AnnotatedParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
-   {
-      return Collections.unmodifiableList(annotatedParameters.get(annotationType));
-   }
-
-   /**
-    * Creates a new instance
-    * 
-    * @param manager The Web Beans manager
-    * @return An instance
-    * @throws InvocationTargetException 
-    * @throws IllegalAccessException 
-    * @throws InstantiationException 
-    * @throws IllegalArgumentException 
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
-    */
-   public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
-   {
-      return getDelegate().newInstance(parameters);
-   }
-
-   /**
-    * The overridden equals operation
-    * 
-    * @param other The instance to compare to
-    * @return True if equal, false otherwise
-    */
-   @Override
-   public boolean equals(Object other)
-   {
-
-      if (super.equals(other) && other instanceof AnnotatedConstructor)
-      {
-         AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
-         return this.getDeclaringClass().equals(that.getDeclaringClass()) && this.getParameters().equals(that.getParameters());
-      }
-      return false;
-   }
-
-   /**
-    * The overridden hashcode
-    * 
-    * Gets the hash code from the delegate
-    * 
-    * @return The hash code
-    */
-   @Override
-   public int hashCode()
-   {
-      return getDelegate().hashCode();
-   }
-
-   /**
-    * Gets the declaring class
-    * 
-    * @return The declaring class
-    */
-   public AnnotatedType<T> getDeclaringClass()
-   {
-      return declaringClass;
-   }
-
-   /**
-    * Gets a string representation of the constructor
-    * 
-    * @return A string representation
-    */
-   @Override
-   public String toString()
-   {
-      if (toString != null)
-      {
-         return toString;
-      }
-      toString = "Annotated method " + Names.constructorToString(constructor);
-      return toString;
-   }
-   
-   public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.AnnotationStore;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * Represents an annotated constructor
+ * 
+ * This class is immutable, and therefore threadsafe
+ * 
+ * @author Pete Muir
+ * 
+ * @param <T>
+ */
+public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
+{
+   
+   
+   // The type arguments
+   private static final Type[] actualTypeArguments = new Type[0];
+   // The underlying constructor
+   private final Constructor<T> constructor;
+
+   // The list of parameter abstractions
+   private final List<AnnotatedParameter<?>> parameters;
+   // The mapping of annotation -> parameter abstraction
+   private final AnnotatedParameterMap annotatedParameters;
+
+   // The declaring class abstraction
+   private final AnnotatedType<T> declaringClass;
+
+   // Cached string representation
+   private String toString;
+   
+   public static <T> AnnotatedConstructor<T> of(Constructor<T> constructor, AnnotatedType<T> declaringClass)
+   {
+      return new AnnotatedConstructorImpl<T>(constructor, declaringClass);
+   }
+
+   /**
+    * Constructor
+    * 
+    * Initializes the superclass with the build annotations map
+    * 
+    * @param constructor The constructor method
+    * @param declaringClass The declaring class
+    */
+   public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
+   {
+      super(AnnotationStore.of(constructor), constructor);
+      this.constructor = constructor;
+      this.declaringClass = declaringClass;
+
+      this.parameters = new ArrayList<AnnotatedParameter<?>>();
+      annotatedParameters = new AnnotatedParameterMap();
+      for (int i = 0; i < constructor.getParameterTypes().length; i++)
+      {
+         if (constructor.getParameterAnnotations()[i].length > 0)
+         {
+            Class<?> clazz = constructor.getParameterTypes()[i];
+            AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, this);
+            parameters.add(parameter);
+
+            for (Annotation annotation : parameter.getAnnotationsAsSet())
+            {
+               annotatedParameters.put(annotation.annotationType(), parameter);
+            }
+         }
+         else
+         {
+            Class<?> clazz = constructor.getParameterTypes()[i];
+            AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(new Annotation[0], clazz, this);
+            parameters.add(parameter);
+
+            for (Annotation annotation : parameter.getAnnotationsAsSet())
+            {
+               annotatedParameters.put(annotation.annotationType(), parameter);
+            }
+         }
+      }
+   }
+
+   /**
+    * Gets the constructor
+    * 
+    * @return The constructor
+    */
+   public Constructor<T> getAnnotatedConstructor()
+   {
+      return constructor;
+   }
+
+   /**
+    * Gets the delegate (constructor)
+    * 
+    * @return The delegate
+    */
+   public Constructor<T> getDelegate()
+   {
+      return constructor;
+   }
+
+   /**
+    * Gets the type of the constructor
+    * 
+    * @return The type of the constructor
+    */
+   public Class<T> getType()
+   {
+      return constructor.getDeclaringClass();
+   }
+
+   /**
+    * Gets the actual type arguments
+    * 
+    * @return The type arguments
+    * 
+    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getActualTypeArguments()
+    */
+   public Type[] getActualTypeArguments()
+   {
+      return actualTypeArguments;
+   }
+
+   /**
+    * Gets the abstracted parameters
+    * 
+    * If the parameters are null, initalize them first
+    * 
+    * @return A list of annotated parameter abstractions
+    * 
+    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getParameters()
+    */
+   public List<AnnotatedParameter<?>> getParameters()
+   {
+      return Collections.unmodifiableList(parameters);
+   }
+
+   /**
+    * Gets parameter abstractions with a given annotation type.
+    * 
+    * If the parameters are null, they are initializes first.
+    * 
+    * @param annotationType The annotation type to match
+    * @return A list of matching parameter abstractions. An empty list is
+    *         returned if there are no matches.
+    * 
+    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getAnnotatedParameters(Class)
+    */
+   public List<AnnotatedParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+   {
+      return Collections.unmodifiableList(annotatedParameters.get(annotationType));
+   }
+
+   /**
+    * Creates a new instance
+    * 
+    * @param manager The Web Beans manager
+    * @return An instance
+    * @throws InvocationTargetException 
+    * @throws IllegalAccessException 
+    * @throws InstantiationException 
+    * @throws IllegalArgumentException 
+    * 
+    * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
+    */
+   public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
+   {
+      return getDelegate().newInstance(parameters);
+   }
+
+   /**
+    * The overridden equals operation
+    * 
+    * @param other The instance to compare to
+    * @return True if equal, false otherwise
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+
+      if (super.equals(other) && other instanceof AnnotatedConstructor)
+      {
+         AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
+         return this.getDeclaringClass().equals(that.getDeclaringClass()) && this.getParameters().equals(that.getParameters());
+      }
+      return false;
+   }
+
+   /**
+    * The overridden hashcode
+    * 
+    * Gets the hash code from the delegate
+    * 
+    * @return The hash code
+    */
+   @Override
+   public int hashCode()
+   {
+      return getDelegate().hashCode();
+   }
+
+   /**
+    * Gets the declaring class
+    * 
+    * @return The declaring class
+    */
+   public AnnotatedType<T> getDeclaringClass()
+   {
+      return declaringClass;
+   }
+
+   /**
+    * Gets a string representation of the constructor
+    * 
+    * @return A string representation
+    */
+   @Override
+   public String toString()
+   {
+      if (toString != null)
+      {
+         return toString;
+      }
+      toString = "Annotated method " + Names.constructorToString(constructor);
+      return toString;
+   }
+   
+   public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+}

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/PhaseHelper.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -16,8 +16,6 @@
  */
 package org.jboss.webbeans.jsf;
 
-import java.io.IOException;
-
 import javax.faces.component.html.HtmlInputHidden;
 import javax.faces.context.FacesContext;
 import javax.inject.AnnotationLiteral;
@@ -120,7 +118,6 @@
     * Gets the propagated conversation id from the propagation component
     * 
     * @return The conversation id (or null if not found)
-    * @throws IOException
     */
    public static String getConversationIdFromPropagationComponent()
    {

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -80,7 +80,7 @@
     * session to be injected by the Session manager
     * 
     * @param session
-    * @return
+    * @return the session bean store
     */
    protected BeanStore restoreSessionContext(HttpSession session)
    {

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java	2009-03-05 07:11:30 UTC (rev 1768)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java	2009-03-05 07:53:41 UTC (rev 1769)
@@ -1,189 +1,188 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.util;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-
-import com.google.common.collect.ForwardingMap;
-
-/**
- * Represents a thread safe map
- * 
- * @author Pete Muir
- */
-public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
-{
-
-   // The backing map with the value wrapped in a Future instance
-   private ConcurrentHashMap<K, Future<V>> map;
-
-   /**
-    * Constructor
-    */
-   public ConcurrentCache()
-   {
-      map = new ConcurrentHashMap<K, Future<V>>();
-   }
-
-   /**
-    * Gets the Future value from the map
-    *  
-    * @param key The key to look for
-    * @return The Future instance of the value
-    */
-   
-   public <T extends V> Future<T> getFuture(K key)
-   {
-      @SuppressWarnings("unchecked")
-      Future<T> future = (Future<T>) super.get(key);
-      return future;
-   }
-
-   /**
-    * Gets a value from the map. Blocks until it is available
-    *  
-    * @param key The key to look for
-    * @return The value
-    */
-   public <T extends V> T getValue(K key)
-   {
-      @SuppressWarnings("unchecked")
-      Future<T> value = (Future<T>) map.get(key);
-      if (value != null)
-      {
-         boolean interrupted = false;
-         try
-         {
-            while (true)
-            {
-               try
-               {
-                  return value.get();
-               }
-               catch (InterruptedException e)
-               {
-                  interrupted = true;
-               }
-               catch (ExecutionException e)
-               {
-                  rethrow(e);
-               }
-            }
-         }
-         finally
-         {
-            if (interrupted)
-            {
-               Thread.currentThread().interrupt();
-            }
-         }
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   /**
-    * Adds an item to the map if it's not already there
-
-    * @param key The key to place the item under
-    * @param callable The item, wrapped in a Callable instance
-    * @return The item added
-    */
-   public <E> E putIfAbsent(K key, Callable<E> callable)
-   {
-      @SuppressWarnings("unchecked")
-      Future<E> future = (Future<E>) map.get(key);
-      Future<E> value = future;
-      if (value == null)
-      {
-         FutureTask<E> task = new FutureTask<E>(callable);
-         value = task;
-         @SuppressWarnings("unchecked")
-         Future<V> t = (Future<V>) task;
-         map.put(key, t);
-         task.run();
-      }
-      boolean interrupted = false;
-      try
-      {
-         while (true)
-         {
-            try
-            {
-               return value.get();
-            }
-            catch (InterruptedException e)
-            {
-               interrupted = true;
-            }
-            catch (ExecutionException e)
-            {
-               rethrow(e);
-            }
-            ;
-         }
-      }
-      finally
-      {
-         if (interrupted)
-         {
-            Thread.currentThread().interrupt();
-         }
-      }
-   }
-
-   /**
-    * Gets the delegate map
-    * 
-    * @return The backing map
-    */
-   @Override
-   protected Map<K, Future<V>> delegate()
-   {
-      return map;
-   }
-
-   /**
-    * Examines and re-throws an exception
-    * 
-    * @param e The exception that happened during execution
-    */
-   protected void rethrow(ExecutionException e)
-   {
-      if (e.getCause() instanceof RuntimeException)
-      {
-         throw (RuntimeException) e.getCause();
-      }
-      else if (e.getCause() instanceof Error)
-      {
-         throw (Error) e.getCause();
-      }
-      else
-      {
-         throw new IllegalStateException(e.getCause());
-      }
-   }
-
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.util;
+
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
+import com.google.common.collect.ForwardingMap;
+
+/**
+ * Represents a thread safe map
+ * 
+ * @author Pete Muir
+ */
+public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
+{
+
+   // The backing map with the value wrapped in a Future instance
+   private ConcurrentHashMap<K, Future<V>> map;
+
+   /**
+    * Constructor
+    */
+   public ConcurrentCache()
+   {
+      map = new ConcurrentHashMap<K, Future<V>>();
+   }
+
+   /**
+    * Gets the Future value from the map
+    *  
+    * @param key The key to look for
+    * @return The Future instance of the value
+    */
+   
+   public <T extends V> Future<T> getFuture(K key)
+   {
+      @SuppressWarnings("unchecked")
+      Future<T> future = (Future<T>) super.get(key);
+      return future;
+   }
+
+   /**
+    * Gets a value from the map. Blocks until it is available
+    *  
+    * @param key The key to look for
+    * @return The value
+    */
+   public <T extends V> T getValue(K key)
+   {
+      @SuppressWarnings("unchecked")
+      Future<T> value = (Future<T>) map.get(key);
+      if (value != null)
+      {
+         boolean interrupted = false;
+         try
+         {
+            while (true)
+            {
+               try
+               {
+                  return value.get();
+               }
+               catch (InterruptedException e)
+               {
+                  interrupted = true;
+               }
+               catch (ExecutionException e)
+               {
+                  rethrow(e);
+               }
+            }
+         }
+         finally
+         {
+            if (interrupted)
+            {
+               Thread.currentThread().interrupt();
+            }
+         }
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   /**
+    * Adds an item to the map if it's not already there
+
+    * @param key The key to place the item under
+    * @param callable The item, wrapped in a Callable instance
+    * @return The item added
+    */
+   public <E> E putIfAbsent(K key, Callable<E> callable)
+   {
+      @SuppressWarnings("unchecked")
+      Future<E> future = (Future<E>) map.get(key);
+      Future<E> value = future;
+      if (value == null)
+      {
+         FutureTask<E> task = new FutureTask<E>(callable);
+         value = task;
+         @SuppressWarnings("unchecked")
+         Future<V> t = (Future<V>) task;
+         map.put(key, t);
+         task.run();
+      }
+      boolean interrupted = false;
+      try
+      {
+         while (true)
+         {
+            try
+            {
+               return value.get();
+            }
+            catch (InterruptedException e)
+            {
+               interrupted = true;
+            }
+            catch (ExecutionException e)
+            {
+               rethrow(e);
+            }
+         }
+      }
+      finally
+      {
+         if (interrupted)
+         {
+            Thread.currentThread().interrupt();
+         }
+      }
+   }
+
+   /**
+    * Gets the delegate map
+    * 
+    * @return The backing map
+    */
+   @Override
+   protected Map<K, Future<V>> delegate()
+   {
+      return map;
+   }
+
+   /**
+    * Examines and re-throws an exception
+    * 
+    * @param e The exception that happened during execution
+    */
+   protected void rethrow(ExecutionException e)
+   {
+      if (e.getCause() instanceof RuntimeException)
+      {
+         throw (RuntimeException) e.getCause();
+      }
+      else if (e.getCause() instanceof Error)
+      {
+         throw (Error) e.getCause();
+      }
+      else
+      {
+         throw new IllegalStateException(e.getCause());
+      }
+   }
+
 }
\ No newline at end of file




More information about the weld-commits mailing list