Merged in alexlomov/openesb-components/ESBCOMP-85-bpel-se-suffers-from-memory-l (pull request #17)
BPEL SE Memory Leak Fixesmaster
commit
c3c7ebbe2f
|
@ -1165,6 +1165,7 @@ public class BPELProcessManagerImpl implements BPELProcessManager {
|
|||
mAllInstances.remove(bp);
|
||||
mAllInstanceIds.remove(bp.getId());
|
||||
BPELHelper.removeUID(bp.getId());
|
||||
mReadyToRunQueue.cleanUp(bp.getId());
|
||||
}
|
||||
|
||||
public void pickMgrCleanUp(ICallFrame callframe) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import com.sun.jbi.engine.bpel.core.bpel.engine.BPELProcessManager;
|
||||
import com.sun.jbi.engine.bpel.core.bpel.engine.BusinessProcessInstanceThread;
|
||||
|
@ -412,4 +413,19 @@ public class ReadyToRunQueue {
|
|||
public Set<BusinessProcessInstanceThread> getWaitingBPIsSet() {
|
||||
return mWaitingBPIsSet;
|
||||
}
|
||||
|
||||
public void cleanUp(final String bpId) {
|
||||
ReentrantLock lock = new ReentrantLock();
|
||||
lock.lock();
|
||||
try {
|
||||
for (Iterator<BusinessProcessInstanceThread> i = mWaitingBPIsSet.iterator(); i.hasNext();) {
|
||||
final BusinessProcessInstanceThread bpit = i.next();
|
||||
if (bpId.equals(bpit.getProcessInstanceId())) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ public interface FaultHandlingContext {
|
|||
*/
|
||||
void registerEnclosedScope(FaultHandlingContext enclosedScope);
|
||||
|
||||
/**
|
||||
* Removes itself from the parent context.
|
||||
* @param enclosedScope
|
||||
*/
|
||||
void unregisterEnclosedScope(FaultHandlingContext enclosedScope);
|
||||
|
||||
/**
|
||||
* When a callframe is created it will be registered with the FaultHandlingContext.
|
||||
* This is used by the FaultHandlingContext to remove any callframe that is waiting
|
||||
|
|
|
@ -860,7 +860,15 @@ public class BPELProcessInstanceImpl extends StructuredActivityUnitImpl implemen
|
|||
*/
|
||||
public void registerEnclosedScope(FaultHandlingContext enclosedScope) {
|
||||
enclosedScopes.add(enclosedScope);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.jbi.engine.bpel.core.bpel.model.runtime.FaultHandlingContext#unregisterEnclosedScope(
|
||||
* com.sun.jbi.engine.bpel.core.bpel.model.runtime.FaultHandlingContext)
|
||||
*/
|
||||
public void unregisterEnclosedScope(FaultHandlingContext enclosedScope) {
|
||||
enclosedScopes.remove(enclosedScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.jbi.engine.bpel.core.bpel.model.runtime.FaultHandlingContext#notifyFault(
|
||||
|
|
|
@ -291,6 +291,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
currentScopeState = ScopeState.Completed;
|
||||
// clear all the FH related data as the scope has completed.
|
||||
clearFHRelatedData();
|
||||
unregisterFromParent(this);
|
||||
// push this completed scope instance to the parent sope stack of completed scopes.
|
||||
mCompletionOrder = getParentContext().getFaultHandlingContext().pushCompletedScope(this);
|
||||
updateScopeOnState(rObjs);
|
||||
|
@ -310,6 +311,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
currentScopeState = ScopeState.Completed;
|
||||
// clear all the FH related data as the scope has completed.
|
||||
clearFHRelatedData();
|
||||
unregisterFromParent(this);
|
||||
// push this completed scope instance to the parent scope stack of completed scopes.
|
||||
mCompletionOrder = getParentContext().getFaultHandlingContext().pushCompletedScope(this);
|
||||
updateScopeOnState(rObjs);
|
||||
|
@ -391,6 +393,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
currentScopeState = ScopeState.Completed;
|
||||
// clear all the FH related data as the scope has completed.
|
||||
clearFHRelatedData();
|
||||
unregisterFromParent(this);
|
||||
// push this completed scope instance to the parent scope stack of completed scopes.
|
||||
mCompletionOrder = getParentContext().getFaultHandlingContext().pushCompletedScope(this);
|
||||
updateScopeOnState(rObjs);
|
||||
|
@ -712,7 +715,15 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
*/
|
||||
public void registerEnclosedScope(FaultHandlingContext enclosedScope) {
|
||||
enclosedScopes.add(enclosedScope);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterEnclosedScope(FaultHandlingContext enclosedScope) {
|
||||
enclosedScopes.remove(enclosedScope);
|
||||
}
|
||||
|
||||
private void unregisterFromParent(FaultHandlingContext scope) {
|
||||
mContext.getFaultHandlingContext().unregisterEnclosedScope(scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.jbi.engine.bpel.core.bpel.model.runtime.FaultHandlingContext#notifyFault(
|
||||
|
@ -807,6 +818,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
|
||||
// clean the FH related data.
|
||||
clearFHRelatedData();
|
||||
unregisterFromParent(this);
|
||||
}
|
||||
|
||||
private void clearFHRelatedData() {
|
||||
|
@ -1252,6 +1264,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
removeVariableReferences();
|
||||
frame.getProcessInstance().getPersistenctMgr().updateState(this,
|
||||
mContext.getStateContext().getState(), true);
|
||||
unregisterFromParent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1460,6 +1473,7 @@ public class ScopeUnitImpl extends StructuredActivityUnitImpl implements Context
|
|||
*/
|
||||
private void updateScopeStateAsDone(boolean persistenceEnabled, RequiredObjects rObjs) {
|
||||
currentScopeState = ScopeState.Done;
|
||||
unregisterFromParent(this);
|
||||
// update the Scope on the StateImpl
|
||||
if (persistenceEnabled) {
|
||||
updateScopeOnState(rObjs);
|
||||
|
|
Loading…
Reference in New Issue