public void run() {
if (!_active.isEmpty() || _pickResponseChannel != null) {
CompositeProcess mlset = ProcessUtil.compose(null);
if (!_terminated) {
mlset.or(new ReceiveProcess() {
private static final long serialVersionUID = 7666910462948788042L;
}.setChannel(_tc).setReceiver(new Termination() {
public void terminate() {
terminateActive();
_terminated = true;
if (_pickResponseChannel != null)
getBpelRuntimeContext().cancel(_pickResponseChannel);
instance(WAITING.this);
}
}));
}
if (!_stopped) {
mlset.or(new ReceiveProcess() {
private static final long serialVersionUID = -1050788954724647970L;
}.setChannel(_ehc).setReceiver(new EventHandlerControl() {
public void stop() {
_stopped = true;
if (_pickResponseChannel != null)
getBpelRuntimeContext().cancel(_pickResponseChannel);
instance(WAITING.this);
}
}));
}
for (final ActivityInfo ai : _active) {
mlset.or(new ReceiveProcess() {
private static final long serialVersionUID = 5341207762415360982L;
}.setChannel(ai.parent).setReceiver(new ParentScope() {
public void compensate(OScope scope, Synch ret) {
_psc.compensate(scope, ret);
instance(WAITING.this);
}
public void completed(FaultData faultData, Set<CompensationHandler> compensations) {
_active.remove(ai);
_comps.addAll(compensations);
if (faultData != null && _fault == null) {
_fault = faultData;
terminateActive();
// ODE-511; needs to clean up the route
if (_pickResponseChannel != null)
getBpelRuntimeContext().cancel(_pickResponseChannel);
_psc.completed(_fault, _comps);
} else
instance(WAITING.this);
}
public void cancelled() { completed(null, CompensationHandler.emptySet()); }
public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
}));
}
if (_pickResponseChannel != null)
mlset.or(new ReceiveProcess() {
private static final long serialVersionUID = -4929999153478677288L;
}.setChannel(_pickResponseChannel).setReceiver(new PickResponse() {
public void onRequestRcvd(int selectorIdx, String mexId) {
// The receipt of the message causes a new scope to be created:
ScopeFrame ehScopeFrame = new ScopeFrame(_oevent,