}
public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
{
RegistrationSPI registration = getRegistrationAsSPI();
if (registration != null)
{
for (PortletContext portletContext : portletContexts)
{
checkOperationIsAllowed(portletContext, registration, "destroyClones");
}
}
List<DestroyCloneFailure> cloneFailures = super.destroyClones(portletContexts);
boolean noFailures = cloneFailures.isEmpty();
if (registration != null)
{
for (PortletContext portletContext : portletContexts)
{
// only remove the portlet context if there are no failures or it's not part of the failed clones
if (noFailures || !cloneFailures.contains(new DestroyCloneFailure(portletContext.getId())))
{
try
{
registration.removePortletContext(portletContext);
}
catch (RegistrationException e)
{
throw new PortletInvokerException("Couldn't remove portlet context '" + portletContext + "' to registration '" + registration.getRegistrationHandle() + "'", e);
}
}
}
}