Author: jeff.yuchang
Date: 2011-07-26 00:45:39 -0400 (Tue, 26 Jul 2011)
New Revision: 1429
Modified:
trunk/runtime/clustering/src/main/java/org/jboss/soa/bpel/clustering/ODEJobClusterListener.java
Log:
*RIFTSAW-404, TransactionRequiredException.
Modified:
trunk/runtime/clustering/src/main/java/org/jboss/soa/bpel/clustering/ODEJobClusterListener.java
===================================================================
---
trunk/runtime/clustering/src/main/java/org/jboss/soa/bpel/clustering/ODEJobClusterListener.java 2011-07-12
09:33:51 UTC (rev 1428)
+++
trunk/runtime/clustering/src/main/java/org/jboss/soa/bpel/clustering/ODEJobClusterListener.java 2011-07-26
04:45:39 UTC (rev 1429)
@@ -57,7 +57,7 @@
/**
- * Move jobs that assoicated with dead members to an active node.
+ * Move jobs that were associated with dead members to an active node.
*
*/
public void membershipChanged(Vector deadMembers, Vector newMembers, Vector allMembers)
{
@@ -69,24 +69,34 @@
setClusterNodeListsIntoScheduler(allMembers);
}
- if (!deadMembers.isEmpty()) {
- SchedulerDAOConnection conn = schedulerCF.getConnection();
- String activeNodeId = allMembers.iterator().next().toString();
- Iterator<?> it = deadMembers.iterator();
+ try {
+ txm.begin();
+ if (!deadMembers.isEmpty()) {
+ SchedulerDAOConnection conn = schedulerCF.getConnection();
+ String activeNodeId = allMembers.iterator().next().toString();
+ Iterator<?> it = deadMembers.iterator();
+ try {
+ while (it.hasNext()) {
+ String deadNodeId = it.next().toString();
+ conn.updateReassign(deadNodeId, activeNodeId);
+ logger.debug("Move all of jobs associated with [" + deadNodeId + "]
to new node [" + activeNodeId + "]");
+ }
+ } catch (DatabaseException e) {
+ String errMsg = "Error in updating Job from dead node to active node : " +
activeNodeId;
+ logger.error(errMsg);
+ throw new ClusteringException(errMsg, e);
+ }
+
+ }
+ txm.commit();
+ } catch (Exception e) {
try {
- while (it.hasNext()) {
- String deadNodeId = it.next().toString();
- conn.updateReassign(deadNodeId, activeNodeId);
- logger.debug("Move all of jobs associated with [" + deadNodeId + "]
to new node [" + activeNodeId + "]");
- }
- } catch (DatabaseException e) {
- String errMsg = "Error in updating Job from dead node to active node : " +
activeNodeId;
- logger.error(errMsg);
- throw new ClusteringException(errMsg, e);
+ txm.rollback();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ logger.error(e1);
}
-
- }
-
+ }
}
Show replies by date