Author: pete.muir(a)jboss.org
Date: 2010-06-19 13:40:49 -0400 (Sat, 19 Jun 2010)
New Revision: 6556
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
Log:
Add declarative concurrency
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
===================================================================
---
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-19
17:36:41 UTC (rev 6555)
+++
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-19
17:40:49 UTC (rev 6556)
@@ -4,13 +4,16 @@
import java.util.Collections;
import java.util.List;
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import org.jboss.weld.examples.pastecode.model.CodeFragment;
@ApplicationScoped
-//@Singleton
+@Singleton
public class CodeFragmentLogger
{
@@ -21,19 +24,19 @@
this.log = new ArrayList<CodeFragment>();
}
- //(a)Lock(LockType.READ)
+ @Lock(LockType.READ)
public List<CodeFragment> getLog()
{
return Collections.unmodifiableList(log);
}
- //(a)Lock(LockType.WRITE)
+ @Lock(LockType.WRITE)
public void clearLog()
{
this.log.clear();
}
- //(a)Lock(LockType.WRITE)
+ @Lock(LockType.WRITE)
public void addEntry(@Observes CodeFragment codeFragment)
{
this.log.add(codeFragment);