Chris, thanks for the patch. One thing that would be helpful to me is when you attach the patch you
name it with the JIRA as the first part of the patch. Its not required just makes my life a little
easier when I've got a bunch of patches.
Thanks!
Matt
Christopher James Blythe (JIRA) wrote:
[ http://issues.apache.org/jira/browse/DAYTRADER-8?page=all ]
Christopher James Blythe updated DAYTRADER-8:
---------------------------------------------
Attachment: orderPatch.diff
Sorry for the delay in posting this... I wanted to make sure I used the proper
procedure for creating the patch before posting (thanks to Jason for his
input). Also, tested this under load and there seemed to be no ill effects.
Small difference in sync order processing between Direct and EJB mode
---------------------------------------------------------------------
Key: DAYTRADER-8
URL: http://issues.apache.org/jira/browse/DAYTRADER-8
Project: DayTrader
Issue Type: Bug
Components: EJB Tier
Affects Versions: 1.1
Reporter: Christopher James Blythe
Priority: Minor
Attachments: orderPatch.diff
I have noticed a slight difference in the behavior of synchronous buy/sell
operations between EJB and JDBC mode. For example, in Sync/Direct mode, if you
perform a buy operation the resulting output of the NewOrder pages will look
something like the following...
271002 open 2006-07-19 17:04:50.921 null 24.95 buy
s:0 100.0
If I perform the same operation in Sync/EJB mode, I get the following...
272002 closed 2006-07-19 17:12:25.156 2006-07-19
17:12:25.156 24.95 buy s:1 100.0
Notice the differences between the two...
- the status (closed vs. open)
- the completion date (null vs an actual value)
I have looked into the code for this and it seems that the EJB version actually
returns a refreshed version of the bean (as performed by the ejb container).
However, in the JDBC/Direct code we perform the necessary updates to the order
via the order processing apis, but we never update the actual local copy of the
order bean before returning this.
I realize this may be a minor detail, but it does point out a slight difference
between the execution of Direct/EJB mode. The simple solution is to re-fetch
the order data before the buy/sell operations are completed in the
TradeDirect.java code, similar to the following...
orderData = getOrderData(conn, orderData.getOrderID().intValue());
if (txn != null) {
if ( Log.doTrace() )
Log.trace("TradeDirect:sell committing global transaction");
txn.commit();
setInGlobalTxn(false);
}
else
commit(conn);
Will attach a patch with this code tomorrow morning...