[jboss-svn-commits] JBL Code SVN: r25287 - in labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services: taxi and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Feb 16 06:48:31 EST 2009
Author: adinn
Date: 2009-02-16 06:48:29 -0500 (Mon, 16 Feb 2009)
New Revision: 25287
Modified:
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantManager.java
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantParticipantBA.java
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiManager.java
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiParticipantBA.java
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreManager.java
labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreParticipantBA.java
Log:
updated demo to implement participant error method which may be called in exceptional circumstances in response to a coordinator fault
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantManager.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantManager.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantManager.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -396,6 +396,32 @@
}
/**
+ * Handle BA error for a specific booking.
+ *
+ * @param txID The transaction identifier
+ */
+ public synchronized void error(Object txID)
+ {
+ // undo any provisional or actual changes associated wiht the booking
+
+ Integer request = (Integer) unpreparedTransactions.remove(txID);
+ if (request != null) {
+ nBookedSeats -= request.intValue();
+ } else if ((request = (Integer)preparedTransactions.remove(txID)) != null) {
+ nFreeSeats += request.intValue();
+ nPreparedSeats -= request.intValue();
+ nBookedSeats -= request.intValue();
+ updateState();
+ } else if ((request = (Integer)compensatableTransactions.remove(txID)) != null) {
+ nCompensatableSeats -= request.intValue();
+
+ nCommittedSeats -= request.intValue();
+ nFreeSeats += request.intValue();
+ updateState();
+ }
+ }
+
+ /**
* Determine if a specific transaction is known to the business logic.
*
* @param txID The uniq id for the transaction
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantParticipantBA.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantParticipantBA.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantParticipantBA.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -156,12 +156,23 @@
public void unknown() throws SystemException
{
- // used for calbacks during crash recovery. This impl is not recoverable
}
public void error() throws SystemException
{
- // used for calbacks during crash recovery. This impl is not recoverable
+ System.out.println("RestaurantParticipantBA.error");
+
+ getRestaurantView().addMessage("id:" + txID + ". Received error for participant: " + this.getClass().toString());
+
+ getRestaurantView().updateFields();
+
+ // tell the manager we had an error
+
+ getRestaurantManager().error(txID);
+
+ getRestaurantView().addMessage("id:" + txID + ". Notified error for participant: " + this.getClass().toString());
+
+ getRestaurantView().updateFields();
}
/**
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiManager.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiManager.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiManager.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -348,6 +348,24 @@
}
/**
+ * Handle BA error for a specific booking.
+ *
+ * @param txID The transaction identifier
+ */
+ public synchronized void error(Object txID)
+ {
+ // undo any provisional or actual changes associated wiht the booking
+
+ Integer request = (Integer) unpreparedTransactions.remove(txID);
+ if (request != null) {
+ } else if ((request = (Integer)preparedTransactions.remove(txID)) != null) {
+ updateState();
+ } else if ((request = (Integer)compensatableTransactions.remove(txID)) != null) {
+ updateState();
+ }
+ }
+
+ /**
* Determine if a specific transaction is known to the business logic.
*
* @param txID The uniq id for the transaction
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiParticipantBA.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiParticipantBA.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/taxi/TaxiParticipantBA.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -158,7 +158,19 @@
public void error() throws SystemException
{
- // used for calbacks during crash recovery. This impl is not recoverable
+ System.out.println("TaxiParticipantBA.error");
+
+ getTaxiView().addMessage("id:" + txID + ". Received error for participant: " + this.getClass().toString());
+
+ getTaxiView().updateFields();
+
+ // tell the manager we had an error
+
+ getTaxiManager().error(txID);
+
+ getTaxiView().addMessage("id:" + txID + ". Notified error for participant: " + this.getClass().toString());
+
+ getTaxiView().updateFields();
}
/**
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreManager.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreManager.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreManager.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -445,6 +445,38 @@
}
/**
+ * Handle BA error for a specific booking.
+ *
+ * @param txID The transaction identifier
+ */
+ public synchronized void error(Object txID)
+ {
+ // undo any provisional or actual changes associated wiht the booking
+
+ Integer[] request = (Integer[]) unpreparedTransactions.remove(txID);
+ if (request != null) {
+ for (int i = 0; i < NUM_SEAT_AREAS; i++) {
+ nBookedSeats[i] -= request[i].intValue();
+ }
+ } else if ((request = (Integer[])preparedTransactions.remove(txID)) != null) {
+ for (int i = 0; i < NUM_SEAT_AREAS; i++) {
+ nFreeSeats[i] += request[i].intValue();
+ nPreparedSeats[i] -= request[i].intValue();
+ nBookedSeats[i] -= request[i].intValue();
+ }
+ updateState();
+ } else if ((request = (Integer[])compensatableTransactions.remove(txID)) != null) {
+ for (int i = 0; i < NUM_SEAT_AREAS; i++) {
+ nCompensatableSeats[i] -= request[i].intValue();
+
+ nCommittedSeats[i] -= request[i].intValue();
+ nFreeSeats[i] += request[i].intValue();
+ }
+ updateState();
+ }
+ }
+
+ /**
* Determine if a specific transaction is known to the business logic.
*
* @param txID The uniq id for the transaction
Modified: labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreParticipantBA.java
===================================================================
--- labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreParticipantBA.java 2009-02-16 04:12:08 UTC (rev 25286)
+++ labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/theatre/TheatreParticipantBA.java 2009-02-16 11:48:29 UTC (rev 25287)
@@ -162,9 +162,22 @@
public void error() throws SystemException
{
- // used for calbacks during crash recovery. This impl is not recoverable
+ System.out.println("TheatreParticipantBA.error");
+
+ getTheatreView().addMessage("id:" + txID + ". Received error for participant: " + this.getClass().toString());
+
+ getTheatreView().updateFields();
+
+ // tell the manager we had an error
+
+ getTheatreManager().error(txID);
+
+ getTheatreView().addMessage("id:" + txID + ". Notified error for participant: " + this.getClass().toString());
+
+ getTheatreView().updateFields();
}
+
/**
* Id for the transaction which this participant instance relates to.
* Set by the service (via contrtuctor) at enrolment time, this value
More information about the jboss-svn-commits
mailing list