Adding a cleanup method to DUP is probably the most natural thing to do. The reason I didn't do it was I didn't want to go modify each DUP implementation.
Also I had an idea of doing something like this
// this is the interface I'm currently using
public interface DeploymentRollbackAction { void rollback(DeploymentUnitContext ctx);}
public abstract class DeploymentUnitProcessorWithRollback implements DeploymentUnitProcessor, DeploymentRollbackAction { public final void processDeployment(DeploymentUnitContext context) throws DeploymentUnitProcessingException { context.pushRollback(this); doProcess(context); } protected abstract void doProcess(DeploymentUnitContext context) throws DeploymentUnitProcessingException;}
So then DUP that may need cleaning up can extend this processor.