Author: assaf
Date: Thu Sep 7 00:05:10 2006
New Revision: 441001
URL: http://svn.apache.org/viewvc?view=rev&rev=441001
Log:
Activity failure/recovery information now updated to database
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=441001&r1=441000&r2=441001
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
Thu Sep 7 00:05:10 2006
@@ -23,6 +23,7 @@
import org.apache.ode.bpel.common.CorrelationKey;
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.common.ProcessState;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
import org.apache.ode.bpel.dao.CorrelationSetDAO;
import org.apache.ode.bpel.dao.CorrelatorDAO;
import org.apache.ode.bpel.dao.MessageDAO;
@@ -1200,10 +1201,37 @@
return
dao.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
}
- public void registerForRecovery(ActivityRecoveryChannel channel) {
- }
-
- public void unregisterForRecovery(ActivityRecoveryChannel channel) {
+ public void registerActivityForRecovery(ActivityRecoveryChannel channel,
long activityId, String reason,
+ Date dateTime, Element data,
String[] actions) {
+System.out.println("-- Registering activity for recovery: " +
channel.export().toString());
+ if (reason == null)
+ reason = "Unspecified";
+ if (dateTime == null)
+ dateTime = new Date();
+ _dao.createActivityRecovery(channel.export(), (int)activityId, reason,
dateTime, data, actions);
+ }
+
+ public void unregisterActivityForRecovery(ActivityRecoveryChannel channel)
{
+System.out.println("-- Unregistering activity for recovery: " +
channel.export().toString());
+ _dao.deleteActivityRecovery(channel.export());
+ }
+
+ public void recoverActivity(final String channel, final String action,
final FaultData fault) {
+System.out.println("-- Recovery activity: " + channel + ": " + action);
+ vpu.inject(new JacobRunnable() {
+ private static final long serialVersionUID = 3168964409165899533L;
+ public void run() {
+ // ActivityRecoveryChannel channel = importChannel(channel,
ActivityRecoveryChannel.class);
+ ActivityRecoveryChannel channel = null;
+ if ("cancel".equals(action))
+ channel.cancel();
+ else if ("retry".equals(action))
+ channel.retry();
+ else if ("fault".equals(action))
+ channel.fault(fault);
+ }
+ });
+ _dao.deleteActivityRecovery(channel);
}
/**
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java?view=diff&rev=441001&r1=441000&r2=441001
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
Thu Sep 7 00:05:10 2006
@@ -243,9 +243,12 @@
Element getSourceEPR(String mexId);
- void registerForRecovery(ActivityRecoveryChannel channel);
+ void registerActivityForRecovery(ActivityRecoveryChannel channel, long
activityId, String reason,
+ Date dateTime, Element data, String[]
actions);
- void unregisterForRecovery(ActivityRecoveryChannel channel);
+ void unregisterActivityForRecovery(ActivityRecoveryChannel channel);
+
+ void recoverActivity(final String channel, final String action, final
FaultData fault);
String getSourceSessionId(String mexId);
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java?view=diff&rev=441001&r1=441000&r2=441001
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
Thu Sep 7 00:05:10 2006
@@ -198,9 +198,10 @@
_self.parent.completed(faultData, CompensationHandler.emptySet());
return;
}
-
+System.out.println("-- Invoked: " + _invoked);
+System.out.println("-- retryFor: " + _self.getFailureHandling().retryFor);
// If maximum number of retries, enter activity recovery state.
- if (_invoked > _self.getFailureHandling().retryFor + 1) {
+ if (_invoked > _self.getFailureHandling().retryFor) {
requireRecovery();
return;
}
@@ -227,19 +228,21 @@
}
private void requireRecovery() {
+System.out.println("-- Require recovery");
final ActivityRecoveryChannel recoveryChannel =
newChannel(ActivityRecoveryChannel.class);
- getBpelRuntimeContext().registerForRecovery(recoveryChannel);
+ getBpelRuntimeContext().registerActivityForRecovery(recoveryChannel,
_self.aId, _failureReason, _lastFailure, null,
+ new String[] { "retry", "cancel", "fault" });
object(false, new ActivityRecoveryChannelListener(recoveryChannel) {
public void retry() {
- getBpelRuntimeContext().unregisterForRecovery(recoveryChannel);
+ getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
instance(INVOKE.this);
}
public void cancel() {
- getBpelRuntimeContext().unregisterForRecovery(recoveryChannel);
+ getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
_self.parent.completed(null, CompensationHandler.emptySet());
}
public void fault(FaultData faultData) {
- getBpelRuntimeContext().unregisterForRecovery(recoveryChannel);
+ getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
// TODO: real fault name.
if (faultData == null)
faultData = createFault(FailureHandling.FAILURE_FAULT_NAME, _self.o,
_failureReason);
@@ -247,7 +250,7 @@
}
}.or(new TerminationChannelListener(_self.self) {
public void terminate() {
- getBpelRuntimeContext().unregisterForRecovery(recoveryChannel);
+ getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
_self.parent.completed(null, CompensationHandler.emptySet());
}
}));
Modified:
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java?view=diff&rev=441001&r1=441000&r2=441001
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
Thu Sep 7 00:05:10 2006
@@ -390,9 +390,14 @@
return null;
}
- public void registerForRecovery(ActivityRecoveryChannel channel) {
- }
+ public void registerActivityForRecovery(ActivityRecoveryChannel channel,
long activityId, String reason,
+ Date dateTime, Element data,
String[] actions) {
+ }
+
+ public void unregisterActivityForRecovery(ActivityRecoveryChannel channel)
{
+ }
+
+ public void recoverActivity(final String channel, final String action,
final FaultData fault) {
+ }
- public void unregisterForRecovery(ActivityRecoveryChannel channel) {
- }
}