ArrayList<String> removalNameList = new ArrayList<String>();
if (contextMap != null) {
for (Map.Entry<String, ViewScopeContextObject> entry : contextMap.entrySet()) {
String passivationCapableId = entry.getKey();
Contextual contextual = beanManager.getPassivationCapableBean(passivationCapableId);
ViewScopeContextObject contextObject = entry.getValue();
CreationalContext creationalContext = beanManager.createCreationalContext(contextual);
// We can no longer get this from the contextObject. Instead we must call
// beanManager.createCreationalContext(contextual)
contextual.destroy(viewMap.get(contextObject.getName()), creationalContext);
removalNameList.add(contextObject.getName());
}
Iterator<String> removalNames = removalNameList.iterator();
while (removalNames.hasNext()) {