Author: nickarls
Date: 2008-11-24 02:36:20 -0500 (Mon, 24 Nov 2008)
New Revision: 354
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalTransactionListener.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/EjbSynchronizations.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalEjbSynchronizations.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/SynchronizationRegistry.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/Synchronizations.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java
Log:
removed extra synchronization stuff. Needs further consultation.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-24
07:35:15 UTC (rev 353)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -44,6 +44,7 @@
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.bean.AbstractBean;
+import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.contexts.ApplicationContext;
@@ -57,6 +58,7 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.transaction.TransactionListener;
import org.jboss.webbeans.util.Reflections;
/**
@@ -101,6 +103,8 @@
protected void initStandardBeans()
{
addBean(new
SimpleBean<DefaultEnterpriseBeanLookup>(DefaultEnterpriseBeanLookup.class, this));
+// TODO: Fix tests that rely that there are a specific number of beans
registered/present/matched etc.
+// addBean(new EnterpriseBean<TransactionListener>(TransactionListener.class,
this));
}
/**
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/EjbSynchronizations.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/EjbSynchronizations.java 2008-11-24
07:35:15 UTC (rev 353)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/EjbSynchronizations.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -1,89 +0,0 @@
-package org.jboss.webbeans.transaction;
-
-import java.rmi.RemoteException;
-import java.util.LinkedList;
-
-import javax.ejb.EJBException;
-import javax.ejb.Remove;
-import javax.ejb.SessionSynchronization;
-import javax.ejb.Stateful;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.transaction.Synchronization;
-import javax.webbeans.RequestScoped;
-
-@Stateful
-@RequestScoped
-(a)TransactionAttribute(TransactionAttributeType.SUPPORTS)
-public class EjbSynchronizations implements LocalEjbSynchronizations,
SessionSynchronization
-{
- protected LinkedList<SynchronizationRegistry> synchronizations = new
LinkedList<SynchronizationRegistry>();
- protected LinkedList<SynchronizationRegistry> committing = new
LinkedList<SynchronizationRegistry>();
-
- public void afterBegin()
- {
- synchronizations.addLast(new SynchronizationRegistry());
- }
-
- public void beforeCompletion() throws EJBException, RemoteException
- {
- SynchronizationRegistry synchronization = synchronizations.removeLast();
- synchronization.beforeTransactionCompletion();
- committing.addLast(synchronization);
- }
-
- public void afterCompletion(boolean success) throws EJBException, RemoteException
- {
- if (committing.isEmpty())
- {
- if (success)
- {
- throw new IllegalStateException("beforeCompletion was never
called");
- }
- else
- {
- synchronizations.removeLast().afterTransactionCompletion(false);
- }
- }
- else
- {
- committing.removeFirst().afterTransactionCompletion(success);
- }
- }
-
- public boolean isAwareOfContainerTransactions()
- {
- return true;
- }
-
- public void afterTransactionBegin()
- {
- // noop, let JTA notify us
- }
-
- public void afterTransactionCommit(boolean success)
- {
- // noop, let JTA notify us
- }
-
- public void afterTransactionRollback()
- {
- // noop, let JTA notify us
- }
-
- public void beforeTransactionCommit()
- {
- // noop, let JTA notify us
- }
-
- public void registerSynchronization(Synchronization synchronization)
- {
- synchronizations.getLast().registerSynchronization(synchronization);
- }
-
- @Remove
- public void destroy()
- {
- }
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalEjbSynchronizations.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalEjbSynchronizations.java 2008-11-24
07:35:15 UTC (rev 353)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalEjbSynchronizations.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -1,9 +0,0 @@
-package org.jboss.webbeans.transaction;
-
-import javax.ejb.Local;
-
-@Local
-public interface LocalEjbSynchronizations extends Synchronizations
-{
- public void destroy();
-}
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalTransactionListener.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalTransactionListener.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/LocalTransactionListener.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.transaction;
+
+import javax.ejb.Local;
+
+@Local
+public interface LocalTransactionListener
+{
+ public void destroy();
+}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/SynchronizationRegistry.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/SynchronizationRegistry.java 2008-11-24
07:35:15 UTC (rev 353)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/SynchronizationRegistry.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -1,49 +0,0 @@
-package org.jboss.webbeans.transaction;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-
-class SynchronizationRegistry
-{
- private List<Synchronization> synchronizations = new
ArrayList<Synchronization>();
-
- void registerSynchronization(Synchronization sync)
- {
- synchronizations.add(sync);
- }
-
- void afterTransactionCompletion(boolean success)
- {
- for (Synchronization synchronization : synchronizations)
- {
- try
- {
- synchronization.afterCompletion(success ? Status.STATUS_COMMITTED :
Status.STATUS_ROLLEDBACK);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- synchronizations.clear();
- }
-
- void beforeTransactionCompletion()
- {
- for (Synchronization synchronization : synchronizations)
- {
- try
- {
- synchronization.beforeCompletion();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/Synchronizations.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/Synchronizations.java 2008-11-24
07:35:15 UTC (rev 353)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/Synchronizations.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -1,13 +0,0 @@
-package org.jboss.webbeans.transaction;
-
-import javax.transaction.Synchronization;
-
-public interface Synchronizations
-{
- public void afterTransactionBegin();
- public void afterTransactionCommit(boolean success);
- public void afterTransactionRollback();
- public void beforeTransactionCommit();
- public void registerSynchronization(Synchronization sync);
- public boolean isAwareOfContainerTransactions();
-}
\ No newline at end of file
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java 2008-11-24
07:35:15 UTC (rev 353)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/TransactionListener.java 2008-11-24
07:36:20 UTC (rev 354)
@@ -5,6 +5,7 @@
import java.util.List;
import javax.ejb.EJBException;
+import javax.ejb.Remove;
import javax.ejb.SessionSynchronization;
import javax.ejb.Stateful;
import javax.ejb.TransactionAttribute;
@@ -16,7 +17,7 @@
@Stateful
@RequestScoped
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
-public class TransactionListener implements SessionSynchronization
+public class TransactionListener implements LocalTransactionListener,
SessionSynchronization
{
private List<Synchronization> synchronizations = new
ArrayList<Synchronization>();
@@ -46,4 +47,9 @@
{
synchronizations.add(synchronization);
}
+
+ @Remove
+ public void destroy()
+ {
+ }
}
Show replies by date