SWF-302 polishing--renamed unlock method to more general cleanup and added cleanup of flow execution holder

This commit is contained in:
Keith Donald
2007-05-04 19:06:28 +00:00
parent 30621467b3
commit 8d491cba01
3 changed files with 7 additions and 6 deletions

View File

@@ -28,7 +28,6 @@ import org.springframework.webflow.execution.FlowExecution;
* {@link FacesContext}'s {@link ExternalContext#getRequestMap()}.
*
* @author Keith Donald
* @author Craig McClanahan
*/
public class FlowExecutionHolderUtils {
@@ -92,13 +91,15 @@ public class FlowExecutionHolderUtils {
}
/**
* Unlocks the current flow execution in the faces context if necessary.
* Can be safely called even if no execution is bound or one is bound but not locked.
* Cleans up the current flow execution in the faces context if necessary.
* Specifically, handles unlocking the execution if necessary and setting the
* holder to null.
* @param context the faces context
*/
public static void unlockCurrentFlowExecutionIfNecessary(FacesContext context) {
public static void cleanupCurrentFlowExecution(FacesContext context) {
if (isFlowExecutionRestored(context)) {
getFlowExecutionHolder(context).unlockFlowExecutionIfNecessary();
context.getExternalContext().getRequestMap().remove(getFlowExecutionHolderKey());
}
}

View File

@@ -246,7 +246,7 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler {
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up allocated flow system resources");
}
FlowExecutionHolderUtils.unlockCurrentFlowExecutionIfNecessary(context);
FlowExecutionHolderUtils.cleanupCurrentFlowExecution(context);
ExternalContextHolder.setExternalContext(null);
}
}

View File

@@ -481,7 +481,7 @@ public class FlowPhaseListener implements PhaseListener {
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up allocated flow system resources");
}
FlowExecutionHolderUtils.unlockCurrentFlowExecutionIfNecessary(context);
FlowExecutionHolderUtils.cleanupCurrentFlowExecution(context);
ExternalContextHolder.setExternalContext(null);
}