ESBCOMP-70 Fix to improve memory leak in BPEL-SE

master
David BRASSELY 2014-04-10 14:26:12 +02:00
parent 22adb186a5
commit 8fb24d2031
2 changed files with 38 additions and 11 deletions

View File

@ -1221,15 +1221,21 @@ public class BPELProcessInstanceImpl extends StructuredActivityUnitImpl implemen
* pushCompletedScope(com.sun.jbi.engine.bpel.core.bpel.model.runtime.Context)
*/
public int pushCompletedScope(Context completedScope) {
synchronized (mCompletedScopes) {
if (currentProcessState == ProcessState.Running
|| currentProcessState == ProcessState.WaitingForEventsToComplete) {
mCompletedScopes.push(completedScope);
return mCompletedScopes.size();
} else {
return 0;
}
}
synchronized (mCompletedScopes) {
if(completedScope instanceof ScopeUnitImpl){
ScopeUnitImpl completedScopeUnit = (ScopeUnitImpl)completedScope;
if((completedScopeUnit.hasCompensationHandler() || completedScopeUnit.hasFaultHandler() || completedScopeUnit.hasEventHandler() || completedScopeUnit.hasTerminationHandler()) &&
(currentProcessState == ProcessState.Running || currentProcessState == ProcessState.WaitingForEventsToComplete))
{
mCompletedScopes.push(completedScope);
return mCompletedScopes.size();
}
}
}
return 0;
}
/*
@ -1682,4 +1688,4 @@ public class BPELProcessInstanceImpl extends StructuredActivityUnitImpl implemen
return false;
}
}
}
}

View File

@ -57,6 +57,7 @@ import com.sun.bpel.model.meta.RPartnerLink;
import com.sun.bpel.model.meta.RReply;
import com.sun.bpel.model.meta.RStartElement;
import com.sun.bpel.model.meta.RVariable;
import com.sun.bpel.model.meta.impl.RScopeImpl;
import com.sun.jbi.engine.bpel.core.bpel.engine.BPELProcessInstance;
import com.sun.jbi.engine.bpel.core.bpel.engine.BPELProcessManager;
import com.sun.jbi.engine.bpel.core.bpel.engine.BusinessProcessInstanceThread;
@ -1352,6 +1353,27 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
}
}
public boolean hasCompensationHandler() {
return mAct instanceof RScopeImpl &&
((RScopeImpl)mAct).getCompensationHandler() != null;
}
public boolean hasFaultHandler() {
return mAct instanceof RScopeImpl &&
((RScopeImpl)mAct).getFaultHandlers() != null;
}
public boolean hasTerminationHandler() {
return mAct instanceof RScopeImpl &&
((RScopeImpl)mAct).getTerminationHandler() != null;
}
public boolean hasEventHandler() {
return mAct instanceof RScopeImpl &&
((RScopeImpl)mAct).getEventHandlers() != null;
}
private Context popCompletedScope() {
try {
return mCompletedScopes.pop();
@ -1505,4 +1527,3 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
}
}
}