geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjbly...@apache.org
Subject svn commit: r509336 - in /geronimo/daytrader/trunk/modules: ejb/src/main/java/org/apache/geronimo/samples/daytrader/ ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/ ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/ web/src/ma...
Date Mon, 19 Feb 2007 21:15:36 GMT
Author: cjblythe
Date: Mon Feb 19 13:15:35 2007
New Revision: 509336

URL: http://svn.apache.org/viewvc?view=rev&rev=509336
Log:
DAYTRADER-29 Removed Async 1-phase mode and dependencies within TradeDirect/TradeJPA on TradeEJB

Modified:
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeJPA.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
    geronimo/daytrader/trunk/modules/web/src/main/webapp/config.jsp

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
Mon Feb 19 13:15:35 2007
@@ -42,10 +42,9 @@
 	public static int runTimeMode = JPA;
 
 	public static String[] orderProcessingModeNames =
-		{ "Synchronous", "Asynchronous_1-Phase", "Asynchronous_2-Phase" };
+		{ "Synchronous", "Asynchronous_2-Phase" };
 	public static final int SYNCH = 0;
-	public static final int ASYNCH = 1;
-	public static final int ASYNCH_2PHASE = 2;
+	public static final int ASYNCH_2PHASE = 1;
 	public static int orderProcessingMode = SYNCH;
 
 	public static String[] accessModeNames = { "Standard", "WebServices" };

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeJPA.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeJPA.java?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeJPA.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeJPA.java
Mon Feb 19 13:15:35 2007
@@ -60,9 +60,13 @@
 
     private boolean publishQuotePriceChange = true;
 
-    private void queueOrderInternal(Integer orderID, boolean twoPhase)
-            throws javax.jms.JMSException {
-        if (Log.doTrace()) Log.trace("TradeBean:queueOrderInternal", orderID);
+    /**
+     * @see org.apache.geronimo.samples.daytrader.TradeServices#queueOrder(Integer, boolean)
+     */
+
+    public void queueOrder(Integer orderID, boolean twoPhase)
+            throws Exception {
+        if (Log.doTrace()) Log.trace("TradeBean:queueOrder", orderID);
 
         Connection conn = null;
         Session sess = null;
@@ -93,41 +97,6 @@
         }
     }
 
-    /**
-     * @see org.apache.geronimo.samples.daytrader.TradeServices#queueOrder(Integer, boolean)
-     */
-
-    public void queueOrder(Integer orderID, boolean twoPhase)
-            throws Exception {
-        if (Log.doTrace()) Log.trace("TradeBean:queueOrder", orderID, twoPhase);
-        if (twoPhase)
-            queueOrderInternal(orderID, true);
-        else {
-            // invoke the queueOrderOnePhase method -- which requires a new transaction
-            // the queueOrder will run in it's own transaction thus not requiring a
-            // 2-phase commit
-            ((Trade) context.getEJBObject()).queueOrderOnePhase(orderID);
-        }
-    }
-
-
-    /**
-     * @see Trade#queueOrderOnePhase(Integer)
-     *      Queue the Order identified by orderID to be processed in a One Phase commit
-     *      <p/>
-     *      In short, this method is deployed as TXN REQUIRES NEW to avoid a
-     *      2-phase commit transaction across Entity and MDB access
-     */
-
-    public void queueOrderOnePhase(Integer orderID) {
-        try {
-            if (Log.doTrace()) Log.trace("TradeBean:queueOrderOnePhase", orderID);
-            queueOrderInternal(orderID, false);
-        } catch (Exception e) {
-            throw new EJBException(e.getMessage(), e);
-        }
-    }
-
     class quotePriceComparator implements java.util.Comparator {
         public int compare(Object quote1, Object quote2) {
             double change1 = ((QuoteDataBean) quote1).getChange();
@@ -366,12 +335,8 @@
             account.setBalance(balance.subtract(total));
 
             if (orderProcessingMode == TradeConfig.SYNCH)
-                completeOrderInternal(order.getOrderID());
-            else if (orderProcessingMode == TradeConfig.ASYNCH)
-                // Invoke the queueOrderOnePhase method w/ TXN requires new attribute
-                // to side-step a 2-phase commit across DB and JMS access
-                queueOrder(order.getOrderID(), false);
-            else //TradeConfig.ASYNC_2PHASE
+                completeOrder(order.getOrderID(), false);
+            else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
                 queueOrder(order.getOrderID(), true);
         }
         catch (Exception e) {
@@ -423,10 +388,8 @@
             account.setBalance(balance.add(total));
 
             if (orderProcessingMode == TradeConfig.SYNCH)
-                completeOrderInternal(order.getOrderID());
-            else if (orderProcessingMode == TradeConfig.ASYNCH)
-                queueOrder(order.getOrderID(), false);
-            else //TradeConfig.ASYNC_2PHASE
+                completeOrder(order.getOrderID(), false);
+            else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
                 queueOrder(order.getOrderID(), true);
 
         }
@@ -533,34 +496,11 @@
     public OrderDataBean completeOrder(Integer orderID, boolean twoPhase)
             throws Exception {
         if (Log.doTrace()) Log.trace("TradeBean:completeOrder", orderID + " twoPhase=" +
twoPhase);
-        if (twoPhase)
-            return completeOrderInternal(orderID);
-        else {
-            // invoke the completeOrderOnePhase -- which requires a new transaction
-            // the completeOrder will run in it's own transaction thus not requiring a
-            // 2-phase commit
-            return ((Trade) context.getEJBObject()).completeOrderOnePhase(orderID);
-        }
-    }
-
-    //completeOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
-    //thus the completeOrder call from the MDB should not require a 2-phase commit
-    public OrderDataBean completeOrderOnePhase(Integer orderID) {
-        try {
-            if (Log.doTrace()) Log.trace("TradeBean:completeOrderOnePhase", orderID);
-            return completeOrderInternal(orderID);
-        } catch (Exception e) {
-            throw new EJBException(e.getMessage(), e);
-        }
-    }
-
-    private OrderDataBean completeOrderInternal(Integer orderID)
-            throws Exception {
-
-         OrderDataBean order = entityManager.find(OrderDataBean.class, orderID);
+        
+        OrderDataBean order = entityManager.find(OrderDataBean.class, orderID);
 
         if (order == null) {
-            Log.error("TradeBean:completeOrderInternal  -- Unable to find Order " + orderID
+ " FBPK returned " + order);
+            Log.error("TradeBean:completeOrder -- Unable to find Order " + orderID + " FBPK
returned " + order);
             return null;
         }
 
@@ -609,7 +549,7 @@
                 *	- deposit the Order proceeds to the Account balance
                 */
             if (holding == null) {
-                Log.error("TradeBean:completeOrderInternal -- Unable to sell order " + order.getOrderID()
+ " holding already sold");
+                Log.error("TradeBean:completeOrder -- Unable to sell order " + order.getOrderID()
+ " holding already sold");
                 order.cancel();
                 return order;
             } else {
@@ -648,62 +588,13 @@
         return order;
     }
 
-
-    //These methods are used to provide the 1-phase commit runtime option for TradeDirect
-    // Basically these methods are deployed as txn requires new and invoke TradeDirect methods
-    // There is no mechanism outside of EJB to start a new transaction
-    public OrderDataBean completeOrderOnePhaseDirect(Integer orderID) {
-        try {
-            if (Log.doTrace())
-                Log.trace("TradeBean:completeOrderOnePhaseDirect -- completing order by calling
TradeDirect orderID=" + orderID);
-            return (new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).completeOrderOnePhase(orderID);
-        } catch (Exception e) {
-            throw new EJBException(e.getMessage(), e);
-        }
-    }
-
-    public void cancelOrderOnePhaseDirect(Integer orderID) {
-        try {
-            if (Log.doTrace())
-                Log.trace("TradeBean:cancelOrderOnePhaseDirect -- cancelling order by calling
TradeDirect orderID=" + orderID);
-            (new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).cancelOrderOnePhase(orderID);
-        } catch (Exception e) {
-            throw new EJBException(e.getMessage(), e);
-        }
-    }
-
-
     public void cancelOrder(Integer orderID, boolean twoPhase)
             throws Exception {
         if (Log.doTrace()) Log.trace("TradeBean:cancelOrder", orderID + " twoPhase=" + twoPhase);
-        if (twoPhase)
-            cancelOrderInternal(orderID);
-        else {
-            // invoke the cancelOrderOnePhase -- which requires a new transaction
-            // the completeOrder will run in it's own transaction thus not requiring a
-            // 2-phase commit
-            ((Trade) context.getEJBObject()).cancelOrderOnePhase(orderID);
-        }
-    }
-
-    //cancelOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
-    //thus the completeOrder call from the MDB should not require a 2-phase commit
-    public void cancelOrderOnePhase(Integer orderID) {
-        try {
-            if (Log.doTrace()) Log.trace("TradeBean:cancelOrderOnePhase", orderID);
-            cancelOrderInternal(orderID);
-        } catch (Exception e) {
-            throw new EJBException(e.getMessage(), e);
-        }
-    }
-
-
-    private void cancelOrderInternal(Integer orderID)
-            throws Exception {
+        
         OrderDataBean order = entityManager.find(OrderDataBean.class, orderID);
         order.cancel();
     }
-
 
     public void orderCompleted(String userID, Integer orderID)
             throws Exception {

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
Mon Feb 19 13:15:35 2007
@@ -25,8 +25,6 @@
 
 import javax.sql.DataSource;
 
-import org.apache.geronimo.samples.daytrader.ejb.Trade;
-import org.apache.geronimo.samples.daytrader.ejb.TradeHome;
 import org.apache.geronimo.samples.daytrader.util.*;
 
 import java.rmi.RemoteException;
@@ -38,7 +36,7 @@
 import java.sql.Statement;
 import java.sql.Timestamp;
 
-import org.apache.geronimo.samples.daytrader.*;;
+import org.apache.geronimo.samples.daytrader.*;
 
 /**
   * TradeDirect uses direct JDBC and JMS access to a <code>javax.sql.DataSource</code>
to implement the business methods 
@@ -232,9 +230,7 @@
 			try {
 				if (orderProcessingMode == TradeConfig.SYNCH) 
 					completeOrder(conn, orderData.getOrderID());
-				else if (orderProcessingMode == TradeConfig.ASYNCH)
-					queueOrder(orderData.getOrderID(), false);	// 1-phase commit
-				else //TradeConfig.ASYNC_2PHASE
+				else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
 					queueOrder(orderData.getOrderID(), true);	// 2-phase commit
 			}
 			catch (JMSException je)
@@ -336,9 +332,7 @@
 			try {
 				if (orderProcessingMode == TradeConfig.SYNCH) 
 					completeOrder(conn, orderData.getOrderID());
-				else if (orderProcessingMode == TradeConfig.ASYNCH)
-					queueOrder(orderData.getOrderID(), false);  // 1-phase commit
-				else //TradeConfig.ASYNC_2PHASE
+				else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
 					queueOrder(orderData.getOrderID(), true);      // 2-phase commit
 			}
 			catch (JMSException je)
@@ -428,13 +422,7 @@
 	{
 		OrderDataBean orderData = null;
 		Connection conn=null;
-
-		if (!twoPhase)
-		{
-			if (Log.doTrace())
-				Log.trace("TradeDirect:completeOrder -- completing order in 1-phase, calling tradeEJB
to start new txn. orderID="+orderID);
-			return tradeEJB.completeOrderOnePhaseDirect(orderID);
-		}		
+		
 		try  //twoPhase
 		{
 
@@ -459,34 +447,7 @@
 		return orderData;         	
 		
 	}
-	public OrderDataBean completeOrderOnePhase(Integer orderID) throws Exception 
-	{
-		OrderDataBean orderData = null;
-		Connection conn=null;
-		try
-		{
-			if (Log.doTrace()) Log.trace("TradeDirect:completeOrderOnePhase - inSession(" + this.inSession
+ ")", orderID);
-			setInGlobalTxn(false);
-			conn = getConn();
-			orderData = completeOrder(conn, orderID);
-
-			commit(conn);
-
-		}
-		catch (Exception e)
-		{
-			Log.error("TradeDirect:completeOrderOnePhase -- error completing order", e);
-			rollBack(conn, e);
-			cancelOrder(orderID, false);
-		}
-		finally
-		{
-			releaseConn(conn);
-		}
-				
-		return orderData;         	
-		
-	}
+	
 
 	private OrderDataBean completeOrder(Connection conn, Integer orderID) 
 			throws Exception
@@ -617,30 +578,7 @@
 			releaseConn(conn);
 		}		
 	}
-	public void cancelOrderOnePhase(Integer orderID) 
-	throws Exception 
-	{
-		OrderDataBean orderData = null;
-		Connection conn=null;
-		try
-		{
-			if (Log.doTrace()) Log.trace("TradeDirect:cancelOrderOnePhase - inSession(" + this.inSession
+ ")", orderID);
-			setInGlobalTxn(false);
-			conn = getConn();
-			cancelOrder(conn, orderID);
-			commit(conn);
-
-		}
-		catch (Exception e)
-		{
-			Log.error("TradeDirect:cancelOrderOnePhase -- error cancelling order: "+orderID, e);
-			rollBack(conn, e);
-		}
-		finally
-		{
-			releaseConn(conn);
-		}		
-	}	
+	
 	private void cancelOrder(Connection conn, Integer orderID) 
 	throws Exception 
 	{
@@ -2326,7 +2264,6 @@
 	private static boolean initialized = false;
 	public static synchronized void init()	
 	{
-		TradeHome tradeHome=null;
 		if (initialized) return;
 		if (Log.doTrace())
 			Log.trace("TradeDirect:init -- *** initializing");		
@@ -2341,18 +2278,7 @@
         {
             Log.error("TradeDirect:init -- error on JNDI lookups of DataSource -- TradeDirect
will not work", e);
             return;
-        }           
-			
-		try {
-
-             tradeHome = (TradeHome) ( javax.rmi.PortableRemoteObject.narrow(
-			context.lookup("java:comp/env/ejb/Trade"), TradeHome.class));
-        }
-        catch (Exception e)
-        {
-            Log.error("TradeDirect:init -- error on JNDI lookup of Trade Session Bean --
TradeDirect will not work", e);
-            return;
-        }           
+        }                     
         
         try
         {
@@ -2394,15 +2320,6 @@
             TradeConfig.setPublishQuotePriceChange(false);
         }       
         
-        
-		try
-		{
-			tradeEJB = (Trade) tradeHome.create();					
-		}
-		catch (Exception e)
-		{
-			Log.error("TradeDirect:init -- error looking up TradeEJB -- Asynchronous 1-phase will
not work", e);
-		}					
 		if (Log.doTrace())		
 			Log.trace("TradeDirect:init -- +++ initialized");			
 		
@@ -2427,7 +2344,7 @@
 	private static Queue queue;
 	private static ConnectionFactory tConnFactory;
 	private static Topic streamerTopic;
-	private static Trade tradeEJB;
+	
 	/**
 	 * Gets the inGlobalTxn
 	 * @return Returns a boolean

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
Mon Feb 19 13:15:35 2007
@@ -23,85 +23,6 @@
 import org.apache.geronimo.samples.daytrader.*;
 
 public interface Trade extends EJBObject, TradeServices, Remote {
-
-   /**
-	 * Queue the Order identified by orderID to be processed in a One Phase commit
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across Entity and MDB access
-	 * 
-	 * Orders are submitted through JMS to a Trading Broker
-	 * and completed asynchronously. This method queues the order for processing
-	 *
-	 * @param orderID the Order being queued for processing
-	 * @return OrderDataBean providing the status of the completed order
-	 */
-	public void queueOrderOnePhase(Integer orderID) throws RemoteException;
-   /**
-	 * Complete the Order identified by orderID in a One Phase commit
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across Entity and MDB access
-	 * 
-	 * Orders are submitted through JMS to a Trading agent
-	 * and completed asynchronously. This method completes the order
-	 * For a buy, the stock is purchased creating a holding and the users account is debited
-	 * For a sell, the stock holding is removed and the users account is credited with the proceeds
-	 *
-	 * @param orderID the Order to complete
-	 * @return OrderDataBean providing the status of the completed order
-	 */
-	public OrderDataBean completeOrderOnePhase(Integer orderID) throws RemoteException;
-	
-   /**
-	 * Complete the Order identified by orderID in a One Phase commit
-	 * using TradeDirect to complete the Order
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across DB and MDB access
-	 * The EJB method is used only to start a new transaction so the direct runtime mode
-	 * for the completeOrder will run in a 1-phase commit
-	 * 
-	 * Orders are submitted through JMS to a Trading agent
-	 * and completed asynchronously. This method completes the order using TradeDirect
-	 * For a buy, the stock is purchased creating a holding and the users account is debited
-	 * For a sell, the stock holding is removed and the users account is credited with the proceeds
-	 *
-	 * @param orderID the Order to complete
-	 * @return OrderDataBean providing the status of the completed order
-	 */	
-    public OrderDataBean completeOrderOnePhaseDirect(Integer orderID) throws RemoteException;
-
-   /**
-	 * Cancel the Order identefied by orderID
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across Entity and MDB access
-	 * 
-	 * The boolean twoPhase specifies to the server implementation whether or not the
-	 * method is to participate in a global transaction
-	 *
-	 * @param orderID the Order to complete
-	 * @return OrderDataBean providing the status of the completed order
-	 */
-	public void cancelOrderOnePhase(Integer orderID) throws RemoteException;
-
-   /**
-	 * Cancel the Order identefied by orderID
-	 * using TradeDirect to complete the Order
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across DB and MDB access
-	 * The EJB method is used only to start a new transaction so the direct runtime mode
-	 * for the cancleOrder will run in a 1-phase commit
-	 * 
-	 * The boolean twoPhase specifies to the server implementation whether or not the
-	 * method is to participate in a global transaction
-	 *
-	 * @param orderID the Order to complete
-	 * @return OrderDataBean providing the status of the completed order
-	 */
-	public void cancelOrderOnePhaseDirect(Integer orderID) throws RemoteException;
 	
    /**
 	 * Publish to the QuoteChange Message topic when a stock

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
Mon Feb 19 13:15:35 2007
@@ -50,10 +50,10 @@
 	private boolean orderBySQLSupported = true;  
 	private boolean updateQuotePrices = true;  
    
-    private void queueOrderInternal(Integer orderID, boolean twoPhase)
-    	throws javax.jms.JMSException
-    {
-		if (Log.doTrace() ) Log.trace("TradeBean:queueOrderInternal", orderID);
+	public void queueOrder(Integer orderID, boolean twoPhase) 
+	throws Exception
+	{
+		if (Log.doTrace() ) Log.trace("TradeBean:queueOrder", orderID, new Boolean(twoPhase));
 
 		Connection conn = null;
 		Session sess = null;
@@ -86,46 +86,6 @@
 		}
 	}
 	
-   /** 
-	 * @see TradeServices#queueOrder(Integer)
-	 */
-
-	public void queueOrder(Integer orderID, boolean twoPhase)
-	throws Exception
-	{
-		if (Log.doTrace() ) Log.trace("TradeBean:queueOrder", orderID, new Boolean(twoPhase));
-		if (twoPhase)
-			queueOrderInternal(orderID, true);
-		else
-		{
-			// invoke the queueOrderOnePhase method -- which requires a new transaction
-			// the queueOrder will run in it's own transaction thus not requiring a 
-			// 2-phase commit
-			((Trade)context.getEJBObject()).queueOrderOnePhase(orderID);
-		}
-	}
-	
-	
-   /** 
-	 * @see TradeServices#queueOrderOnePhase(Integer)
-	 * Queue the Order identified by orderID to be processed in a One Phase commit
-	 * 
-	 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 
-	 * 2-phase commit transaction across Entity and MDB access
-	 * 
-	 */
-
-	public void queueOrderOnePhase(Integer orderID)
-	    	throws RemoteException
-	{
-        try{
-		if (Log.doTrace() ) Log.trace("TradeBean:queueOrderOnePhase", orderID);
-		queueOrderInternal(orderID, false);
-        } catch (Exception e){
-            throw new RemoteException(e.getMessage(), e);
-        }
-	}
-	
 	class quotePriceComparator implements java.util.Comparator {
    		public int compare(Object quote1, Object quote2)
    		{
@@ -402,12 +362,8 @@
 			account.setBalance(balance.subtract(total));			
 			
 			if (orderProcessingMode == TradeConfig.SYNCH) 
-				completeOrderInternal(order.getOrderID());
-			else if (orderProcessingMode == TradeConfig.ASYNCH)
-				// Invoke the queueOrderOnePhase method w/ TXN requires new attribute
-				// to side-step a 2-phase commit across DB and JMS access
-				queueOrder(order.getOrderID(), false);
-			else //TradeConfig.ASYNC_2PHASE
+				completeOrder(order.getOrderID(), false);
+			else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
 				queueOrder(order.getOrderID(), true);
 		}
 		catch (Exception e)
@@ -464,10 +420,8 @@
 			account.setBalance(balance.add(total));
 			
 			if (orderProcessingMode == TradeConfig.SYNCH) 
-				completeOrderInternal(order.getOrderID());
-			else if (orderProcessingMode == TradeConfig.ASYNCH)
-				queueOrder(order.getOrderID(), false);
-			else //TradeConfig.ASYNC_2PHASE
+				completeOrder(order.getOrderID(), false);
+			else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
 				queueOrder(order.getOrderID(), true);
 
 		}
@@ -574,38 +528,12 @@
 	public OrderDataBean completeOrder(Integer orderID, boolean twoPhase)
 	throws Exception {
 		if (Log.doTrace()) Log.trace("TradeBean:completeOrder", orderID + " twoPhase="+twoPhase);
-		if (twoPhase)
-			return completeOrderInternal(orderID);
-		else
-		{
-			// invoke the completeOrderOnePhase -- which requires a new transaction
-			// the completeOrder will run in it's own transaction thus not requiring a 
-			// 2-phase commit
-			return ((Trade)context.getEJBObject()).completeOrderOnePhase(orderID);
-		}
-	}
-	
-	//completeOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
-	//thus the completeOrder call from the MDB should not require a 2-phase commit
-	public OrderDataBean completeOrderOnePhase(Integer orderID)
-	throws RemoteException {
-        try{
-		if (Log.doTrace()) Log.trace("TradeBean:completeOrderOnePhase", orderID);		
-		return completeOrderInternal(orderID);
-        }catch (Exception e){
-            throw new RemoteException(e.getMessage(),e);
-        }
-	}
-
-	private OrderDataBean completeOrderInternal(Integer orderID) 
-			throws Exception
-	{
 
 		LocalOrder order = orderHome.findByPrimaryKeyForUpdate(orderID);
 		
 		if (order == null)
 		{
-			Log.error("TradeBean:completeOrderInternal  -- Unable to find Order " + orderID + " FBPK
returned " + order);
+			Log.error("TradeBean:completeOrder  -- Unable to find Order " + orderID + " FBPK returned
" + order);
 			order.cancel();			
 			return order.getDataBean();
 		}
@@ -638,7 +566,7 @@
 
 			
 		if (Log.doTrace()) Log.trace(
-					"TradeBeanInternal:completeOrder--> Completing Order " + order.getOrderID()
+					"TradeBean:completeOrder--> Completing Order " + order.getOrderID()
 					 + "\n\t Order info: "   +   order
 					 + "\n\t Account info: " + account
 					 + "\n\t Quote info: "   +   quote
@@ -662,7 +590,7 @@
 			 */
 			if ( holding == null )
 			{
-				Log.error("TradeBean:completeOrderInternal -- Unable to sell order " + order.getOrderID()
+ " holding already sold");
+				Log.error("TradeBean:completeOrder -- Unable to sell order " + order.getOrderID() + "
holding already sold");
 				order.cancel();
 				return order.getDataBean();
 			}
@@ -700,62 +628,10 @@
 		return order.getDataBean();
 	}
 	
-	
-	//These methods are used to provide the 1-phase commit runtime option for TradeDirect
-	// Basically these methods are deployed as txn requires new and invoke TradeDirect methods
-	// There is no mechanism outside of EJB to start a new transaction
-    public OrderDataBean completeOrderOnePhaseDirect(Integer orderID)
-    throws RemoteException {
-        try{
-    	if (Log.doTrace())
-    		Log.trace("TradeBean:completeOrderOnePhaseDirect -- completing order by calling TradeDirect
orderID=" +orderID);
-    	    return (new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).completeOrderOnePhase(orderID);
-        } catch (Exception e){
-            throw new RemoteException(e.getMessage(),e);
-        }
-    }
-	public void cancelOrderOnePhaseDirect(Integer orderID) 
-	throws RemoteException {
-        try{
-    	if (Log.doTrace())
-    		Log.trace("TradeBean:cancelOrderOnePhaseDirect -- cancelling order by calling TradeDirect
orderID=" +orderID);
-		(new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).cancelOrderOnePhase(orderID);
-        } catch(Exception e){
-            throw new RemoteException(e.getMessage(),e);
-        }
-	}
-	
-	
 	public void cancelOrder(Integer orderID, boolean twoPhase)
 	throws Exception {
 		if (Log.doTrace()) Log.trace("TradeBean:cancelOrder", orderID + " twoPhase="+twoPhase);
-		if (twoPhase)
-			cancelOrderInternal(orderID);
-		else
-		{
-			// invoke the cancelOrderOnePhase -- which requires a new transaction
-			// the completeOrder will run in it's own transaction thus not requiring a 
-			// 2-phase commit
-			((Trade)context.getEJBObject()).cancelOrderOnePhase(orderID);
-		}
-	}
-
-	//cancelOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
-	//thus the completeOrder call from the MDB should not require a 2-phase commit
-	public void cancelOrderOnePhase(Integer orderID)
-	throws RemoteException {
-        try{
-		if (Log.doTrace()) Log.trace("TradeBean:cancelOrderOnePhase", orderID);		
-		cancelOrderInternal(orderID);
-        } catch (Exception e){
-            throw new RemoteException(e.getMessage(),e);
-        }
-	}
-	
-	
-	private void cancelOrderInternal(Integer orderID)
-	throws Exception
-	{
+		
 		LocalOrder order = orderHome.findByPrimaryKeyForUpdate(orderID);
 		order.cancel();
 	}

Modified: geronimo/daytrader/trunk/modules/web/src/main/webapp/config.jsp
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/web/src/main/webapp/config.jsp?view=diff&rev=509336&r1=509335&r2=509336
==============================================================================
--- geronimo/daytrader/trunk/modules/web/src/main/webapp/config.jsp (original)
+++ geronimo/daytrader/trunk/modules/web/src/main/webapp/config.jsp Mon Feb 19 13:15:35 2007
@@ -128,12 +128,10 @@
 			<TD><BR>
 			Order Processing Mode determines the mode for completing stock
 			purchase and sell operations. Synchronous mode completes the order
-			immediately. Asynchronous_1-phase mode uses MDB/JMS to queue the
-			order to a DayTrader broker agent to complete the order.
-			Asychronous_2-Phase performs a 2-phase commit over the EJB Entity/DB
-			and MDB/JMS transactions. See <A href="docs/tradeFAQ.html">DayTrader
-			FAQ</A> for details. <B></B><BR>
-			</TD>
+			immediately. Asychronous_2-Phase performs a 2-phase commit over the EJB Entity/DB
+ 			and MDB/JMS transactions. See <A href="docs/tradeFAQ.html">DayTrader
+ 			FAQ</A> for details. <B></B><BR>
+ 			</TD>
 		</TR>
 		<TR>
 			<TD align="left"><B>Access Mode </B>



Mime
View raw message