package org.jboss.weld.examples.pastecode.session;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;

import org.jboss.weld.examples.pastecode.model.CodeFragment;

@ApplicationScoped
//@Singleton
public class CodeFragmentLogger
{
   
   private final List<CodeFragment> log;

   public CodeFragmentLogger()
   {
      this.log = new ArrayList<CodeFragment>();
   }

   //@Lock(LockType.READ)
   public List<CodeFragment> getLog()
   {
      return Collections.unmodifiableList(log);
   }

   //@Lock(LockType.WRITE)
   public void clearLog()
   {
      this.log.clear();
   }

   //@Lock(LockType.WRITE)
   public void addEntry(@Observes CodeFragment codeFragment)
   {
      this.log.add(codeFragment);
   }

}

@@ -127,16 +127,94 @@
 .List;%0A%0A
+import javax.ejb.Lock;%0Aimport javax.ejb.LockType;%0Aimport javax.ejb.Singleton;%0A
 import j
@@ -256,16 +256,16 @@
 Scoped;%0A
-
 import j
@@ -378,18 +378,16 @@
 nScoped%0A
-//
 @Singlet
@@ -389,16 +389,16 @@
 ngleton%0A
+
 public c
@@ -554,34 +554,32 @@
 nt%3E();%0A   %7D%0A%0A   
-//
 @Lock(LockType.R
@@ -675,34 +675,32 @@
 (log);%0A   %7D%0A%0A   
-//
 @Lock(LockType.W
@@ -770,13 +770,11 @@
  %7D%0A%0A
+
    
-//
 @Loc

Add declarative concurrency